Skip to content

Commit f2254f8

Browse files
committed
Rename attribute dcid to dc_id
Signed-off-by: Ferran Rodenas <[email protected]>
1 parent a253512 commit f2254f8

14 files changed

+68
-21
lines changed

examples/cloud_account_vsphere/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ data "vra_region_enumeration_vsphere" "this" {
3030
username = var.username
3131
password = var.password
3232
hostname = var.hostname
33-
dcid = var.datacollector != "" ? data.vra_data_collector.dc[0].id : "" // Required for vRA Cloud, Optional for vRA 8.X
33+
dc_id = var.datacollector != "" ? data.vra_data_collector.dc[0].id : "" // Required for vRA Cloud, Optional for vRA 8.X
3434
accept_self_signed_cert = true
3535
}
3636

@@ -40,7 +40,7 @@ resource "vra_cloud_account_vsphere" "this" {
4040
username = var.username
4141
password = var.password
4242
hostname = var.hostname
43-
dcid = var.datacollector != "" ? data.vra_data_collector.dc[0].id : "" // Required for vRA Cloud, Optional for vRA 8.X
43+
dc_id = var.datacollector != "" ? data.vra_data_collector.dc[0].id : "" // Required for vRA Cloud, Optional for vRA 8.X
4444

4545
regions = data.vra_region_enumeration_vsphere.this.regions
4646
associated_cloud_account_ids = [vra_cloud_account_nsxt.this.id]

vra/data_source_cloud_account_vmc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func testAccDataSourceVRACloudAccountVMCBase(rInt int) string {
6060
username = "%s"
6161
password = "%s"
6262
hostname = "%s"
63-
dcid = data.vra_data_collector.dc.id
63+
dc_id = data.vra_data_collector.dc.id
6464
}
6565
6666
resource "vra_cloud_account_vmc" "this" {

vra/data_source_cloud_account_vsphere.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ func dataSourceCloudAccountVsphere() *schema.Resource {
4646
Type: schema.TypeString,
4747
Computed: true,
4848
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
49+
Deprecated: "Please use `dc_id` instead.",
50+
},
51+
"dc_id": {
52+
Type: schema.TypeString,
53+
Computed: true,
54+
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
4955
},
5056
"description": {
5157
Type: schema.TypeString,
@@ -136,6 +142,7 @@ func dataSourceCloudAccountVsphereRead(d *schema.ResourceData, meta interface{})
136142
d.Set("associated_cloud_account_ids", flattenAssociatedCloudAccountIds(cloudAccountVsphere.Links))
137143
d.Set("created_at", cloudAccountVsphere.CreatedAt)
138144
d.Set("dcid", cloudAccountVsphere.Dcid)
145+
d.Set("dc_id", cloudAccountVsphere.Dcid)
139146
d.Set("description", cloudAccountVsphere.Description)
140147
d.Set("hostname", cloudAccountVsphere.HostName)
141148
d.Set("name", cloudAccountVsphere.Name)

vra/data_source_cloud_account_vsphere_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestAccDataSourceVRACloudAccountVsphere(t *testing.T) {
3030
resource.TestCheckResourceAttrPair(resourceName1, "description", dataSourceName1, "description"),
3131
resource.TestCheckResourceAttrPair(resourceName1, "name", dataSourceName1, "name"),
3232
resource.TestCheckResourceAttrPair(resourceName1, "hostname", dataSourceName1, "hostname"),
33-
resource.TestCheckResourceAttrPair(resourceName1, "dcid", dataSourceName1, "dcid"),
33+
resource.TestCheckResourceAttrPair(resourceName1, "dc_id", dataSourceName1, "dc_id"),
3434
),
3535
},
3636
},
@@ -52,7 +52,7 @@ func testAccDataSourceVRACloudAccountVsphereBase(rInt int) string {
5252
username = "%s"
5353
password = "%s"
5454
hostname = "%s"
55-
dcid = data.vra_data_collector.dc.id
55+
dc_id = data.vra_data_collector.dc.id
5656
}
5757
5858
resource "vra_cloud_account_vsphere" "my_vsphere_account" {
@@ -61,7 +61,7 @@ func testAccDataSourceVRACloudAccountVsphereBase(rInt int) string {
6161
username = "%s"
6262
password = "%s"
6363
hostname = "%s"
64-
dcid = data.vra_data_collector.dc.id
64+
dc_id = data.vra_data_collector.dc.id
6565
6666
regions = data.vra_region_enumeration.dc_regions.regions
6767
accept_self_signed_cert = true

vra/data_source_region_enumeration.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ func dataSourceRegionEnumeration() *schema.Resource {
3131
Type: schema.TypeString,
3232
Optional: true,
3333
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
34+
Deprecated: "Please use `dc_id` instead.",
35+
},
36+
"dc_id": {
37+
Type: schema.TypeString,
38+
Optional: true,
39+
ConflictsWith: []string{"dcid"},
40+
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
3441
},
3542
"hostname": {
3643
Type: schema.TypeString,
@@ -63,13 +70,19 @@ func dataSourceRegionEnumeration() *schema.Resource {
6370
func dataSourceRegionEnumerationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
6471
apiClient := meta.(*Client).apiClient
6572

73+
dcid := ""
74+
if v, ok := d.GetOk("dc_id"); ok {
75+
dcid = v.(string)
76+
} else if v, ok := d.GetOk("dcid"); ok {
77+
dcid = v.(string)
78+
}
6679
enumResp, err := apiClient.CloudAccount.EnumerateVSphereRegionsAsync(
6780
cloud_account.NewEnumerateVSphereRegionsAsyncParams().
6881
WithAPIVersion(withString(IaaSAPIVersion)).
6982
WithTimeout(IncreasedTimeOut).
7083
WithBody(&models.CloudAccountVsphereRegionEnumerationSpecification{
7184
AcceptSelfSignedCertificate: d.Get("accept_self_signed_cert").(bool),
72-
Dcid: d.Get("dcid").(string),
85+
Dcid: dcid,
7386
HostName: d.Get("hostname").(string),
7487
Password: d.Get("password").(string),
7588
Username: d.Get("username").(string),

vra/data_source_region_enumeration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ func testAccCheckVRARegionEnumerationConfig(dcname string) string {
5555
username = "%s"
5656
password = "%s"
5757
hostname = "%s"
58-
dcid = data.vra_data_collector.dc.id
58+
dc_id = data.vra_data_collector.dc.id
5959
}`, dcname, username, password, hostname)
6060
}

vra/data_source_region_enumeration_vsphere.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ func dataSourceRegionEnumerationVsphere() *schema.Resource {
2727
Type: schema.TypeString,
2828
Optional: true,
2929
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
30+
Deprecated: "Please use `dc_id` instead.",
31+
},
32+
"dc_id": {
33+
Type: schema.TypeString,
34+
Optional: true,
35+
ConflictsWith: []string{"dcid"},
36+
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
3037
},
3138
"hostname": {
3239
Type: schema.TypeString,
@@ -59,13 +66,19 @@ func dataSourceRegionEnumerationVsphere() *schema.Resource {
5966
func dataSourceRegionEnumerationVsphereRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
6067
apiClient := meta.(*Client).apiClient
6168

69+
dcid := ""
70+
if v, ok := d.GetOk("dc_id"); ok {
71+
dcid = v.(string)
72+
} else if v, ok := d.GetOk("dcid"); ok {
73+
dcid = v.(string)
74+
}
6275
enumResp, err := apiClient.CloudAccount.EnumerateVSphereRegionsAsync(
6376
cloud_account.NewEnumerateVSphereRegionsAsyncParams().
6477
WithAPIVersion(withString(IaaSAPIVersion)).
6578
WithTimeout(IncreasedTimeOut).
6679
WithBody(&models.CloudAccountVsphereRegionEnumerationSpecification{
6780
AcceptSelfSignedCertificate: d.Get("accept_self_signed_cert").(bool),
68-
Dcid: d.Get("dcid").(string),
81+
Dcid: dcid,
6982
HostName: d.Get("hostname").(string),
7083
Password: d.Get("password").(string),
7184
Username: d.Get("username").(string),

vra/data_source_region_enumeration_vsphere_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ func testAccCheckVRARegionEnumerationVsphereConfig(dcname string) string {
5959
username = "%s"
6060
password = "%s"
6161
hostname = "%s"
62-
dcid = data.vra_data_collector.dc.id
62+
dc_id = data.vra_data_collector.dc.id
6363
}`, dcname, username, password, hostname)
6464
}

vra/resource_cloud_account_vmc_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func testAccCheckVRACloudAccountVMCConfig(rInt int) string {
137137
username = "%s"
138138
password = "%s"
139139
hostname = "%s"
140-
dcid = data.vra_data_collector.dc.id
140+
dc_id = data.vra_data_collector.dc.id
141141
}
142142
143143
resource "vra_cloud_account_vmc" "this" {
@@ -186,7 +186,7 @@ func testAccCheckVRACloudAccountVMCUpdateConfig(rInt int) string {
186186
username = "%s"
187187
password = "%s"
188188
hostname = "%s"
189-
dcid = data.vra_data_collector.dc.id
189+
dc_id = data.vra_data_collector.dc.id
190190
}
191191
192192
resource "vra_cloud_account_vmc" "this" {
@@ -235,7 +235,7 @@ func testAccCheckVRACloudAccountVMCConfigDuplicateRegion(rInt int) string {
235235
username = "%s"
236236
password = "%s"
237237
hostname = "%s"
238-
dcid = data.vra_data_collector.dc.id
238+
dc_id = data.vra_data_collector.dc.id
239239
}
240240
241241
resource "vra_cloud_account_vmc" "this" {

vra/resource_cloud_account_vsphere.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ func resourceCloudAccountVsphere() *schema.Resource {
7878
Type: schema.TypeString,
7979
Optional: true,
8080
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
81+
Deprecated: "Please use `dc_id` instead.",
82+
},
83+
"dc_id": {
84+
Type: schema.TypeString,
85+
Optional: true,
86+
ConflictsWith: []string{"dcid"},
87+
Description: "Identifier of a data collector vm deployed in the on premise infrastructure.",
8188
},
8289
"description": {
8390
Type: schema.TypeString,
@@ -132,6 +139,12 @@ func resourceCloudAccountVsphereCreate(ctx context.Context, d *schema.ResourceDa
132139
regions = expandRegionSpecificationList(v.(*schema.Set).List())
133140
}
134141

142+
dcid := ""
143+
if v, ok := d.GetOk("dc_id"); ok {
144+
dcid = v.(string)
145+
} else if v, ok := d.GetOk("dcid"); ok {
146+
dcid = v.(string)
147+
}
135148
createResp, err := apiClient.CloudAccount.CreateVSphereCloudAccountAsync(
136149
cloud_account.NewCreateVSphereCloudAccountAsyncParams().
137150
WithAPIVersion(withString(IaaSAPIVersion)).
@@ -140,7 +153,7 @@ func resourceCloudAccountVsphereCreate(ctx context.Context, d *schema.ResourceDa
140153
AcceptSelfSignedCertificate: d.Get("accept_self_signed_cert").(bool),
141154
AssociatedCloudAccountIds: associatedCloudAccountIds,
142155
CreateDefaultZones: false,
143-
Dcid: d.Get("dcid").(string),
156+
Dcid: dcid,
144157
Description: d.Get("description").(string),
145158
HostName: withString(d.Get("hostname").(string)),
146159
Name: withString(d.Get("name").(string)),
@@ -191,6 +204,7 @@ func resourceCloudAccountVsphereRead(ctx context.Context, d *schema.ResourceData
191204
d.Set("associated_cloud_account_ids", flattenAssociatedCloudAccountIds(vsphereAccount.Links))
192205
d.Set("created_at", vsphereAccount.CreatedAt)
193206
d.Set("dcid", vsphereAccount.Dcid)
207+
d.Set("dc_id", vsphereAccount.Dcid)
194208
d.Set("description", vsphereAccount.Description)
195209
d.Set("hostname", vsphereAccount.HostName)
196210
d.Set("name", vsphereAccount.Name)

vra/resource_cloud_account_vsphere_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func testAccCheckVRACloudAccountvSphereConfig(rInt int) string {
8484
username = "%s"
8585
password = "%s"
8686
hostname = "%s"
87-
dcid = data.vra_data_collector.dc.id
87+
dc_id = data.vra_data_collector.dc.id
8888
}
8989
9090
resource "vra_cloud_account_vsphere" "my_vsphere_account" {
@@ -93,7 +93,7 @@ func testAccCheckVRACloudAccountvSphereConfig(rInt int) string {
9393
username = "%s"
9494
password = "%s"
9595
hostname = "%s"
96-
dcid = data.vra_data_collector.dc.id
96+
dc_id = data.vra_data_collector.dc.id
9797
9898
regions = data.vra_region_enumeration.dc_regions.regions
9999
accept_self_signed_cert = true

website/docs/d/vra_region_enumeration.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ DeprecationMessage: 'region_enumeration' is deprecated. Use 'region_enumeration_
1717
data "vra_region_enumeration_vsphere" "this" {
1818
accept_self_signed_cert = false
1919
20-
dcid = var.vra_data_collector_id
20+
dc_id = var.vra_data_collector_id
2121
2222
hostname = var.hostname
2323
password = var.password
@@ -30,7 +30,7 @@ The region enumeration data source supports the following arguments:
3030
## Argument Reference
3131
* `accept_self_signed_cert` - (Optional) Accept self signed certificate when connecting to vSphere. Example: false
3232

33-
* `dcid` - (Optional) ID of a data collector vm deployed in the on premise infrastructure. Example: d5316b00-f3b8-4895-9e9a-c4b98649c2ca
33+
* `dc_id` - (Optional) ID of a data collector vm deployed in the on premise infrastructure. Example: d5316b00-f3b8-4895-9e9a-c4b98649c2ca
3434

3535
* `hostname` - (Required) Host name for the cloud account endpoint. Example: dc1-lnd.mycompany.com
3636

website/docs/d/vra_region_enumeration_vsphere.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This is an example of how to lookup a region enumeration data source for vSphere
1515
data "vra_region_enumeration_vsphere" "this" {
1616
accept_self_signed_cert = false
1717
18-
dcid = var.vra_data_collector_id
18+
dc_id = var.vra_data_collector_id
1919
2020
hostname = this.hostname
2121
password = this.password
@@ -28,7 +28,7 @@ The region enumeration data source for vSphere cloud account supports the follow
2828
## Argument Reference
2929
* `accept_self_signed_cert` - (Optional) Accept self signed certificate when connecting to vSphere. Example: false
3030

31-
* `dcid` - (Required) ID of a data collector vm deployed in the on premise infrastructure. Example: d5316b00-f3b8-4895-9e9a-c4b98649c2ca
31+
* `dc_id` - (Required) ID of a data collector vm deployed in the on premise infrastructure. Example: d5316b00-f3b8-4895-9e9a-c4b98649c2ca
3232

3333
* `hostname` - (Required) Host name for the cloud account endpoint. Example: dc1-lnd.mycompany.com
3434

website/docs/r/vra_cloud_account_vsphere.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resource "vra_cloud_account_vsphere" "this" {
2020
username = var.username
2121
password = var.password
2222
hostname = var.hostname
23-
dcid = var.vra_data_collector_id // Required for vRA Cloud, Optional for vRA 8.X
23+
dc_id = var.vra_data_collector_id // Required for vRA Cloud, Optional for vRA 8.X
2424
regions = var.regions
2525
associated_cloud_account_ids = [var.vra_cloud_account_nsxt_id]
2626

0 commit comments

Comments
 (0)