Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resource & datasource vdcg (#867) #874

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changelog/861.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:deprecation
`resource/cloudavenue_vdc_group` - The `cloudavenue_vdc_group` resource is deprecated and will be removed in the release v0.30.0. Please use the `cloudavenue_vdcg` resource instead.
```

```release-note:deprecation
`datasource/cloudavenue_vdc_group` - The `cloudavenue_vdc_group` datasource is deprecated and will be removed in the release v0.30.0. Please use the `cloudavenue_vdcg` datasource instead.
```

```release-note:note
`resource/cloudavenue_vdc_group` - Add a migration guide to migrate from `cloudavenue_vdc_group` to `cloudavenue_vdcg`.
```
7 changes: 7 additions & 0 deletions .changelog/867.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:new-resource
`resource/cloudavenue_vdcg` - New resource to manage the virtual datacenter group. (This resource replace `cloudavenue_vdc_group`)
```

```release-note:new-data-source
`datasource/cloudavenue_vdcg` - New data source to get information about the virtual datacenter group. (This data source replace `cloudavenue_vdc_group`)
```
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,6 @@ linters-settings:
"NAT",
"VPN",
"BMS",
"SAML"
"SAML",
"VDCG"
]
5 changes: 4 additions & 1 deletion docs/data-sources/vdc_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ page_title: "cloudavenue_vdc_group Data Source - cloudavenue"
subcategory: "vDC (Virtual Datacenter)"
description: |-
The cloudavenue_vdc_group data source allows you to retrieve informations about an existing VDC Group.
!> Resource deprecated The resource has renamed to cloudavenue_vdcg https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/data-sources/vdcg, it will be removed in the version v0.30.0 of the provider.
---

# cloudavenue_vdc_group (Data Source)

The `cloudavenue_vdc_group` data source allows you to retrieve informations about an existing VDC Group.
The `cloudavenue_vdc_group` data source allows you to retrieve informations about an existing VDC Group.

!> **Resource deprecated** The resource has renamed to [`cloudavenue_vdcg`](https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/data-sources/vdcg), it will be removed in the version `v0.30.0` of the provider.

## Example Usage

Expand Down
33 changes: 33 additions & 0 deletions docs/data-sources/vdcg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
page_title: "cloudavenue_vdcg Data Source - cloudavenue"
subcategory: "vDC Group (Virtual Datacenter Group)"
description: |-
The cloudavenue_vdcg data source allows you to retrieve informations about an existing virtual datacenter group.
---

# cloudavenue_vdcg (Data Source)

The `cloudavenue_vdcg` data source allows you to retrieve informations about an existing virtual datacenter group.

## Example Usage

```terraform
data "cloudavenue_vdcg" "example" {
name = "example"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `id` (String) The ID of the VDC Group. Ensure that one and only one attribute from this collection is set : `name`, `id`.
- `name` (String) The name of the VDC Group. Ensure that one and only one attribute from this collection is set : `name`, `id`.

### Read-Only

- `description` (String) The description of the VDC Group.
- `status` (String) The status of the VDC Group. Value must be one of : `SAVING`, `SAVED`, `CONFIGURING`, `REALIZED`, `REALIZATION_FAILED`, `DELETING`, `DELETE_FAILED`, `OBJECT_NOT_FOUND`, `UNCONFIGURED`.
- `type` (String) The type of the VDC Group. Value must be one of : `LOCAL`, `UNIVERSAL`.
- `vdc_ids` (Set of String) List of VDC IDs attached to the VDC Group.
55 changes: 53 additions & 2 deletions docs/resources/vdc_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,63 @@ page_title: "cloudavenue_vdc_group Resource - cloudavenue"
subcategory: "vDC (Virtual Datacenter)"
description: |-
The cloudavenue_vdc_group resource allows you to manage VDC Group.
!> Resource deprecated The resource has renamed to cloudavenue_vdcg https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/resources/vdcg, it will be removed in the version v0.30.0 of the provider.
---

# cloudavenue_vdc_group (Resource)

The `cloudavenue_vdc_group` resource allows you to manage VDC Group.

The `cloudavenue_vdc_group` resource allows you to manage VDC Group.

!> **Resource deprecated** The resource has renamed to [`cloudavenue_vdcg`](https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/resources/vdcg), it will be removed in the version `v0.30.0` of the provider.

## How to migrate existing resources

Original configuration:

```terraform
resource "cloudavenue_vdc_group" "example" {
name = "example"
vdc_ids = [
cloudavenue_vdc.example.id,
]
}
```

Migrated configuration:

Rename the resource to `cloudavenue_vdcg` and add the `moved` block to the configuration:

```hcl
resource "cloudavenue_vdcg" "example" {
name = "example"
vdc_ids = [
cloudavenue_vdc.example.id,
]
}

