Skip to content

Commit 5445990

Browse files
authored
[WIP] provider/azurerm: Bump sdk version to 7.0.1 (hashicorp#10458)
* provider/azurerm: Bump sdk version to 7.0.1 * Fixing the build (hashicorp#10489) * Fixing the broken tests (hashicorp#10499) * Updating the method signatures to match (hashicorp#10533)
1 parent dccdace commit 5445990

131 files changed

Lines changed: 4031 additions & 3028 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

builtin/providers/azurerm/loadbalancer.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ func retrieveLoadBalancerById(loadBalancerId string, meta interface{}) (*network
4141
}
4242

4343
func findLoadBalancerBackEndAddressPoolByName(lb *network.LoadBalancer, name string) (*network.BackendAddressPool, int, bool) {
44-
if lb == nil || lb.Properties == nil || lb.Properties.BackendAddressPools == nil {
44+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.BackendAddressPools == nil {
4545
return nil, -1, false
4646
}
4747

48-
for i, apc := range *lb.Properties.BackendAddressPools {
48+
for i, apc := range *lb.LoadBalancerPropertiesFormat.BackendAddressPools {
4949
if apc.Name != nil && *apc.Name == name {
5050
return &apc, i, true
5151
}
@@ -55,11 +55,11 @@ func findLoadBalancerBackEndAddressPoolByName(lb *network.LoadBalancer, name str
5555
}
5656

5757
func findLoadBalancerFrontEndIpConfigurationByName(lb *network.LoadBalancer, name string) (*network.FrontendIPConfiguration, int, bool) {
58-
if lb == nil || lb.Properties == nil || lb.Properties.FrontendIPConfigurations == nil {
58+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.FrontendIPConfigurations == nil {
5959
return nil, -1, false
6060
}
6161

62-
for i, feip := range *lb.Properties.FrontendIPConfigurations {
62+
for i, feip := range *lb.LoadBalancerPropertiesFormat.FrontendIPConfigurations {
6363
if feip.Name != nil && *feip.Name == name {
6464
return &feip, i, true
6565
}
@@ -69,11 +69,11 @@ func findLoadBalancerFrontEndIpConfigurationByName(lb *network.LoadBalancer, nam
6969
}
7070

7171
func findLoadBalancerRuleByName(lb *network.LoadBalancer, name string) (*network.LoadBalancingRule, int, bool) {
72-
if lb == nil || lb.Properties == nil || lb.Properties.LoadBalancingRules == nil {
72+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.LoadBalancingRules == nil {
7373
return nil, -1, false
7474
}
7575

76-
for i, lbr := range *lb.Properties.LoadBalancingRules {
76+
for i, lbr := range *lb.LoadBalancerPropertiesFormat.LoadBalancingRules {
7777
if lbr.Name != nil && *lbr.Name == name {
7878
return &lbr, i, true
7979
}
@@ -83,11 +83,11 @@ func findLoadBalancerRuleByName(lb *network.LoadBalancer, name string) (*network
8383
}
8484

8585
func findLoadBalancerNatRuleByName(lb *network.LoadBalancer, name string) (*network.InboundNatRule, int, bool) {
86-
if lb == nil || lb.Properties == nil || lb.Properties.InboundNatRules == nil {
86+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.InboundNatRules == nil {
8787
return nil, -1, false
8888
}
8989

90-
for i, nr := range *lb.Properties.InboundNatRules {
90+
for i, nr := range *lb.LoadBalancerPropertiesFormat.InboundNatRules {
9191
if nr.Name != nil && *nr.Name == name {
9292
return &nr, i, true
9393
}
@@ -97,11 +97,11 @@ func findLoadBalancerNatRuleByName(lb *network.LoadBalancer, name string) (*netw
9797
}
9898

9999
func findLoadBalancerNatPoolByName(lb *network.LoadBalancer, name string) (*network.InboundNatPool, int, bool) {
100-
if lb == nil || lb.Properties == nil || lb.Properties.InboundNatPools == nil {
100+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.InboundNatPools == nil {
101101
return nil, -1, false
102102
}
103103

104-
for i, np := range *lb.Properties.InboundNatPools {
104+
for i, np := range *lb.LoadBalancerPropertiesFormat.InboundNatPools {
105105
if np.Name != nil && *np.Name == name {
106106
return &np, i, true
107107
}
@@ -111,11 +111,11 @@ func findLoadBalancerNatPoolByName(lb *network.LoadBalancer, name string) (*netw
111111
}
112112

113113
func findLoadBalancerProbeByName(lb *network.LoadBalancer, name string) (*network.Probe, int, bool) {
114-
if lb == nil || lb.Properties == nil || lb.Properties.Probes == nil {
114+
if lb == nil || lb.LoadBalancerPropertiesFormat == nil || lb.LoadBalancerPropertiesFormat.Probes == nil {
115115
return nil, -1, false
116116
}
117117

118-
for i, p := range *lb.Properties.Probes {
118+
for i, p := range *lb.LoadBalancerPropertiesFormat.Probes {
119119
if p.Name != nil && *p.Name == name {
120120
return &p, i, true
121121
}
@@ -131,7 +131,7 @@ func loadbalancerStateRefreshFunc(client *ArmClient, resourceGroupName string, l
131131
return nil, "", fmt.Errorf("Error issuing read request in loadbalancerStateRefreshFunc to Azure ARM for LoadBalancer '%s' (RG: '%s'): %s", loadbalancer, resourceGroupName, err)
132132
}
133133

134-
return res, *res.Properties.ProvisioningState, nil
134+
return res, *res.LoadBalancerPropertiesFormat.ProvisioningState, nil
135135
}
136136
}
137137

builtin/providers/azurerm/resource_arm_availability_set.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func resourceArmAvailabilitySetCreate(d *schema.ResourceData, meta interface{})
8686
availSet := compute.AvailabilitySet{
8787
Name: &name,
8888
Location: &location,
89-
Properties: &compute.AvailabilitySetProperties{
89+
AvailabilitySetProperties: &compute.AvailabilitySetProperties{
9090
PlatformFaultDomainCount: azure.Int32(int32(faultDomainCount)),
9191
PlatformUpdateDomainCount: azure.Int32(int32(updateDomainCount)),
9292
},
@@ -122,7 +122,7 @@ func resourceArmAvailabilitySetRead(d *schema.ResourceData, meta interface{}) er
122122
return fmt.Errorf("Error making Read request on Azure Availability Set %s: %s", name, err)
123123
}
124124

125-
availSet := *resp.Properties
125+
availSet := *resp.AvailabilitySetProperties
126126
d.Set("resource_group_name", resGroup)
127127
d.Set("platform_update_domain_count", availSet.PlatformUpdateDomainCount)
128128
d.Set("platform_fault_domain_count", availSet.PlatformFaultDomainCount)

builtin/providers/azurerm/resource_arm_availability_set_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func testCheckAzureRMAvailabilitySetDestroy(s *terraform.State) error {
194194
}
195195

196196
if resp.StatusCode != http.StatusNotFound {
197-
return fmt.Errorf("Availability Set still exists:\n%#v", resp.Properties)
197+
return fmt.Errorf("Availability Set still exists:\n%#v", resp.AvailabilitySetProperties)
198198
}
199199
}
200200

builtin/providers/azurerm/resource_arm_cdn_endpoint.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func resourceArmCdnEndpointCreate(d *schema.ResourceData, meta interface{}) erro
148148
caching_behaviour := d.Get("querystring_caching_behaviour").(string)
149149
tags := d.Get("tags").(map[string]interface{})
150150

151-
properties := cdn.EndpointPropertiesCreateParameters{
151+
properties := cdn.EndpointProperties{
152152
IsHTTPAllowed: &http_allowed,
153153
IsHTTPSAllowed: &https_allowed,
154154
IsCompressionEnabled: &compression_enabled,
@@ -184,18 +184,18 @@ func resourceArmCdnEndpointCreate(d *schema.ResourceData, meta interface{}) erro
184184
properties.ContentTypesToCompress = &content_types
185185
}
186186

187-
cdnEndpoint := cdn.EndpointCreateParameters{
188-
Location: &location,
189-
Properties: &properties,
190-
Tags: expandTags(tags),
187+
cdnEndpoint := cdn.Endpoint{
188+
Location: &location,
189+
EndpointProperties: &properties,
190+
Tags: expandTags(tags),
191191
}
192192

193-
_, err := cdnEndpointsClient.Create(name, cdnEndpoint, profileName, resGroup, make(chan struct{}))
193+
_, err := cdnEndpointsClient.Create(resGroup, profileName, name, cdnEndpoint, make(chan struct{}))
194194
if err != nil {
195195
return err
196196
}
197197

198-
read, err := cdnEndpointsClient.Get(name, profileName, resGroup)
198+
read, err := cdnEndpointsClient.Get(resGroup, profileName, name)
199199
if err != nil {
200200
return err
201201
}
@@ -222,7 +222,7 @@ func resourceArmCdnEndpointRead(d *schema.ResourceData, meta interface{}) error
222222
profileName = id.Path["Profiles"]
223223
}
224224
log.Printf("[INFO] Trying to find the AzureRM CDN Endpoint %s (Profile: %s, RG: %s)", name, profileName, resGroup)
225-
resp, err := cdnEndpointsClient.Get(name, profileName, resGroup)
225+
resp, err := cdnEndpointsClient.Get(resGroup, profileName, name)
226226
if err != nil {
227227
if resp.StatusCode == http.StatusNotFound {
228228
d.SetId("")
@@ -235,21 +235,21 @@ func resourceArmCdnEndpointRead(d *schema.ResourceData, meta interface{}) error
235235
d.Set("resource_group_name", resGroup)
236236
d.Set("location", azureRMNormalizeLocation(*resp.Location))
237237
d.Set("profile_name", profileName)
238-
d.Set("host_name", resp.Properties.HostName)
239-
d.Set("is_compression_enabled", resp.Properties.IsCompressionEnabled)
240-
d.Set("is_http_allowed", resp.Properties.IsHTTPAllowed)
241-
d.Set("is_https_allowed", resp.Properties.IsHTTPSAllowed)
242-
d.Set("querystring_caching_behaviour", resp.Properties.QueryStringCachingBehavior)
243-
if resp.Properties.OriginHostHeader != nil && *resp.Properties.OriginHostHeader != "" {
244-
d.Set("origin_host_header", resp.Properties.OriginHostHeader)
238+
d.Set("host_name", resp.EndpointProperties.HostName)
239+
d.Set("is_compression_enabled", resp.EndpointProperties.IsCompressionEnabled)
240+
d.Set("is_http_allowed", resp.EndpointProperties.IsHTTPAllowed)
241+
d.Set("is_https_allowed", resp.EndpointProperties.IsHTTPSAllowed)
242+
d.Set("querystring_caching_behaviour", resp.EndpointProperties.QueryStringCachingBehavior)
243+
if resp.EndpointProperties.OriginHostHeader != nil && *resp.EndpointProperties.OriginHostHeader != "" {
244+
d.Set("origin_host_header", resp.EndpointProperties.OriginHostHeader)
245245
}
246-
if resp.Properties.OriginPath != nil && *resp.Properties.OriginPath != "" {
247-
d.Set("origin_path", resp.Properties.OriginPath)
246+
if resp.EndpointProperties.OriginPath != nil && *resp.EndpointProperties.OriginPath != "" {
247+
d.Set("origin_path", resp.EndpointProperties.OriginPath)
248248
}
249-
if resp.Properties.ContentTypesToCompress != nil {
250-
d.Set("content_types_to_compress", flattenAzureRMCdnEndpointContentTypes(resp.Properties.ContentTypesToCompress))
249+
if resp.EndpointProperties.ContentTypesToCompress != nil {
250+
d.Set("content_types_to_compress", flattenAzureRMCdnEndpointContentTypes(resp.EndpointProperties.ContentTypesToCompress))
251251
}
252-
d.Set("origin", flattenAzureRMCdnEndpointOrigin(resp.Properties.Origins))
252+
d.Set("origin", flattenAzureRMCdnEndpointOrigin(resp.EndpointProperties.Origins))
253253

254254
flattenAndSetTags(d, resp.Tags)
255255

@@ -301,11 +301,11 @@ func resourceArmCdnEndpointUpdate(d *schema.ResourceData, meta interface{}) erro
301301
}
302302

303303
updateProps := cdn.EndpointUpdateParameters{
304-
Tags: expandTags(newTags),
305-
Properties: &properties,
304+
Tags: expandTags(newTags),
305+
EndpointPropertiesUpdateParameters: &properties,
306306
}
307307

308-
_, err := cdnEndpointsClient.Update(name, updateProps, profileName, resGroup, make(chan struct{}))
308+
_, err := cdnEndpointsClient.Update(resGroup, profileName, name, updateProps, make(chan struct{}))
309309
if err != nil {
310310
return fmt.Errorf("Error issuing Azure ARM update request to update CDN Endpoint %q: %s", name, err)
311311
}
@@ -327,7 +327,7 @@ func resourceArmCdnEndpointDelete(d *schema.ResourceData, meta interface{}) erro
327327
}
328328
name := id.Path["endpoints"]
329329

330-
accResp, err := client.DeleteIfExists(name, profileName, resGroup, make(chan struct{}))
330+
accResp, err := client.Delete(resGroup, profileName, name, make(chan struct{}))
331331
if err != nil {
332332
if accResp.StatusCode == http.StatusNotFound {
333333
return nil
@@ -388,8 +388,8 @@ func expandAzureRmCdnEndpointOrigins(d *schema.ResourceData) ([]cdn.DeepCreatedO
388388
name := data["name"].(string)
389389

390390
origin := cdn.DeepCreatedOrigin{
391-
Name: &name,
392-
Properties: &properties,
391+
Name: &name,
392+
DeepCreatedOriginProperties: &properties,
393393
}
394394

395395
origins = append(origins, origin)
@@ -403,14 +403,14 @@ func flattenAzureRMCdnEndpointOrigin(list *[]cdn.DeepCreatedOrigin) []map[string
403403
for _, i := range *list {
404404
l := map[string]interface{}{
405405
"name": *i.Name,
406-
"host_name": *i.Properties.HostName,
406+
"host_name": *i.DeepCreatedOriginProperties.HostName,
407407
}
408408

409-
if i.Properties.HTTPPort != nil {
410-
l["http_port"] = *i.Properties.HTTPPort
409+
if i.DeepCreatedOriginProperties.HTTPPort != nil {
410+
l["http_port"] = *i.DeepCreatedOriginProperties.HTTPPort
411411
}
412-
if i.Properties.HTTPSPort != nil {
413-
l["https_port"] = *i.Properties.HTTPSPort
412+
if i.DeepCreatedOriginProperties.HTTPSPort != nil {
413+
l["https_port"] = *i.DeepCreatedOriginProperties.HTTPSPort
414414
}
415415
result = append(result, l)
416416
}

builtin/providers/azurerm/resource_arm_cdn_endpoint_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func testCheckAzureRMCdnEndpointExists(name string) resource.TestCheckFunc {
104104

105105
conn := testAccProvider.Meta().(*ArmClient).cdnEndpointsClient
106106

107-
resp, err := conn.Get(name, profileName, resourceGroup)
107+
resp, err := conn.Get(resourceGroup, profileName, name)
108108
if err != nil {
109109
return fmt.Errorf("Bad: Get on cdnEndpointsClient: %s", err)
110110
}
@@ -134,7 +134,7 @@ func testCheckAzureRMCdnEndpointDisappears(name string) resource.TestCheckFunc {
134134

135135
conn := testAccProvider.Meta().(*ArmClient).cdnEndpointsClient
136136

137-
_, err := conn.DeleteIfExists(name, profileName, resourceGroup, make(chan struct{}))
137+
_, err := conn.Delete(resourceGroup, profileName, name, make(chan struct{}))
138138
if err != nil {
139139
return fmt.Errorf("Bad: Delete on cdnEndpointsClient: %s", err)
140140
}
@@ -155,14 +155,14 @@ func testCheckAzureRMCdnEndpointDestroy(s *terraform.State) error {
155155
resourceGroup := rs.Primary.Attributes["resource_group_name"]
156156
profileName := rs.Primary.Attributes["profile_name"]
157157

158-
resp, err := conn.Get(name, profileName, resourceGroup)
158+
resp, err := conn.Get(resourceGroup, profileName, name)
159159

160160
if err != nil {
161161
return nil
162162
}
163163

164164
if resp.StatusCode != http.StatusNotFound {
165-
return fmt.Errorf("CDN Endpoint still exists:\n%#v", resp.Properties)
165+
return fmt.Errorf("CDN Endpoint still exists:\n%#v", resp.EndpointProperties)
166166
}
167167
}
168168

builtin/providers/azurerm/resource_arm_cdn_profile.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,20 @@ func resourceArmCdnProfileCreate(d *schema.ResourceData, meta interface{}) error
6060
sku := d.Get("sku").(string)
6161
tags := d.Get("tags").(map[string]interface{})
6262

63-
cdnProfile := cdn.ProfileCreateParameters{
63+
cdnProfile := cdn.Profile{
6464
Location: &location,
6565
Tags: expandTags(tags),
6666
Sku: &cdn.Sku{
6767
Name: cdn.SkuName(sku),
6868
},
6969
}
7070

71-
_, err := cdnProfilesClient.Create(name, cdnProfile, resGroup, make(chan struct{}))
71+
_, err := cdnProfilesClient.Create(resGroup, name, cdnProfile, make(chan struct{}))
7272
if err != nil {
7373
return err
7474
}
7575

76-
read, err := cdnProfilesClient.Get(name, resGroup)
76+
read, err := cdnProfilesClient.Get(resGroup, name)
7777
if err != nil {
7878
return err
7979
}
@@ -96,7 +96,7 @@ func resourceArmCdnProfileRead(d *schema.ResourceData, meta interface{}) error {
9696
resGroup := id.ResourceGroup
9797
name := id.Path["profiles"]
9898

99-
resp, err := cdnProfilesClient.Get(name, resGroup)
99+
resp, err := cdnProfilesClient.Get(resGroup, name)
100100
if err != nil {
101101
if resp.StatusCode == http.StatusNotFound {
102102
d.SetId("")
@@ -133,7 +133,7 @@ func resourceArmCdnProfileUpdate(d *schema.ResourceData, meta interface{}) error
133133
Tags: expandTags(newTags),
134134
}
135135

136-
_, err := cdnProfilesClient.Update(name, props, resGroup, make(chan struct{}))
136+
_, err := cdnProfilesClient.Update(resGroup, name, props, make(chan struct{}))
137137
if err != nil {
138138
return fmt.Errorf("Error issuing Azure ARM update request to update CDN Profile %q: %s", name, err)
139139
}
@@ -151,7 +151,8 @@ func resourceArmCdnProfileDelete(d *schema.ResourceData, meta interface{}) error
151151
resGroup := id.ResourceGroup
152152
name := id.Path["profiles"]
153153

154-
_, err = cdnProfilesClient.DeleteIfExists(name, resGroup, make(chan struct{}))
154+
_, err = cdnProfilesClient.Delete(resGroup, name, make(chan struct{}))
155+
// TODO: check the status code
155156

156157
return err
157158
}

builtin/providers/azurerm/resource_arm_cdn_profile_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func testCheckAzureRMCdnProfileExists(name string) resource.TestCheckFunc {
124124

125125
conn := testAccProvider.Meta().(*ArmClient).cdnProfilesClient
126126

127-
resp, err := conn.Get(name, resourceGroup)
127+
resp, err := conn.Get(resourceGroup, name)
128128
if err != nil {
129129
return fmt.Errorf("Bad: Get on cdnProfilesClient: %s", err)
130130
}
@@ -148,14 +148,14 @@ func testCheckAzureRMCdnProfileDestroy(s *terraform.State) error {
148148
name := rs.Primary.Attributes["name"]
149149
resourceGroup := rs.Primary.Attributes["resource_group_name"]
150150

151-
resp, err := conn.Get(name, resourceGroup)
151+
resp, err := conn.Get(resourceGroup, name)
152152

153153
if err != nil {
154154
return nil
155155
}
156156

157157
if resp.StatusCode != http.StatusNotFound {
158-
return fmt.Errorf("CDN Profile still exists:\n%#v", resp.Properties)
158+
return fmt.Errorf("CDN Profile still exists:\n%#v", resp.ProfileProperties)
159159
}
160160
}
161161

builtin/providers/azurerm/resource_arm_eventhub_namespace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func testCheckAzureRMEventHubNamespaceDestroy(s *terraform.State) error {
164164
}
165165

166166
if resp.StatusCode != http.StatusNotFound {
167-
return fmt.Errorf("EventHub Namespace still exists:\n%#v", resp.Properties)
167+
return fmt.Errorf("EventHub Namespace still exists:\n%#v", resp.NamespaceProperties)
168168
}
169169
}
170170

0 commit comments

Comments
 (0)