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

[WIP] Upgrading to v14.5 of the Azure/azure-sdk-for-go / v10.2 of Azure/go-autorest #1006

Closed
wants to merge 11 commits into from
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry"
"github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2017-09-30/containerservice"
"github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2015-04-08/documentdb"
"github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2016-04-01/dns"
"github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2017-09-15-preview/eventgrid"
"github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub"
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
Expand All @@ -32,6 +31,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2015-11-01-preview/operationalinsights"
"github.com/Azure/azure-sdk-for-go/services/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement"
"github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-04-30-preview/postgresql"
"github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns"
"github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2016-04-01/redis"
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions"
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks"
Expand Down Expand Up @@ -453,7 +453,7 @@ func (c *ArmClient) registerCDNClients(endpoint, subscriptionId string, auth aut
}

func (c *ArmClient) registerCosmosDBClients(endpoint, subscriptionId string, auth autorest.Authorizer, sender autorest.Sender) {
cdb := documentdb.NewDatabaseAccountsClientWithBaseURI(endpoint, subscriptionId, "", "", "", "", "")
cdb := documentdb.NewDatabaseAccountsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&cdb.Client, auth)
c.cosmosDBClient = cdb
}
Expand Down Expand Up @@ -883,7 +883,8 @@ func (armClient *ArmClient) getKeyForStorageAccount(resourceGroupName, storageAc
defer storageKeyCacheMu.Unlock()
key, ok = storageKeyCache[cacheIndex]
if !ok {
accountKeys, err := armClient.storageServiceClient.ListKeys(resourceGroupName, storageAccountName)
ctx := armClient.StopContext
accountKeys, err := armClient.storageServiceClient.ListKeys(ctx, resourceGroupName, storageAccountName)
if utils.ResponseWasNotFound(accountKeys.Response) {
return "", false, nil
}
Expand Down
4 changes: 3 additions & 1 deletion azurerm/data_source_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ func dataSourceAppServicePlanRead(d *schema.ResourceData, meta interface{}) erro
d.Set("sku", flattenAppServicePlanSku(sku))
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
5 changes: 4 additions & 1 deletion azurerm/data_source_application_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func dataSourceArmApplicationSecurityGroupRead(d *schema.ResourceData, meta inte
d.Set("name", resp.Name)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("resource_group_name", resourceGroup)
flattenAndSetTags(d, resp.Tags)

if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_cdn_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func dataSourceArmCdnProfileRead(d *schema.ResourceData, meta interface{}) error
d.Set("sku", string(sku.Name))
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func dataSourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
}
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_eventhub_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ func dataSourceEventHubNamespaceRead(d *schema.ResourceData, meta interface{}) e
d.Set("maximum_throughput_units", int(*props.MaximumThroughputUnits))
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ func dataSourceArmImageRead(d *schema.ResourceData, meta interface{}) error {
}
}

flattenAndSetTags(d, img.Tags)
if err := flattenAndSetTags(d, &img.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_managed_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ func dataSourceArmManagedDiskRead(d *schema.ResourceData, meta interface{}) erro

d.Set("zones", resp.Zones)

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_network_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ func dataSourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{})
d.Set("enable_ip_forwarding", resp.EnableIPForwarding)
d.Set("enable_accelerated_networking", resp.EnableAcceleratedNetworking)

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_network_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func dataSourceArmNetworkSecurityGroupRead(d *schema.ResourceData, meta interfac
}
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
5 changes: 4 additions & 1 deletion azurerm/data_source_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func dataSourceArmPublicIPRead(d *schema.ResourceData, meta interface{}) error {
d.Set("idle_timeout_in_minutes", *resp.PublicIPAddressPropertiesFormat.IdleTimeoutInMinutes)
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
9 changes: 6 additions & 3 deletions azurerm/data_source_storage_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ func dataSourceArmStorageAccount() *schema.Resource {

func dataSourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).storageServiceClient
ctx := meta.(*ArmClient).StopContext
endpointSuffix := meta.(*ArmClient).environment.StorageEndpointSuffix

name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.GetProperties(resourceGroup, name)
resp, err := client.GetProperties(ctx, resourceGroup, name)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
Expand All @@ -176,7 +177,7 @@ func dataSourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) e

d.SetId(*resp.ID)

keys, err := client.ListKeys(resourceGroup, name)
keys, err := client.ListKeys(ctx, resourceGroup, name)
if err != nil {
return err
}
Expand Down Expand Up @@ -268,7 +269,9 @@ func dataSourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) e
d.Set("primary_access_key", accessKeys[0].Value)
d.Set("secondary_access_key", accessKeys[1].Value)

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
4 changes: 3 additions & 1 deletion azurerm/data_source_virtual_network_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ func dataSourceArmVirtualNetworkGatewayRead(d *schema.ResourceData, meta interfa
}
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
20 changes: 11 additions & 9 deletions azurerm/resource_arm_app_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error {
return err
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down Expand Up @@ -594,18 +596,18 @@ func flattenAppServiceSiteConfig(input *web.SiteConfig) []interface{} {
return results
}

func expandAppServiceAppSettings(d *schema.ResourceData) *map[string]*string {
func expandAppServiceAppSettings(d *schema.ResourceData) map[string]*string {
input := d.Get("app_settings").(map[string]interface{})
output := make(map[string]*string, len(input))

for k, v := range input {
output[k] = utils.String(v.(string))
}

return &output
return output
}

func expandAppServiceConnectionStrings(d *schema.ResourceData) *map[string]*web.ConnStringValueTypePair {
func expandAppServiceConnectionStrings(d *schema.ResourceData) map[string]*web.ConnStringValueTypePair {
input := d.Get("connection_string").([]interface{})
output := make(map[string]*web.ConnStringValueTypePair, len(input))

Expand All @@ -622,13 +624,13 @@ func expandAppServiceConnectionStrings(d *schema.ResourceData) *map[string]*web.
}
}

return &output
return output
}

func flattenAppServiceConnectionStrings(input *map[string]*web.ConnStringValueTypePair) interface{} {
func flattenAppServiceConnectionStrings(input map[string]*web.ConnStringValueTypePair) interface{} {
results := make([]interface{}, 0)

for k, v := range *input {
for k, v := range input {
result := make(map[string]interface{}, 0)
result["name"] = k
result["type"] = string(v.Type)
Expand All @@ -639,9 +641,9 @@ func flattenAppServiceConnectionStrings(input *map[string]*web.ConnStringValueTy
return results
}

func flattenAppServiceAppSettings(input *map[string]*string) map[string]string {
func flattenAppServiceAppSettings(input map[string]*string) map[string]string {
output := make(map[string]string, 0)
for k, v := range *input {
for k, v := range input {
output[k] = *v
}

Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ func resourceArmAppServicePlanRead(d *schema.ResourceData, meta interface{}) err
d.Set("sku", flattenAppServicePlanSku(sku))
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_app_service_slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ func resourceArmAppServiceSlotRead(d *schema.ResourceData, meta interface{}) err
return err
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_application_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,9 @@ func resourceArmApplicationGatewayRead(d *schema.ResourceData, meta interface{})
flattenApplicationGatewayWafConfig(applicationGateway.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration)))
}

flattenAndSetTags(d, applicationGateway.Tags)
if err := flattenAndSetTags(d, &applicationGateway.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
14 changes: 7 additions & 7 deletions azurerm/resource_arm_application_insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,14 @@ func resourceArmApplicationInsightsCreateOrUpdate(d *schema.ResourceData, meta i
location := d.Get("location").(string)
tags := d.Get("tags").(map[string]interface{})

applicationInsightsComponentProperties := insights.ApplicationInsightsComponentProperties{
ApplicationID: &name,
ApplicationType: insights.ApplicationType(applicationType),
}

insightProperties := insights.ApplicationInsightsComponent{
Name: &name,
Location: &location,
Kind: &applicationType,
ApplicationInsightsComponentProperties: &applicationInsightsComponentProperties,
ApplicationInsightsComponentProperties: &insights.ApplicationInsightsComponentProperties{
ApplicationID: &name,
ApplicationType: insights.ApplicationType(applicationType),
},
Tags: expandTags(tags),
}

Expand Down Expand Up @@ -134,7 +132,9 @@ func resourceArmApplicationInsightsRead(d *schema.ResourceData, meta interface{}
d.Set("instrumentation_key", props.InstrumentationKey)
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
5 changes: 4 additions & 1 deletion azurerm/resource_arm_application_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func resourceArmApplicationSecurityGroupRead(d *schema.ResourceData, meta interf
d.Set("name", resp.Name)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("resource_group_name", resourceGroup)
flattenAndSetTags(d, resp.Tags)

if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_automation_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ func resourceArmAutomationAccountRead(d *schema.ResourceData, meta interface{})
d.Set("resource_group_name", resGroup)
flattenAndSetSku(d, resp.Sku)

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
3 changes: 3 additions & 0 deletions azurerm/resource_arm_automation_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func resourceArmAutomationCredential() *schema.Resource {
Required: true,
ForceNew: true,
},

"resource_group_name": resourceGroupNameSchema(),

"account_name": {
Type: schema.TypeString,
Required: true,
Expand All @@ -42,6 +44,7 @@ func resourceArmAutomationCredential() *schema.Resource {
Required: true,
Sensitive: true,
},

"description": {
Type: schema.TypeString,
Optional: true,
Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_automation_runbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func resourceArmAutomationRunbookRead(d *schema.ResourceData, meta interface{})
d.Set("description", props.Description)
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_availability_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ func resourceArmAvailabilitySetRead(d *schema.ResourceData, meta interface{}) er
d.Set("managed", strings.EqualFold(*resp.Sku.Name, "Aligned"))
}

flattenAndSetTags(d, resp.Tags)
if err := flattenAndSetTags(d, &resp.Tags); err != nil {
return fmt.Errorf("Error flattening `tags`: %+v", err)
}

return nil
}
Expand Down
Loading