moved {
from = cloudavenue_vdc_group.example
to = cloudavenue_vdcg.example
}
```

Run `terraform plan` and `terraform apply` to migrate the resource.

Example of terraform plan output:

```shell
Terraform will perform the following actions:

# cloudavenue_vdc_group.example has moved to cloudavenue_vdcg.example
resource "cloudavenue_vdcg" "example" {
id = "urn:vcloud:vdcGroup:xxxx-xxxx-xxxxx-xxxxxx"
name = "example"
# (3 unchanged attributes hidden)
}

Plan: 0 to add, 0 to change, 0 to destroy.
```

## Example Usage

```terraform
Expand Down
46 changes: 46 additions & 0 deletions docs/resources/vdcg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
page_title: "cloudavenue_vdcg Resource - cloudavenue"
subcategory: "vDC Group (Virtual Datacenter Group)"
description: |-
The cloudavenue_vdcg resource allows you to manage a virtual datacenter group.
---

# cloudavenue_vdcg (Resource)

The `cloudavenue_vdcg` resource allows you to manage a virtual datacenter group.

## Example Usage

```terraform
resource "cloudavenue_vdcg" "example" {
name = "example"
vdc_ids = [
cloudavenue_vdc.example.id,
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the VDC Group.
- `vdc_ids` (Set of String) List of VDC IDs attached to the VDC Group. Set must contain at least 1 elements.

### Optional

- `description` (String) The description of the VDC Group.

### Read-Only

- `id` (String) The ID of the VDC Group.
- `status` (String) The status of the VDC Group. Value must be one of : `SAVING`, `SAVED`, `CONFIGURING`, `REALIZED`, `REALIZATION_FAILED`, `DELETING`, `DELETE_FAILED`, `OBJECT_NOT_FOUND`, `UNCONFIGURED`.
- `type` (String) The type of the VDC Group. Value must be one of : `LOCAL`, `UNIVERSAL`.

## Import

Import is supported using the following syntax:
```shell
terraform import cloudavenue_vdcg.example vdcGroupNameOrID
```
3 changes: 3 additions & 0 deletions examples/data-sources/cloudavenue_vdcg/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "cloudavenue_vdcg" "example" {
name = "example"
}
1 change: 1 addition & 0 deletions examples/resources/cloudavenue_vdcg/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import cloudavenue_vdcg.example vdcGroupNameOrID
6 changes: 6 additions & 0 deletions examples/resources/cloudavenue_vdcg/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "cloudavenue_vdcg" "example" {
name = "example"
vdc_ids = [
cloudavenue_vdc.example.id,
]
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.3
require (
github.com/FrangipaneTeam/terraform-analytic-tool v0.0.12
github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.4
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.0
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.1
github.com/FrangipaneTeam/terraform-plugin-framework-supertypes v0.4.0
github.com/FrangipaneTeam/terraform-plugin-framework-validators v1.8.1
github.com/aws/aws-sdk-go v1.55.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/FrangipaneTeam/terraform-analytic-tool v0.0.12 h1:rbh0EtyILnuyu07RuOh
github.com/FrangipaneTeam/terraform-analytic-tool v0.0.12/go.mod h1:j3TxedNm9WrKKseOSBKxnNtquuXa0FQChO/QdcvPKtg=
github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.4 h1:FGb+DIj8AtUehYLt7b0t1rjqK/7sggkoZwR4tqdQjcc=
github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers v1.3.4/go.mod h1:ngKE3iJWLWPLZ64umTr5ndnqd9mvMxHUZPk9pCkGSJY=
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.0 h1:x9MfFpk8neqrcwEiSXKEsieI0Cr747yjhlRnPQIjUtA=
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.0/go.mod h1:AkcBw7L/PhgCm1A4P4adGrbEjE7i2maeCn/Jeh5t5Lo=
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.1 h1:ov6LOLLANE9nZVQ1DrpMLuITkejMzTbZLE54xtxZ14A=
github.com/FrangipaneTeam/terraform-plugin-framework-superschema v1.8.1/go.mod h1:AkcBw7L/PhgCm1A4P4adGrbEjE7i2maeCn/Jeh5t5Lo=
github.com/FrangipaneTeam/terraform-plugin-framework-supertypes v0.4.0 h1:5lFfjKOhBxBQNwQ63PZWBc5Unqgi5ppYq9RDoN05N+k=
github.com/FrangipaneTeam/terraform-plugin-framework-supertypes v0.4.0/go.mod h1:klzXBi/0nMGXBh4bzRjP2wef+HE6rfCMia81Glc2+eY=
github.com/FrangipaneTeam/terraform-plugin-framework-validators v1.8.1 h1:C17IEM0/4sxsTN0IpwDdgncea/cxfZVlWESIWvlEuBo=
Expand Down
1 change: 1 addition & 0 deletions internal/provider/common/adminorg/vdc_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

// GetVDCGroupByNameOrID returns the VDC group using the name or ID provided in the argument.
// Deprecated: Use GetVdcGroupByName or GetVdcGroupById instead.
func (ao *AdminOrg) GetVDCGroupByNameOrID(nameOrID string) (*govcd.VdcGroup, error) {
if urn.IsVDCGroup(nameOrID) {
return ao.GetVdcGroupById(nameOrID)
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/provider_datasources.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/storage"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vapp"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vdc"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vdcg"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vm"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vrf"
)
Expand Down Expand Up @@ -51,6 +52,9 @@ func (p *cloudavenueProvider) DataSources(_ context.Context) []func() datasource
vdc.NewVDCDataSource,
vdc.NewGroupDataSource,

// * VDC GROUP
vdcg.NewVDCGDataSource,

// * VAPP
vapp.NewVappDataSource,
vapp.NewOrgNetworkDataSource,
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/provider_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vapp"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vcda"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vdc"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vdcg"
"github.com/orange-cloudavenue/terraform-provider-cloudavenue/internal/provider/vm"
)

Expand All @@ -41,6 +42,9 @@ func (p *cloudavenueProvider) Resources(_ context.Context) []func() resource.Res
vdc.NewACLResource,
vdc.NewGroupResource,

// * VDC Group
vdcg.NewVDCGResource,

// * VCDA
vcda.NewVCDAIPResource,

Expand Down
1 change: 0 additions & 1 deletion internal/provider/vdc/vdc_group_datasource.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package vdc provides a Terraform datasource.
package vdc

import (
Expand Down
1 change: 0 additions & 1 deletion internal/provider/vdc/vdc_group_resource.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package vdc provides a Terraform resource.
package vdc

import (
Expand Down
17 changes: 17 additions & 0 deletions internal/provider/vdc/vdc_group_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,26 @@ func groupSchema() superschema.Schema {
return superschema.Schema{
Resource: superschema.SchemaDetails{
MarkdownDescription: "The `cloudavenue_vdc_group` resource allows you to manage VDC Group.",
Deprecated: superschema.DeprecatedResource{
DeprecationMessage: "The `cloudavenue_vdc_group` resource is deprecated. Please use the `cloudavenue_vdcg` resource instead.",
ComputeMarkdownDeprecationMessage: true,
Renamed: true,
TargetResourceName: "cloudavenue_vdcg",
TargetRelease: "v0.30.0",
LinkToMigrationGuide: "https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/resources/vdc_group#how-to-migrate-existing-resources",
LinkToNewResourceDoc: "https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/resources/vdcg",
},
},
DataSource: superschema.SchemaDetails{
MarkdownDescription: "The `cloudavenue_vdc_group` data source allows you to retrieve informations about an existing VDC Group.",
Deprecated: superschema.DeprecatedResource{
DeprecationMessage: "The `cloudavenue_vdc_group` data source is deprecated. Please use the `cloudavenue_vdcg` data source instead.",
ComputeMarkdownDeprecationMessage: true,
Renamed: true,
TargetResourceName: "cloudavenue_vdcg",
TargetRelease: "v0.30.0",
LinkToNewResourceDoc: "https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue/latest/docs/data-sources/vdcg",
},
},
Attributes: map[string]superschema.Attribute{
"id": superschema.SuperStringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/vdc/vdc_group_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestGroupResourceSchema(t *testing.T) {
}
}

func TestVPNIPSecDataSourceSchema(t *testing.T) {
func TestGroupDataSourceSchema(t *testing.T) {
t.Parallel()

ctx := context.Background()
Expand Down
5 changes: 5 additions & 0 deletions internal/provider/vdcg/base.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package vdcg

const (
categoryName = "vdcg"
)
Loading
Loading