diff --git a/CHANGELOG.md b/CHANGELOG.md index b7d9faa80c31..99833e57ff8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,14 @@ FEATURES: * **New Data Source:** `azurerm_container_registry` [GH-1642] - IMPROVEMENTS: +* sdk: switching from `WaitForCompletion` -> `WaitForCompletionRef` when polling Future's [GH-1660] * Data Source: `azurerm_kubernetes_cluster` - support for specifying the `network_profile` block [GH-1479] +* Data Source: `azurerm_kubernetes_cluster` - outputting the `node_resource_group` field [GH-1649] * `azurerm_kubernetes_cluster` - support for specifying the `network_profile` block [GH-1479] +* `azurerm_kubernetes_cluster` - outputting the `node_resource_group` field [GH-1649] +* `azurerm_virtual_machine` - setting the connection information for Provisioners [GH-1646] ## 1.11.0 (July 25, 2018) diff --git a/azurerm/data_source_app_service.go b/azurerm/data_source_app_service.go index bf751dc24d4d..6cdc24e22116 100644 --- a/azurerm/data_source_app_service.go +++ b/azurerm/data_source_app_service.go @@ -159,7 +159,7 @@ func dataSourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error if err != nil { return err } - err = siteCredFuture.WaitForCompletion(ctx, client.Client) + err = siteCredFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/data_source_app_service_plan.go b/azurerm/data_source_app_service_plan.go index ea76e8781684..6dc82904949e 100644 --- a/azurerm/data_source_app_service_plan.go +++ b/azurerm/data_source_app_service_plan.go @@ -10,9 +10,6 @@ import ( func dataSourceAppServicePlan() *schema.Resource { return &schema.Resource{ Read: dataSourceAppServicePlanRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_application_security_group.go b/azurerm/data_source_application_security_group.go index 1976c78e0ea5..ac2310f92df6 100644 --- a/azurerm/data_source_application_security_group.go +++ b/azurerm/data_source_application_security_group.go @@ -10,9 +10,6 @@ import ( func dataSourceArmApplicationSecurityGroup() *schema.Resource { return &schema.Resource{ Read: dataSourceArmApplicationSecurityGroupRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_azuread_application.go b/azurerm/data_source_azuread_application.go index dc2e5011fe83..85785e829a0a 100644 --- a/azurerm/data_source_azuread_application.go +++ b/azurerm/data_source_azuread_application.go @@ -11,9 +11,6 @@ import ( func dataSourceArmAzureADApplication() *schema.Resource { return &schema.Resource{ Read: dataSourceArmAzureADApplicationRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "object_id": { diff --git a/azurerm/data_source_azuread_service_principal.go b/azurerm/data_source_azuread_service_principal.go index b26822a4b2fc..aac245569dff 100644 --- a/azurerm/data_source_azuread_service_principal.go +++ b/azurerm/data_source_azuread_service_principal.go @@ -11,9 +11,6 @@ import ( func dataSourceArmActiveDirectoryServicePrincipal() *schema.Resource { return &schema.Resource{ Read: dataSourceArmActiveDirectoryServicePrincipalRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "object_id": { diff --git a/azurerm/data_source_cosmos_db_account.go b/azurerm/data_source_cosmos_db_account.go index 593336f26464..eee7f2ece62b 100644 --- a/azurerm/data_source_cosmos_db_account.go +++ b/azurerm/data_source_cosmos_db_account.go @@ -13,9 +13,6 @@ import ( func dataSourceArmCosmosDBAccount() *schema.Resource { return &schema.Resource{ Read: dataSourceArmCosmosDBAccountRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_kubernetes_cluster.go b/azurerm/data_source_kubernetes_cluster.go index 1f11c2dfdc68..ae3255e6c1bd 100644 --- a/azurerm/data_source_kubernetes_cluster.go +++ b/azurerm/data_source_kubernetes_cluster.go @@ -38,6 +38,11 @@ func dataSourceArmKubernetesCluster() *schema.Resource { Computed: true, }, + "node_resource_group": { + Type: schema.TypeString, + Computed: true, + }, + "kube_config": { Type: schema.TypeList, Computed: true, @@ -233,6 +238,7 @@ func dataSourceArmKubernetesClusterRead(d *schema.ResourceData, meta interface{} d.Set("dns_prefix", props.DNSPrefix) d.Set("fqdn", props.Fqdn) d.Set("kubernetes_version", props.KubernetesVersion) + d.Set("node_resource_group", props.NodeResourceGroup) linuxProfile := flattenKubernetesClusterDataSourceLinuxProfile(props.LinuxProfile) if err := d.Set("linux_profile", linuxProfile); err != nil { diff --git a/azurerm/data_source_logic_app_workflow.go b/azurerm/data_source_logic_app_workflow.go index f6711fc9bac4..6a61a6db39e7 100644 --- a/azurerm/data_source_logic_app_workflow.go +++ b/azurerm/data_source_logic_app_workflow.go @@ -11,9 +11,6 @@ import ( func dataSourceArmLogicAppWorkflow() *schema.Resource { return &schema.Resource{ Read: dataSourceArmLogicAppWorkflowRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_network_interface.go b/azurerm/data_source_network_interface.go index b7eb9053d087..2062e577d83a 100644 --- a/azurerm/data_source_network_interface.go +++ b/azurerm/data_source_network_interface.go @@ -10,9 +10,6 @@ import ( func dataSourceArmNetworkInterface() *schema.Resource { return &schema.Resource{ Read: dataSourceArmNetworkInterfaceRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_recovery_services_vault.go b/azurerm/data_source_recovery_services_vault.go index 9737b6225e6c..758d37f12e32 100644 --- a/azurerm/data_source_recovery_services_vault.go +++ b/azurerm/data_source_recovery_services_vault.go @@ -11,9 +11,6 @@ import ( func dataSourceArmRecoveryServicesVault() *schema.Resource { return &schema.Resource{ Read: dataSourceArmRecoveryServicesVaultRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/data_source_scheduler_job_collection.go b/azurerm/data_source_scheduler_job_collection.go index 8ec72ea0e6ae..657da5b75b01 100644 --- a/azurerm/data_source_scheduler_job_collection.go +++ b/azurerm/data_source_scheduler_job_collection.go @@ -10,9 +10,6 @@ import ( func dataSourceArmSchedulerJobCollection() *schema.Resource { return &schema.Resource{ Read: dataSourceArmSchedulerJobCollectionRead, - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, Schema: map[string]*schema.Schema{ "name": { diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 13c01b06493a..0d0e7d2ec685 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -236,7 +236,7 @@ func resourceArmAppServiceCreate(d *schema.ResourceData, meta interface{}) error return err } - err = createFuture.WaitForCompletion(ctx, client.Client) + err = createFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -289,7 +289,7 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -364,7 +364,7 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) @@ -420,7 +420,7 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } - err = siteCredFuture.WaitForCompletion(ctx, client.Client) + err = siteCredFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_app_service_active_slot.go b/azurerm/resource_arm_app_service_active_slot.go index a2a744290690..b621c180a117 100644 --- a/azurerm/resource_arm_app_service_active_slot.go +++ b/azurerm/resource_arm_app_service_active_slot.go @@ -70,7 +70,7 @@ func resourceArmAppServiceActiveSlotCreate(d *schema.ResourceData, meta interfac if err != nil { return fmt.Errorf("Error swapping App Service Slot %q/%q: %+v", appServiceName, targetSlot, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error swapping App Service Slot %q/%q: %+v", appServiceName, targetSlot, err) } diff --git a/azurerm/resource_arm_app_service_plan.go b/azurerm/resource_arm_app_service_plan.go index 4c298acc9884..d10e9300bb4d 100644 --- a/azurerm/resource_arm_app_service_plan.go +++ b/azurerm/resource_arm_app_service_plan.go @@ -136,7 +136,7 @@ func resourceArmAppServicePlanCreateUpdate(d *schema.ResourceData, meta interfac return err } - err = createFuture.WaitForCompletion(ctx, client.Client) + err = createFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 92a4367b9de1..9dbf53ab8cd2 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -197,7 +197,7 @@ func resourceArmAppServiceSlotCreate(d *schema.ResourceData, meta interface{}) e return err } - err = createFuture.WaitForCompletion(ctx, client.Client) + err = createFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -253,7 +253,7 @@ func resourceArmAppServiceSlotUpdate(d *schema.ResourceData, meta interface{}) e return err } - err = createFuture.WaitForCompletion(ctx, client.Client) + err = createFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_application_gateway.go b/azurerm/resource_arm_application_gateway.go index edd6d1342bb6..f2b059223afb 100644 --- a/azurerm/resource_arm_application_gateway.go +++ b/azurerm/resource_arm_application_gateway.go @@ -755,7 +755,7 @@ func resourceArmApplicationGatewayCreateUpdate(d *schema.ResourceData, meta inte return fmt.Errorf("Error Creating/Updating ApplicationGateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error Creating/Updating ApplicationGateway %q (Resource Group %q): %+v", name, resGroup, err) } @@ -857,7 +857,7 @@ func resourceArmApplicationGatewayDelete(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error deleting for AppGateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of AppGateway %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_application_gateway_test.go b/azurerm/resource_arm_application_gateway_test.go index 7cdd4a181989..420be2240628 100644 --- a/azurerm/resource_arm_application_gateway_test.go +++ b/azurerm/resource_arm_application_gateway_test.go @@ -60,7 +60,7 @@ func testSweepApplicationGateways(region string) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { continue diff --git a/azurerm/resource_arm_application_security_group.go b/azurerm/resource_arm_application_security_group.go index 59944e13a7e5..51e681f0e40b 100644 --- a/azurerm/resource_arm_application_security_group.go +++ b/azurerm/resource_arm_application_security_group.go @@ -54,7 +54,7 @@ func resourceArmApplicationSecurityGroupCreateUpdate(d *schema.ResourceData, met return fmt.Errorf("Error creating Application Security Group %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the Application Security Group %q (Resource Group %q) to finish creating: %+v", name, resourceGroup, err) } @@ -123,7 +123,7 @@ func resourceArmApplicationSecurityGroupDelete(d *schema.ResourceData, meta inte } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if !response.WasNotFound(future.Response()) { return fmt.Errorf("Error waiting for deletion of Application Security Group %q (Resource Group %q): %+v", name, resourceGroup, err) diff --git a/azurerm/resource_arm_cdn_endpoint.go b/azurerm/resource_arm_cdn_endpoint.go index 2e85c9cadf5d..90b0ebdeb5b3 100644 --- a/azurerm/resource_arm_cdn_endpoint.go +++ b/azurerm/resource_arm_cdn_endpoint.go @@ -246,7 +246,7 @@ func resourceArmCdnEndpointCreate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error creating CDN Endpoint %q (Profile %q / Resource Group %q): %+v", name, profileName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for CDN Endpoint %q (Profile %q / Resource Group %q) to finish creating: %+v", name, profileName, resourceGroup, err) } @@ -312,7 +312,7 @@ func resourceArmCdnEndpointUpdate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error updating CDN Endpoint %q (Profile %q / Resource Group %q): %s", name, profileName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, endpointsClient.Client) + err = future.WaitForCompletionRef(ctx, endpointsClient.Client) if err != nil { return fmt.Errorf("Error waiting for the CDN Endpoint %q (Profile %q / Resource Group %q) to finish updating: %+v", name, profileName, resourceGroup, err) } @@ -408,7 +408,7 @@ func resourceArmCdnEndpointDelete(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error deleting CDN Endpoint %q (Profile %q / Resource Group %q): %+v", name, profileName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_cdn_endpoint_test.go b/azurerm/resource_arm_cdn_endpoint_test.go index 1929c36df241..c676882ba0e9 100644 --- a/azurerm/resource_arm_cdn_endpoint_test.go +++ b/azurerm/resource_arm_cdn_endpoint_test.go @@ -275,7 +275,7 @@ func testCheckAzureRMCdnEndpointDisappears(name string) resource.TestCheckFunc { return fmt.Errorf("Bad: Delete on cdnEndpointsClient: %+v", err) } - err = future.WaitForCompletion(ctx, conn.Client) + err = future.WaitForCompletionRef(ctx, conn.Client) if err != nil { return fmt.Errorf("Bad: Delete on cdnEndpointsClient: %+v", err) } diff --git a/azurerm/resource_arm_cdn_profile.go b/azurerm/resource_arm_cdn_profile.go index 77fca987791c..d72dfd00c3a9 100644 --- a/azurerm/resource_arm_cdn_profile.go +++ b/azurerm/resource_arm_cdn_profile.go @@ -77,7 +77,7 @@ func resourceArmCdnProfileCreate(d *schema.ResourceData, meta interface{}) error return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -116,7 +116,7 @@ func resourceArmCdnProfileUpdate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error issuing update request for CDN Profile %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the update of CDN Profile %q (Resource Group %q) to commplete: %+v", name, resourceGroup, err) } @@ -178,7 +178,7 @@ func resourceArmCdnProfileDelete(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error issuing delete request for CDN Profile %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_cdn_profile_test.go b/azurerm/resource_arm_cdn_profile_test.go index 6630880d76e5..2a7e1fc46362 100644 --- a/azurerm/resource_arm_cdn_profile_test.go +++ b/azurerm/resource_arm_cdn_profile_test.go @@ -52,7 +52,7 @@ func testSweepCDNProfiles(region string) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_container_group.go b/azurerm/resource_arm_container_group.go index 0bf7b99a0f72..635b525ddea3 100644 --- a/azurerm/resource_arm_container_group.go +++ b/azurerm/resource_arm_container_group.go @@ -15,6 +15,9 @@ func resourceArmContainerGroup() *schema.Resource { Create: resourceArmContainerGroupCreate, Read: resourceArmContainerGroupRead, Delete: resourceArmContainerGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": { @@ -464,12 +467,14 @@ func flattenContainerVolumes(volumeMounts *[]containerinstance.VolumeMount, cont // find corresponding volume in config // and use the data - for _, cvr := range *containerVolumesConfig { - cv := cvr.(map[string]interface{}) - rawName := cv["name"].(string) - if *vm.Name == rawName { - storageAccountKey := cv["storage_account_key"].(string) - volumeConfig["storage_account_key"] = storageAccountKey + if containerVolumesConfig != nil { + for _, cvr := range *containerVolumesConfig { + cv := cvr.(map[string]interface{}) + rawName := cv["name"].(string) + if *vm.Name == rawName { + storageAccountKey := cv["storage_account_key"].(string) + volumeConfig["storage_account_key"] = storageAccountKey + } } } @@ -605,11 +610,13 @@ func flattenContainerImageRegistryCredentials(d *schema.ResourceData, credsPtr * credConfig["username"] = *cred.Username } - data := configsOld[i].(map[string]interface{}) - oldServer := data["server"].(string) - if cred.Server != nil && *cred.Server == oldServer { - if v, ok := d.GetOk(fmt.Sprintf("image_registry_credential.%d.password", i)); ok { - credConfig["password"] = v.(string) + if len(configsOld) > i { + data := configsOld[i].(map[string]interface{}) + oldServer := data["server"].(string) + if cred.Server != nil && *cred.Server == oldServer { + if v, ok := d.GetOk(fmt.Sprintf("image_registry_credential.%d.password", i)); ok { + credConfig["password"] = v.(string) + } } } diff --git a/azurerm/resource_arm_container_group_test.go b/azurerm/resource_arm_container_group_test.go index 742151705837..1d20e975dcf1 100644 --- a/azurerm/resource_arm_container_group_test.go +++ b/azurerm/resource_arm_container_group_test.go @@ -35,6 +35,15 @@ func TestAccAzureRMContainerGroup_imageRegistryCredentials(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "image_registry_credential.1.password", "acrpassword"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "image_registry_credential.0.password", + "image_registry_credential.1.password", + }, + }, }, }) } @@ -97,6 +106,15 @@ func TestAccAzureRMContainerGroup_linuxBasic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "os_type", "Linux"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "image_registry_credential.0.password", + "image_registry_credential.1.password", + }, + }, }, }) } @@ -159,6 +177,14 @@ func TestAccAzureRMContainerGroup_linuxComplete(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "restart_policy", "OnFailure"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "container.0.volume.0.storage_account_key", + }, + }, }, }) } @@ -182,6 +208,11 @@ func TestAccAzureRMContainerGroup_windowsBasic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "os_type", "Windows"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -210,6 +241,11 @@ func TestAccAzureRMContainerGroup_windowsComplete(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "restart_policy", "Never"), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/azurerm/resource_arm_container_registry.go b/azurerm/resource_arm_container_registry.go index 89064aa4016d..b60882cb298c 100644 --- a/azurerm/resource_arm_container_registry.go +++ b/azurerm/resource_arm_container_registry.go @@ -147,7 +147,7 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error creating Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for creation of Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -208,7 +208,7 @@ func resourceArmContainerRegistryUpdate(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error updating Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for update of Container Registry %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -305,7 +305,7 @@ func resourceArmContainerRegistryDelete(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error issuing Azure ARM delete request of Container Registry '%s': %+v", name, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_container_registry_migrate_test.go b/azurerm/resource_arm_container_registry_migrate_test.go index 966fd99a8c99..2df208979fa1 100644 --- a/azurerm/resource_arm_container_registry_migrate_test.go +++ b/azurerm/resource_arm_container_registry_migrate_test.go @@ -124,7 +124,7 @@ func createStorageAccount(client *ArmClient, resourceGroupName, storageAccountNa return nil, fmt.Errorf("Error creating Storage Account %q: %+v", resourceGroupName, err) } - err = future.WaitForCompletion(ctx, storageClient.Client) + err = future.WaitForCompletionRef(ctx, storageClient.Client) if err != nil { return nil, fmt.Errorf("Error waiting for creation of Storage Account %q: %+v", resourceGroupName, err) } diff --git a/azurerm/resource_arm_container_service.go b/azurerm/resource_arm_container_service.go index a29c396294bc..eabfa2c9f864 100644 --- a/azurerm/resource_arm_container_service.go +++ b/azurerm/resource_arm_container_service.go @@ -323,7 +323,7 @@ func resourceArmContainerServiceDelete(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error issuing Azure ARM delete request of Container Service '%s': %s", name, err) } - err = future.WaitForCompletion(ctx, containerServiceClient.Client) + err = future.WaitForCompletionRef(ctx, containerServiceClient.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_container_service_test.go b/azurerm/resource_arm_container_service_test.go index 387d1feca579..2f633b66d1ee 100644 --- a/azurerm/resource_arm_container_service_test.go +++ b/azurerm/resource_arm_container_service_test.go @@ -186,7 +186,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent%d" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } diagnostics_profile { @@ -226,7 +226,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent%d" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } service_principal { @@ -271,7 +271,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent%d" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } service_principal { @@ -320,7 +320,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent%d" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } diagnostics_profile { diff --git a/azurerm/resource_arm_cosmos_db_account.go b/azurerm/resource_arm_cosmos_db_account.go index 66f6c8e34fee..97e4ccc06b8b 100644 --- a/azurerm/resource_arm_cosmos_db_account.go +++ b/azurerm/resource_arm_cosmos_db_account.go @@ -617,7 +617,7 @@ func resourceArmCosmosDBAccountApiUpsert(client documentdb.DatabaseAccountsClien return nil, fmt.Errorf("Error creating/updating CosmosDB Account %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return nil, fmt.Errorf("Error waiting for the CosmosDB Account %q (Resource Group %q) to finish creating/updating: %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_cosmos_db_account_test.go b/azurerm/resource_arm_cosmos_db_account_test.go index cb137d77897a..b98e7f1c1a56 100644 --- a/azurerm/resource_arm_cosmos_db_account_test.go +++ b/azurerm/resource_arm_cosmos_db_account_test.go @@ -53,7 +53,7 @@ func testSweepCosmosDBAccount(region string) error { if err != nil { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_data_lake_analytics_account.go b/azurerm/resource_arm_data_lake_analytics_account.go index 28a9c476ba91..f101bfe32eae 100644 --- a/azurerm/resource_arm_data_lake_analytics_account.go +++ b/azurerm/resource_arm_data_lake_analytics_account.go @@ -100,7 +100,7 @@ func resourceArmDateLakeAnalyticsAccountCreate(d *schema.ResourceData, meta inte return fmt.Errorf("Error issuing create request for Data Lake Analytics Account %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error creating Data Lake Analytics Account %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -145,7 +145,7 @@ func resourceArmDateLakeAnalyticsAccountUpdate(d *schema.ResourceData, meta inte return fmt.Errorf("Error issuing update request for Data Lake Analytics Account %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the update of Data Lake Analytics Account %q (Resource Group %q) to commplete: %+v", name, resourceGroup, err) } @@ -210,7 +210,7 @@ func resourceArmDateLakeAnalyticsAccountDelete(d *schema.ResourceData, meta inte return fmt.Errorf("Error issuing delete request for Data Lake Analytics Account %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_data_lake_store.go b/azurerm/resource_arm_data_lake_store.go index c07a21664773..19498d7be8d8 100644 --- a/azurerm/resource_arm_data_lake_store.go +++ b/azurerm/resource_arm_data_lake_store.go @@ -253,7 +253,7 @@ func resourceArmDateLakeStoreDelete(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error issuing delete request for Data Lake Store %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_dns_zone.go b/azurerm/resource_arm_dns_zone.go index c0d4bc011b55..ecde8ec45691 100644 --- a/azurerm/resource_arm_dns_zone.go +++ b/azurerm/resource_arm_dns_zone.go @@ -180,7 +180,7 @@ func resourceArmDnsZoneDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting DNS zone %s (resource group %s): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_eventgrid_topic.go b/azurerm/resource_arm_eventgrid_topic.go index d037094cc0a5..1eab582ab50f 100644 --- a/azurerm/resource_arm_eventgrid_topic.go +++ b/azurerm/resource_arm_eventgrid_topic.go @@ -75,7 +75,7 @@ func resourceArmEventGridTopicCreateUpdate(d *schema.ResourceData, meta interfac return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -157,7 +157,7 @@ func resourceArmEventGridTopicDelete(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error deleting Event Grid Topic %q: %+v", name, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_eventhub_namespace.go b/azurerm/resource_arm_eventhub_namespace.go index b69f6e49310b..e2e868c4099d 100644 --- a/azurerm/resource_arm_eventhub_namespace.go +++ b/azurerm/resource_arm_eventhub_namespace.go @@ -138,7 +138,7 @@ func resourceArmEventHubNamespaceCreate(d *schema.ResourceData, meta interface{} return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error creating eventhub namespace: %+v", err) } diff --git a/azurerm/resource_arm_express_route_circuit.go b/azurerm/resource_arm_express_route_circuit.go index a1609ecc2d09..7c5ae66b123d 100644 --- a/azurerm/resource_arm_express_route_circuit.go +++ b/azurerm/resource_arm_express_route_circuit.go @@ -142,7 +142,7 @@ func resourceArmExpressRouteCircuitCreateOrUpdate(d *schema.ResourceData, meta i return fmt.Errorf("Error Creating/Updating ExpressRouteCircuit %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error Creating/Updating ExpressRouteCircuit %q (Resource Group %q): %+v", name, resGroup, err) } @@ -217,7 +217,7 @@ func resourceArmExpressRouteCircuitDelete(d *schema.ResourceData, meta interface return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_express_route_circuit_authorization.go b/azurerm/resource_arm_express_route_circuit_authorization.go index bb057d6496af..1f0f07a59728 100644 --- a/azurerm/resource_arm_express_route_circuit_authorization.go +++ b/azurerm/resource_arm_express_route_circuit_authorization.go @@ -67,7 +67,7 @@ func resourceArmExpressRouteCircuitAuthorizationCreateUpdate(d *schema.ResourceD return fmt.Errorf("Error Creating/Updating Express Route Circuit Authorization %q (Circuit %q / Resource Group %q): %+v", name, circuitName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for Express Route Circuit Authorization %q (Circuit %q / Resource Group %q) to finish creating/updating: %+v", name, circuitName, resourceGroup, err) } @@ -141,7 +141,7 @@ func resourceArmExpressRouteCircuitAuthorizationDelete(d *schema.ResourceData, m return fmt.Errorf("Error deleting Express Route Circuit Authorization %q (Circuit %q / Resource Group %q): %+v", name, circuitName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_express_route_circuit_peering.go b/azurerm/resource_arm_express_route_circuit_peering.go index 4252282e0517..5fd72ce25a0d 100644 --- a/azurerm/resource_arm_express_route_circuit_peering.go +++ b/azurerm/resource_arm_express_route_circuit_peering.go @@ -149,7 +149,7 @@ func resourceArmExpressRouteCircuitPeeringCreateUpdate(d *schema.ResourceData, m return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -231,7 +231,7 @@ func resourceArmExpressRouteCircuitPeeringDelete(d *schema.ResourceData, meta in return fmt.Errorf("Error issuing delete request for Express Route Circuit Peering %q (Circuit %q / Resource Group %q): %+v", peeringType, circuitName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_function_app.go b/azurerm/resource_arm_function_app.go index 358470813082..3183d6e15479 100644 --- a/azurerm/resource_arm_function_app.go +++ b/azurerm/resource_arm_function_app.go @@ -269,7 +269,7 @@ func resourceArmFunctionAppCreate(d *schema.ResourceData, meta interface{}) erro return err } - err = createFuture.WaitForCompletion(ctx, client.Client) + err = createFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -340,7 +340,7 @@ func resourceArmFunctionAppUpdate(d *schema.ResourceData, meta interface{}) erro return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -418,7 +418,7 @@ func resourceArmFunctionAppRead(d *schema.ResourceData, meta interface{}) error if err != nil { return err } - err = siteCredFuture.WaitForCompletion(ctx, client.Client) + err = siteCredFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_image.go b/azurerm/resource_arm_image.go index b0c4a9d731ec..8ce7a7cda6b3 100644 --- a/azurerm/resource_arm_image.go +++ b/azurerm/resource_arm_image.go @@ -222,7 +222,7 @@ func resourceArmImageCreateUpdate(d *schema.ResourceData, meta interface{}) erro return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -304,7 +304,7 @@ func resourceArmImageDelete(d *schema.ResourceData, meta interface{}) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_image_test.go b/azurerm/resource_arm_image_test.go index 126d741e07c4..040d7fdd4617 100644 --- a/azurerm/resource_arm_image_test.go +++ b/azurerm/resource_arm_image_test.go @@ -174,7 +174,7 @@ func testGeneralizeVMImage(resourceGroup string, vmName string, userName string, return fmt.Errorf("Bad: Deallocating error %+v", err) } - err = future.WaitForCompletion(ctx, vmClient.Client) + err = future.WaitForCompletionRef(ctx, vmClient.Client) if err != nil { return fmt.Errorf("Bad: Deallocating error %+v", err) } diff --git a/azurerm/resource_arm_iothub.go b/azurerm/resource_arm_iothub.go index 597d91e9c9c8..aa3bc77af594 100644 --- a/azurerm/resource_arm_iothub.go +++ b/azurerm/resource_arm_iothub.go @@ -156,7 +156,7 @@ func resourceArmIotHubCreateAndUpdate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error creating/updating IotHub %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of the creating/updating of IotHub %q (Resource Group %q): %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_kubernetes_cluster.go b/azurerm/resource_arm_kubernetes_cluster.go index 3d7821c9497a..dd24e53abdad 100644 --- a/azurerm/resource_arm_kubernetes_cluster.go +++ b/azurerm/resource_arm_kubernetes_cluster.go @@ -75,6 +75,11 @@ func resourceArmKubernetesCluster() *schema.Resource { Computed: true, }, + "node_resource_group": { + Type: schema.TypeString, + Computed: true, + }, + "kube_config": { Type: schema.TypeList, Computed: true, @@ -338,7 +343,7 @@ func resourceArmKubernetesClusterCreate(d *schema.ResourceData, meta interface{} return err } - err = future.WaitForCompletion(ctx, kubernetesClustersClient.Client) + err = future.WaitForCompletionRef(ctx, kubernetesClustersClient.Client) if err != nil { return err } @@ -394,6 +399,7 @@ func resourceArmKubernetesClusterRead(d *schema.ResourceData, meta interface{}) d.Set("dns_prefix", props.DNSPrefix) d.Set("fqdn", props.Fqdn) d.Set("kubernetes_version", props.KubernetesVersion) + d.Set("node_resource_group", props.NodeResourceGroup) linuxProfile := flattenAzureRmKubernetesClusterLinuxProfile(props.LinuxProfile) if err := d.Set("linux_profile", linuxProfile); err != nil { @@ -445,7 +451,7 @@ func resourceArmKubernetesClusterDelete(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error issuing AzureRM delete request of AKS Managed Cluster %q (resource Group %q): %+v", name, resGroup, err) } - return future.WaitForCompletion(ctx, kubernetesClustersClient.Client) + return future.WaitForCompletionRef(ctx, kubernetesClustersClient.Client) } func flattenAzureRmKubernetesClusterLinuxProfile(input *containerservice.LinuxProfile) []interface{} { diff --git a/azurerm/resource_arm_loadbalancer.go b/azurerm/resource_arm_loadbalancer.go index fa6ed9d053a3..ca311c6d9a98 100644 --- a/azurerm/resource_arm_loadbalancer.go +++ b/azurerm/resource_arm_loadbalancer.go @@ -171,7 +171,7 @@ func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", name, resGroup, err) } @@ -271,7 +271,7 @@ func resourceArmLoadBalancerDelete(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error deleting Load Balancer %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the deleting Load Balancer %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_backend_address_pool.go b/azurerm/resource_arm_loadbalancer_backend_address_pool.go index 5e21b945c7f6..79ed02e05007 100644 --- a/azurerm/resource_arm_loadbalancer_backend_address_pool.go +++ b/azurerm/resource_arm_loadbalancer_backend_address_pool.go @@ -93,7 +93,7 @@ func resourceArmLoadBalancerBackendAddressPoolCreate(d *schema.ResourceData, met return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } @@ -220,7 +220,7 @@ func resourceArmLoadBalancerBackendAddressPoolDelete(d *schema.ResourceData, met return fmt.Errorf("Error Creating/Updating LoadBalancer: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion for the LoadBalancer: %+v", err) } diff --git a/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go b/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go index 145d46f90e75..a982c7cd6ac4 100644 --- a/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go +++ b/azurerm/resource_arm_loadbalancer_backend_address_pool_test.go @@ -163,7 +163,7 @@ func testCheckAzureRMLoadBalancerBackEndAddressPoolDisappears(addressPoolName st return fmt.Errorf("Error Creating/Updating LoadBalancer %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error Creating/Updating LoadBalancer %+v", err) } diff --git a/azurerm/resource_arm_loadbalancer_nat_pool.go b/azurerm/resource_arm_loadbalancer_nat_pool.go index dc446aafff08..80cf2c10903a 100644 --- a/azurerm/resource_arm_loadbalancer_nat_pool.go +++ b/azurerm/resource_arm_loadbalancer_nat_pool.go @@ -118,7 +118,7 @@ func resourceArmLoadBalancerNatPoolCreate(d *schema.ResourceData, meta interface return fmt.Errorf("Error Creating/Updating Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } @@ -242,7 +242,7 @@ func resourceArmLoadBalancerNatPoolDelete(d *schema.ResourceData, meta interface return fmt.Errorf("Error creating/updating Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of the Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_nat_pool_test.go b/azurerm/resource_arm_loadbalancer_nat_pool_test.go index 46c59246f17d..337e17152251 100644 --- a/azurerm/resource_arm_loadbalancer_nat_pool_test.go +++ b/azurerm/resource_arm_loadbalancer_nat_pool_test.go @@ -203,7 +203,7 @@ func testCheckAzureRMLoadBalancerNatPoolDisappears(natPoolName string, lb *netwo return fmt.Errorf("Error Creating/Updating LoadBalancer %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of LoadBalancer %+v", err) } diff --git a/azurerm/resource_arm_loadbalancer_nat_rule.go b/azurerm/resource_arm_loadbalancer_nat_rule.go index cd34c2a8b7de..09046721e1c8 100644 --- a/azurerm/resource_arm_loadbalancer_nat_rule.go +++ b/azurerm/resource_arm_loadbalancer_nat_rule.go @@ -124,7 +124,7 @@ func resourceArmLoadBalancerNatRuleCreate(d *schema.ResourceData, meta interface return fmt.Errorf("Error Creating / Updating LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } @@ -253,7 +253,7 @@ func resourceArmLoadBalancerNatRuleDelete(d *schema.ResourceData, meta interface return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q) %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of LoadBalancer updates for %q (Resource Group %q) %+v", loadBalancerName, resGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_nat_rule_test.go b/azurerm/resource_arm_loadbalancer_nat_rule_test.go index 52a86bfc7e47..130d7896e53c 100644 --- a/azurerm/resource_arm_loadbalancer_nat_rule_test.go +++ b/azurerm/resource_arm_loadbalancer_nat_rule_test.go @@ -263,7 +263,7 @@ func testCheckAzureRMLoadBalancerNatRuleDisappears(natRuleName string, lb *netwo return fmt.Errorf("Error Creating/Updating LoadBalancer %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of LoadBalancer %q (Resource Group %q): %+v", *lb.Name, id.ResourceGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_probe.go b/azurerm/resource_arm_loadbalancer_probe.go index ca1aa6c825ac..3fd6a66d6cbf 100644 --- a/azurerm/resource_arm_loadbalancer_probe.go +++ b/azurerm/resource_arm_loadbalancer_probe.go @@ -123,7 +123,7 @@ func resourceArmLoadBalancerProbeCreate(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error Creating/Updating Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Load Balancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } @@ -242,7 +242,7 @@ func resourceArmLoadBalancerProbeDelete(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_probe_test.go b/azurerm/resource_arm_loadbalancer_probe_test.go index fa2033b4ad78..557df04a0e13 100644 --- a/azurerm/resource_arm_loadbalancer_probe_test.go +++ b/azurerm/resource_arm_loadbalancer_probe_test.go @@ -234,7 +234,7 @@ func testCheckAzureRMLoadBalancerProbeDisappears(addressPoolName string, lb *net return fmt.Errorf("Error Creating/Updating LoadBalancer: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion for LoadBalancer: %+v", err) } diff --git a/azurerm/resource_arm_loadbalancer_rule.go b/azurerm/resource_arm_loadbalancer_rule.go index 150052c00b9d..e28add430bd5 100644 --- a/azurerm/resource_arm_loadbalancer_rule.go +++ b/azurerm/resource_arm_loadbalancer_rule.go @@ -145,7 +145,7 @@ func resourceArmLoadBalancerRuleCreate(d *schema.ResourceData, meta interface{}) return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion for LoadBalancer updates: %+v", err) } @@ -285,7 +285,7 @@ func resourceArmLoadBalancerRuleDelete(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of LoadBalancer %q (Resource Group %q): %+v", loadBalancerName, resGroup, err) } diff --git a/azurerm/resource_arm_loadbalancer_rule_test.go b/azurerm/resource_arm_loadbalancer_rule_test.go index e6530ca7d57b..e1ec17148b05 100644 --- a/azurerm/resource_arm_loadbalancer_rule_test.go +++ b/azurerm/resource_arm_loadbalancer_rule_test.go @@ -300,7 +300,7 @@ func testCheckAzureRMLoadBalancerRuleDisappears(ruleName string, lb *network.Loa return fmt.Errorf("Error Creating/Updating LoadBalancer %q (Resource Group %q): %+v", lb.Name, id.ResourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of LoadBalancer %q (Resource Group %q): %+v", lb.Name, id.ResourceGroup, err) } diff --git a/azurerm/resource_arm_local_network_gateway.go b/azurerm/resource_arm_local_network_gateway.go index 2791ca089d06..84da0fd1f358 100644 --- a/azurerm/resource_arm_local_network_gateway.go +++ b/azurerm/resource_arm_local_network_gateway.go @@ -109,7 +109,7 @@ func resourceArmLocalNetworkGatewayCreate(d *schema.ResourceData, meta interface return fmt.Errorf("Error creating Local Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Local Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } @@ -189,7 +189,7 @@ func resourceArmLocalNetworkGatewayDelete(d *schema.ResourceData, meta interface return fmt.Errorf("Error issuing delete request for local network gateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_local_network_gateway_test.go b/azurerm/resource_arm_local_network_gateway_test.go index 9a81de76f5e8..6f09f359b1ed 100644 --- a/azurerm/resource_arm_local_network_gateway_test.go +++ b/azurerm/resource_arm_local_network_gateway_test.go @@ -257,7 +257,7 @@ func testCheckAzureRMLocalNetworkGatewayDisappears(name string) resource.TestChe return fmt.Errorf("Error deleting the state of local network gateway %q: %+v", localNetName, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of the local network gateway %q to complete: %+v", localNetName, err) } diff --git a/azurerm/resource_arm_log_analytics_workspace.go b/azurerm/resource_arm_log_analytics_workspace.go index 8f1386d1db9e..3ea74c3e4fad 100644 --- a/azurerm/resource_arm_log_analytics_workspace.go +++ b/azurerm/resource_arm_log_analytics_workspace.go @@ -116,7 +116,7 @@ func resourceArmLogAnalyticsWorkspaceCreateUpdate(d *schema.ResourceData, meta i return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_managed_disk.go b/azurerm/resource_arm_managed_disk.go index 055f2543b69e..e2f7180a3f7c 100644 --- a/azurerm/resource_arm_managed_disk.go +++ b/azurerm/resource_arm_managed_disk.go @@ -186,7 +186,7 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -279,7 +279,7 @@ func resourceArmManagedDiskDelete(d *schema.ResourceData, meta interface{}) erro } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if !response.WasNotFound(future.Response()) { return err diff --git a/azurerm/resource_arm_managed_disk_test.go b/azurerm/resource_arm_managed_disk_test.go index 2827a0e96367..f29f8a701c1b 100644 --- a/azurerm/resource_arm_managed_disk_test.go +++ b/azurerm/resource_arm_managed_disk_test.go @@ -291,7 +291,7 @@ func testDeleteAzureRMVirtualMachine(name string) resource.TestCheckFunc { return fmt.Errorf("Bad: Delete on vmClient: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Bad: Delete on vmClient: %+v", err) } diff --git a/azurerm/resource_arm_mysql_configuration.go b/azurerm/resource_arm_mysql_configuration.go index 8a2dd1aa67cf..c8d8f426a8c6 100644 --- a/azurerm/resource_arm_mysql_configuration.go +++ b/azurerm/resource_arm_mysql_configuration.go @@ -65,7 +65,7 @@ func resourceArmMySQLConfigurationCreate(d *schema.ResourceData, meta interface{ return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -144,7 +144,7 @@ func resourceArmMySQLConfigurationDelete(d *schema.ResourceData, meta interface{ return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_mysql_database.go b/azurerm/resource_arm_mysql_database.go index e4cf22b02793..cf1b1f3bfcca 100644 --- a/azurerm/resource_arm_mysql_database.go +++ b/azurerm/resource_arm_mysql_database.go @@ -74,7 +74,7 @@ func resourceArmMySqlDatabaseCreate(d *schema.ResourceData, meta interface{}) er return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -140,7 +140,7 @@ func resourceArmMySqlDatabaseDelete(d *schema.ResourceData, meta interface{}) er return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_mysql_firewall_rule.go b/azurerm/resource_arm_mysql_firewall_rule.go index 4d37864866b2..d6842a0bfdf9 100644 --- a/azurerm/resource_arm_mysql_firewall_rule.go +++ b/azurerm/resource_arm_mysql_firewall_rule.go @@ -71,7 +71,7 @@ func resourceArmMySqlFirewallRuleCreateUpdate(d *schema.ResourceData, meta inter return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -136,7 +136,7 @@ func resourceArmMySqlFirewallRuleDelete(d *schema.ResourceData, meta interface{} return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_mysql_server.go b/azurerm/resource_arm_mysql_server.go index 8b08f364fa2c..fcf0deaefb75 100644 --- a/azurerm/resource_arm_mysql_server.go +++ b/azurerm/resource_arm_mysql_server.go @@ -224,7 +224,7 @@ func resourceArmMySqlServerCreate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error creating MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for creation of MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -275,7 +275,7 @@ func resourceArmMySqlServerUpdate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error updating MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for MySQL Server %q (Resource Group %q) to finish updating: %+v", name, resourceGroup, err) } @@ -358,7 +358,7 @@ func resourceArmMySqlServerDelete(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error deleting MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of MySQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_network_interface.go b/azurerm/resource_arm_network_interface.go index c157c5c2095a..69bb3aa5666b 100644 --- a/azurerm/resource_arm_network_interface.go +++ b/azurerm/resource_arm_network_interface.go @@ -306,7 +306,7 @@ func resourceArmNetworkInterfaceCreateUpdate(d *schema.ResourceData, meta interf return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -475,7 +475,7 @@ func resourceArmNetworkInterfaceDelete(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error deleting Network Interface %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the deletion of Network Interface %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_network_interface_test.go b/azurerm/resource_arm_network_interface_test.go index 2ae53ea7d1fb..42aa33c97ae0 100644 --- a/azurerm/resource_arm_network_interface_test.go +++ b/azurerm/resource_arm_network_interface_test.go @@ -63,7 +63,7 @@ func testSweepNetworkInterfaces(region string) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { continue @@ -469,7 +469,7 @@ func testCheckAzureRMNetworkInterfaceDisappears(name string) resource.TestCheckF return fmt.Errorf("Error deleting Network Interface %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the deletion of Network Interface %q (Resource Group %q): %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_network_security_group.go b/azurerm/resource_arm_network_security_group.go index b01968fdc5d1..8fba755eef6b 100644 --- a/azurerm/resource_arm_network_security_group.go +++ b/azurerm/resource_arm_network_security_group.go @@ -188,7 +188,7 @@ func resourceArmNetworkSecurityGroupCreate(d *schema.ResourceData, meta interfac return fmt.Errorf("Error creating/updating NSG %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the completion of NSG %q (Resource Group %q): %+v", name, resGroup, err) } @@ -260,7 +260,7 @@ func resourceArmNetworkSecurityGroupDelete(d *schema.ResourceData, meta interfac return fmt.Errorf("Error deleting Network Security Group %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error deleting Network Security Group %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_network_security_rule.go b/azurerm/resource_arm_network_security_rule.go index f9ab3864549b..66156c9bec1d 100644 --- a/azurerm/resource_arm_network_security_rule.go +++ b/azurerm/resource_arm_network_security_rule.go @@ -258,7 +258,7 @@ func resourceArmNetworkSecurityRuleCreate(d *schema.ResourceData, meta interface return fmt.Errorf("Error Creating/Updating Network Security Rule %q (NSG %q / Resource Group %q): %+v", name, nsgName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Network Security Rule %q (NSG %q / Resource Group %q): %+v", name, nsgName, resGroup, err) } @@ -340,7 +340,7 @@ func resourceArmNetworkSecurityRuleDelete(d *schema.ResourceData, meta interface return fmt.Errorf("Error Deleting Network Security Rule %q (NSG %q / Resource Group %q): %+v", sgRuleName, nsgName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the deletion of Network Security Rule %q (NSG %q / Resource Group %q): %+v", sgRuleName, nsgName, resGroup, err) } diff --git a/azurerm/resource_arm_network_watcher.go b/azurerm/resource_arm_network_watcher.go index 7b80c15e62ff..5452a2703c5d 100644 --- a/azurerm/resource_arm_network_watcher.go +++ b/azurerm/resource_arm_network_watcher.go @@ -115,7 +115,7 @@ func resourceArmNetworkWatcherDelete(d *schema.ResourceData, meta interface{}) e } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for the deletion of Network Watcher %q (Resource Group %q): %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_network_watcher_test.go b/azurerm/resource_arm_network_watcher_test.go index b9f97881b274..be0169c909a8 100644 --- a/azurerm/resource_arm_network_watcher_test.go +++ b/azurerm/resource_arm_network_watcher_test.go @@ -179,7 +179,7 @@ func testCheckAzureRMNetworkWatcherDisappears(name string) resource.TestCheckFun } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Bad: Delete on watcherClient: %+v", err) } diff --git a/azurerm/resource_arm_packet_capture.go b/azurerm/resource_arm_packet_capture.go index 71a9f12d8fac..ee7747aeb15a 100644 --- a/azurerm/resource_arm_packet_capture.go +++ b/azurerm/resource_arm_packet_capture.go @@ -169,7 +169,7 @@ func resourceArmPacketCaptureCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error creating Packet Capture %q (Watcher %q / Resource Group %q): %+v", name, watcherName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for creation of Packet Capture %q (Watcher %q / Resource Group %q): %+v", name, watcherName, resourceGroup, err) } @@ -254,7 +254,7 @@ func resourceArmPacketCaptureDelete(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error deleting Packet Capture %q (Watcher %q / Resource Group %q): %+v", name, watcherName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_postgresql_configuration.go b/azurerm/resource_arm_postgresql_configuration.go index a4fb229bbef6..5366fce31482 100644 --- a/azurerm/resource_arm_postgresql_configuration.go +++ b/azurerm/resource_arm_postgresql_configuration.go @@ -66,7 +66,7 @@ func resourceArmPostgreSQLConfigurationCreateUpdate(d *schema.ResourceData, meta return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -148,7 +148,7 @@ func resourceArmPostgreSQLConfigurationDelete(d *schema.ResourceData, meta inter return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_postgresql_database.go b/azurerm/resource_arm_postgresql_database.go index d05cce28919b..6cd763a12749 100644 --- a/azurerm/resource_arm_postgresql_database.go +++ b/azurerm/resource_arm_postgresql_database.go @@ -77,7 +77,7 @@ func resourceArmPostgreSQLDatabaseCreate(d *schema.ResourceData, meta interface{ return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -154,7 +154,7 @@ func resourceArmPostgreSQLDatabaseDelete(d *schema.ResourceData, meta interface{ return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_postgresql_firewall_rule.go b/azurerm/resource_arm_postgresql_firewall_rule.go index 2b06c3426360..98233118d07f 100644 --- a/azurerm/resource_arm_postgresql_firewall_rule.go +++ b/azurerm/resource_arm_postgresql_firewall_rule.go @@ -73,7 +73,7 @@ func resourceArmPostgreSQLFirewallRuleCreate(d *schema.ResourceData, meta interf return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -143,7 +143,7 @@ func resourceArmPostgreSQLFirewallRuleDelete(d *schema.ResourceData, meta interf return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_postgresql_server.go b/azurerm/resource_arm_postgresql_server.go index 50ec62ba12ea..50e4ce76d163 100644 --- a/azurerm/resource_arm_postgresql_server.go +++ b/azurerm/resource_arm_postgresql_server.go @@ -229,7 +229,7 @@ func resourceArmPostgreSQLServerCreate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error creating PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for creation of PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -280,7 +280,7 @@ func resourceArmPostgreSQLServerUpdate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error updating PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for update of PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } @@ -368,7 +368,7 @@ func resourceArmPostgreSQLServerDelete(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Error deleting PostgreSQL Server %q (Resource Group %q): %+v", name, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_public_ip.go b/azurerm/resource_arm_public_ip.go index 465248d6e4f4..8663880a353e 100644 --- a/azurerm/resource_arm_public_ip.go +++ b/azurerm/resource_arm_public_ip.go @@ -166,7 +166,7 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error Creating/Updating Public IP %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Public IP %q (Resource Group %q): %+v", name, resGroup, err) } @@ -259,7 +259,7 @@ func resourceArmPublicIpDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting Public IP %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Public IP %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_public_ip_test.go b/azurerm/resource_arm_public_ip_test.go index 54315ce633ad..72bb578004a9 100644 --- a/azurerm/resource_arm_public_ip_test.go +++ b/azurerm/resource_arm_public_ip_test.go @@ -282,7 +282,7 @@ func testCheckAzureRMPublicIpDisappears(name string) resource.TestCheckFunc { return fmt.Errorf("Error deleting Public IP %q (Resource Group %q): %+v", publicIpName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Public IP %q (Resource Group %q): %+v", publicIpName, resourceGroup, err) } diff --git a/azurerm/resource_arm_redis_cache.go b/azurerm/resource_arm_redis_cache.go index 1792378d86a7..0a103f380142 100644 --- a/azurerm/resource_arm_redis_cache.go +++ b/azurerm/resource_arm_redis_cache.go @@ -260,7 +260,7 @@ func resourceArmRedisCacheCreate(d *schema.ResourceData, meta interface{}) error return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -484,7 +484,7 @@ func resourceArmRedisCacheDelete(d *schema.ResourceData, meta interface{}) error return err } - err = future.WaitForCompletion(ctx, redisClient.Client) + err = future.WaitForCompletionRef(ctx, redisClient.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_relay_namespace.go b/azurerm/resource_arm_relay_namespace.go index 95d8423024ff..9a2568989453 100644 --- a/azurerm/resource_arm_relay_namespace.go +++ b/azurerm/resource_arm_relay_namespace.go @@ -114,7 +114,7 @@ func resourceArmRelayNamespaceCreateUpdate(d *schema.ResourceData, meta interfac return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_resource_group.go b/azurerm/resource_arm_resource_group.go index a6de8a72dd32..92a0f1ed9672 100644 --- a/azurerm/resource_arm_resource_group.go +++ b/azurerm/resource_arm_resource_group.go @@ -131,7 +131,7 @@ func resourceArmResourceGroupDelete(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error deleting Resource Group %q: %+v", name, err) } - err = deleteFuture.WaitForCompletion(ctx, client.Client) + err = deleteFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(deleteFuture.Response()) { return nil diff --git a/azurerm/resource_arm_resource_group_test.go b/azurerm/resource_arm_resource_group_test.go index ffc88f7f4d78..5e5c790e1bdf 100644 --- a/azurerm/resource_arm_resource_group_test.go +++ b/azurerm/resource_arm_resource_group_test.go @@ -46,7 +46,7 @@ func testSweepResourceGroups(region string) error { return err } - err = deleteFuture.WaitForCompletion(ctx, client.Client) + err = deleteFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -175,7 +175,7 @@ func testCheckAzureRMResourceGroupDisappears(name string) resource.TestCheckFunc return fmt.Errorf("Failed deleting Resource Group %q: %+v", resourceGroup, err) } - err = deleteFuture.WaitForCompletion(ctx, client.Client) + err = deleteFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Failed long polling for the deletion of Resource Group %q: %+v", resourceGroup, err) } diff --git a/azurerm/resource_arm_route.go b/azurerm/resource_arm_route.go index 9105280fa9de..0269bc5c143e 100644 --- a/azurerm/resource_arm_route.go +++ b/azurerm/resource_arm_route.go @@ -95,7 +95,7 @@ func resourceArmRouteCreateUpdate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error Creating/Updating Route %q (Route Table %q / Resource Group %q): %+v", name, rtName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion for Route %q (Route Table %q / Resource Group %q): %+v", name, rtName, resGroup, err) } @@ -169,7 +169,7 @@ func resourceArmRouteDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting Route %q (Route Table %q / Resource Group %q): %+v", routeName, rtName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Route %q (Route Table %q / Resource Group %q): %+v", routeName, rtName, resGroup, err) } diff --git a/azurerm/resource_arm_route_table.go b/azurerm/resource_arm_route_table.go index 763a215ae7d3..a870f32de903 100644 --- a/azurerm/resource_arm_route_table.go +++ b/azurerm/resource_arm_route_table.go @@ -126,7 +126,7 @@ func resourceArmRouteTableCreate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error Creating/Updating Route Table %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Route Table %q (Resource Group %q): %+v", name, resGroup, err) } @@ -204,7 +204,7 @@ func resourceArmRouteTableDelete(d *schema.ResourceData, meta interface{}) error } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Route Table %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_route_table_test.go b/azurerm/resource_arm_route_table_test.go index 47d0ceca7578..f014f9cfb7e5 100644 --- a/azurerm/resource_arm_route_table_test.go +++ b/azurerm/resource_arm_route_table_test.go @@ -305,7 +305,7 @@ func testCheckAzureRMRouteTableDisappears(name string) resource.TestCheckFunc { } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Route Table %q (Resource Group %q): %+v", name, resourceGroup, err) } diff --git a/azurerm/resource_arm_route_test.go b/azurerm/resource_arm_route_test.go index d5639878ded9..8e532863a260 100644 --- a/azurerm/resource_arm_route_test.go +++ b/azurerm/resource_arm_route_test.go @@ -132,7 +132,7 @@ func testCheckAzureRMRouteDisappears(name string) resource.TestCheckFunc { return fmt.Errorf("Error deleting Route %q (Route Table %q / Resource Group %q): %+v", name, rtName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Route %q (Route Table %q / Resource Group %q): %+v", name, rtName, resourceGroup, err) } diff --git a/azurerm/resource_arm_scheduler_job_collection.go b/azurerm/resource_arm_scheduler_job_collection.go index fa9fb1f19545..6beb54466b96 100644 --- a/azurerm/resource_arm_scheduler_job_collection.go +++ b/azurerm/resource_arm_scheduler_job_collection.go @@ -227,7 +227,7 @@ func resourceArmSchedulerJobCollectionDelete(d *schema.ResourceData, meta interf } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if !response.WasNotFound(future.Response()) { return fmt.Errorf("Error waiting for deletion of Scheduler Job Collection %q (Resource Group %q): %+v", name, resourceGroup, err) diff --git a/azurerm/resource_arm_servicebus_namespace.go b/azurerm/resource_arm_servicebus_namespace.go index 2fdb29855bc0..2decd619aab3 100644 --- a/azurerm/resource_arm_servicebus_namespace.go +++ b/azurerm/resource_arm_servicebus_namespace.go @@ -136,7 +136,7 @@ func resourceArmServiceBusNamespaceCreate(d *schema.ResourceData, meta interface return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_servicebus_namespace_test.go b/azurerm/resource_arm_servicebus_namespace_test.go index 8fa6637acfa3..3d681c79d96c 100644 --- a/azurerm/resource_arm_servicebus_namespace_test.go +++ b/azurerm/resource_arm_servicebus_namespace_test.go @@ -53,7 +53,7 @@ func testSweepServiceBusNamespace(region string) error { return err } - err = deleteFuture.WaitForCompletion(ctx, client.Client) + err = deleteFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_snapshot.go b/azurerm/resource_arm_snapshot.go index 1652acdf66a8..8ec20f24c784 100644 --- a/azurerm/resource_arm_snapshot.go +++ b/azurerm/resource_arm_snapshot.go @@ -122,7 +122,7 @@ func resourceArmSnapshotCreateUpdate(d *schema.ResourceData, meta interface{}) e return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -207,7 +207,7 @@ func resourceArmSnapshotDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting Snapshot: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error deleting Snapshot: %+v", err) } diff --git a/azurerm/resource_arm_snapshot_test.go b/azurerm/resource_arm_snapshot_test.go index 4e9d78f944a0..a25ad3326faa 100644 --- a/azurerm/resource_arm_snapshot_test.go +++ b/azurerm/resource_arm_snapshot_test.go @@ -512,7 +512,7 @@ resource "azurerm_virtual_machine" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" delete_os_disk_on_termination = true storage_image_reference { diff --git a/azurerm/resource_arm_sql_administrator.go b/azurerm/resource_arm_sql_administrator.go index d7b9e0fa93a2..24c0d8ac5f47 100644 --- a/azurerm/resource_arm_sql_administrator.go +++ b/azurerm/resource_arm_sql_administrator.go @@ -72,7 +72,7 @@ func resourceArmSqlActiveDirectoryAdministratorCreateUpdate(d *schema.ResourceDa return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_sql_database.go b/azurerm/resource_arm_sql_database.go index e9fcce7881d6..fc5b6f058620 100644 --- a/azurerm/resource_arm_sql_database.go +++ b/azurerm/resource_arm_sql_database.go @@ -294,7 +294,7 @@ func resourceArmSqlDatabaseCreateUpdate(d *schema.ResourceData, meta interface{} return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -314,7 +314,7 @@ func resourceArmSqlDatabaseCreateUpdate(d *schema.ResourceData, meta interface{} // for most imports client.Client.PollingDuration = 60 * time.Minute - err = importFuture.WaitForCompletion(ctx, client.Client) + err = importFuture.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_sql_elasticpool.go b/azurerm/resource_arm_sql_elasticpool.go index bf1e1add7141..4efd0e516def 100644 --- a/azurerm/resource_arm_sql_elasticpool.go +++ b/azurerm/resource_arm_sql_elasticpool.go @@ -102,7 +102,7 @@ func resourceArmSqlElasticPoolCreate(d *schema.ResourceData, meta interface{}) e return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_sql_server.go b/azurerm/resource_arm_sql_server.go index 50805b167db2..343cc672bca8 100644 --- a/azurerm/resource_arm_sql_server.go +++ b/azurerm/resource_arm_sql_server.go @@ -98,7 +98,7 @@ func resourceArmSqlServerCreateUpdate(d *schema.ResourceData, meta interface{}) return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasConflict(future.Response()) { @@ -175,7 +175,7 @@ func resourceArmSqlServerDelete(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error deleting SQL Server %s: %+v", name, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_sql_server_test.go b/azurerm/resource_arm_sql_server_test.go index b9c0cbb45193..bdc9187b1f9c 100644 --- a/azurerm/resource_arm_sql_server_test.go +++ b/azurerm/resource_arm_sql_server_test.go @@ -52,7 +52,7 @@ func testSweepSQLServer(region string) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -208,7 +208,7 @@ func testCheckAzureRMSqlServerDisappears(name string) resource.TestCheckFunc { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_sql_virtual_network_rule.go b/azurerm/resource_arm_sql_virtual_network_rule.go index 6b8be15a7844..8e24f2844c15 100644 --- a/azurerm/resource_arm_sql_virtual_network_rule.go +++ b/azurerm/resource_arm_sql_virtual_network_rule.go @@ -159,7 +159,7 @@ func resourceArmSqlVirtualNetworkRuleDelete(d *schema.ResourceData, meta interfa return fmt.Errorf("Error deleting SQL Virtual Network Rule %q (SQL Server: %q, Resource Group: %q): %+v", name, serverName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { return nil diff --git a/azurerm/resource_arm_sql_virtual_network_rule_test.go b/azurerm/resource_arm_sql_virtual_network_rule_test.go index f278cc522dee..d8659ff07f6a 100644 --- a/azurerm/resource_arm_sql_virtual_network_rule_test.go +++ b/azurerm/resource_arm_sql_virtual_network_rule_test.go @@ -402,7 +402,7 @@ func testCheckAzureRMSqlVirtualNetworkRuleDisappears(name string) resource.TestC return fmt.Errorf("Error deleting SQL Virtual Network Rule: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { //Same deal as before. Just in case. if response.WasNotFound(future.Response()) { diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go index 198c89bc3d9a..b1740bcc0714 100644 --- a/azurerm/resource_arm_storage_account.go +++ b/azurerm/resource_arm_storage_account.go @@ -399,7 +399,7 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error creating Azure Storage Account %q: %+v", storageAccountName, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for Azure Storage Account %q to be created: %+v", storageAccountName, err) } diff --git a/azurerm/resource_arm_storage_share.go b/azurerm/resource_arm_storage_share.go index 865953c8f1b8..9235903091c2 100644 --- a/azurerm/resource_arm_storage_share.go +++ b/azurerm/resource_arm_storage_share.go @@ -4,6 +4,9 @@ import ( "fmt" "log" "regexp" + "strings" + + "github.com/hashicorp/terraform/helper/validation" "github.com/Azure/azure-sdk-for-go/storage" "github.com/hashicorp/terraform/helper/schema" @@ -13,8 +16,13 @@ func resourceArmStorageShare() *schema.Resource { return &schema.Resource{ Create: resourceArmStorageShareCreate, Read: resourceArmStorageShareRead, - Exists: resourceArmStorageShareExists, + Update: resourceArmStorageShareUpdate, Delete: resourceArmStorageShareDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + SchemaVersion: 1, + MigrateState: resourceStorageShareMigrateState, Schema: map[string]*schema.Schema{ "name": { @@ -30,10 +38,10 @@ func resourceArmStorageShare() *schema.Resource { ForceNew: true, }, "quota": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Default: 0, + Type: schema.TypeInt, + Optional: true, + Default: 5120, + ValidateFunc: validation.IntBetween(1, 5120), }, "url": { Type: schema.TypeString, @@ -75,7 +83,7 @@ func resourceArmStorageShareCreate(d *schema.ResourceData, meta interface{}) err } reference.SetProperties(options) - d.SetId(name) + d.SetId(fmt.Sprintf("%s/%s/%s", name, resourceGroupName, storageAccountName)) return resourceArmStorageShareRead(d, meta) } @@ -83,8 +91,13 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error armClient := meta.(*ArmClient) ctx := armClient.StopContext - resourceGroupName := d.Get("resource_group_name").(string) - storageAccountName := d.Get("storage_account_name").(string) + id := strings.Split(d.Id(), "/") + if len(id) != 3 { + return fmt.Errorf("ID was not in the expected format - expected `{name}/{resourceGroup}/{storageAccountName}` got %q", id) + } + name := id[0] + resourceGroupName := id[1] + storageAccountName := id[2] fileClient, accountExists, err := armClient.getFileServiceClientForStorageAccount(ctx, resourceGroupName, storageAccountName) if err != nil { @@ -96,68 +109,77 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error return nil } - exists, err := resourceArmStorageShareExists(d, meta) + reference := fileClient.GetShareReference(name) + exists, err := reference.Exists() if err != nil { - return err + return fmt.Errorf("Error testing existence of share %q: %s", name, err) } if !exists { - // Exists already removed this from state + log.Printf("[INFO] Share %q no longer exists, removing from state...", name) + d.SetId("") return nil } - name := d.Get("name").(string) - - reference := fileClient.GetShareReference(name) url := reference.URL() if url == "" { log.Printf("[INFO] URL for %q is empty", name) } + d.Set("name", name) + d.Set("resource_group_name", resourceGroupName) + d.Set("storage_account_name", storageAccountName) d.Set("url", url) + reference.FetchAttributes(nil) + d.Set("quota", reference.Properties.Quota) + return nil } -func resourceArmStorageShareExists(d *schema.ResourceData, meta interface{}) (bool, error) { +func resourceArmStorageShareUpdate(d *schema.ResourceData, meta interface{}) error { armClient := meta.(*ArmClient) ctx := armClient.StopContext - resourceGroupName := d.Get("resource_group_name").(string) - storageAccountName := d.Get("storage_account_name").(string) + id := strings.Split(d.Id(), "/") + if len(id) != 3 { + return fmt.Errorf("ID was not in the expected format - expected `{name}/{resourceGroup}/{storageAccountName}` got %q", id) + } + name := id[0] + resourceGroupName := id[1] + storageAccountName := id[2] fileClient, accountExists, err := armClient.getFileServiceClientForStorageAccount(ctx, resourceGroupName, storageAccountName) if err != nil { - return false, err + return err } if !accountExists { - log.Printf("[DEBUG] Storage account %q not found, removing share %q from state", storageAccountName, d.Id()) - d.SetId("") - return false, nil + return fmt.Errorf("Storage Account %q Not Found", storageAccountName) } - name := d.Get("name").(string) + options := &storage.FileRequestOptions{} - log.Printf("[INFO] Checking for existence of share %q.", name) reference := fileClient.GetShareReference(name) - exists, err := reference.Exists() - if err != nil { - return false, fmt.Errorf("Error testing existence of share %q: %s", name, err) - } - if !exists { - log.Printf("[INFO] Share %q no longer exists, removing from state...", name) - d.SetId("") + log.Printf("[INFO] Setting share %q properties in storage account %q", name, storageAccountName) + reference.Properties = storage.ShareProperties{ + Quota: d.Get("quota").(int), } + reference.SetProperties(options) - return exists, nil + return resourceArmStorageShareRead(d, meta) } func resourceArmStorageShareDelete(d *schema.ResourceData, meta interface{}) error { armClient := meta.(*ArmClient) ctx := armClient.StopContext - resourceGroupName := d.Get("resource_group_name").(string) - storageAccountName := d.Get("storage_account_name").(string) + id := strings.Split(d.Id(), "/") + if len(id) != 3 { + return fmt.Errorf("ID was not in the expected format - expected `{name}/{resourceGroup}/{storageAccountName}` got %q", id) + } + name := id[0] + resourceGroupName := id[1] + storageAccountName := id[2] fileClient, accountExists, err := armClient.getFileServiceClientForStorageAccount(ctx, resourceGroupName, storageAccountName) if err != nil { @@ -168,8 +190,6 @@ func resourceArmStorageShareDelete(d *schema.ResourceData, meta interface{}) err return nil } - name := d.Get("name").(string) - reference := fileClient.GetShareReference(name) options := &storage.FileRequestOptions{} diff --git a/azurerm/resource_arm_storage_share_migration.go b/azurerm/resource_arm_storage_share_migration.go new file mode 100644 index 000000000000..1c3d0edf040d --- /dev/null +++ b/azurerm/resource_arm_storage_share_migration.go @@ -0,0 +1,39 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/hashicorp/terraform/terraform" +) + +func resourceStorageShareMigrateState( + v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { + switch v { + case 0: + log.Println("[INFO] Found AzureRM Storage Share State v0; migrating to v1") + return migrateStorageShareStateV0toV1(is) + default: + return is, fmt.Errorf("Unexpected schema version: %d", v) + } +} + +func migrateStorageShareStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) { + if is.Empty() { + log.Println("[DEBUG] Empty InstanceState; nothing to migrate.") + return is, nil + } + + log.Printf("[DEBUG] ARM Storage Share Attributes before Migration: %#v", is.Attributes) + + name := is.Attributes["name"] + resourceGroupName := is.Attributes["resource_group_name"] + storageAccountName := is.Attributes["storage_account_name"] + newID := fmt.Sprintf("%s/%s/%s", name, resourceGroupName, storageAccountName) + is.Attributes["id"] = newID + is.ID = newID + + log.Printf("[DEBUG] ARM Storage Share Attributes after State Migration: %#v", is.Attributes) + + return is, nil +} diff --git a/azurerm/resource_arm_storage_share_migration_test.go b/azurerm/resource_arm_storage_share_migration_test.go new file mode 100644 index 000000000000..378ba12030b4 --- /dev/null +++ b/azurerm/resource_arm_storage_share_migration_test.go @@ -0,0 +1,49 @@ +package azurerm + +import ( + "testing" + + "github.com/hashicorp/terraform/terraform" +) + +func TestAzureRMStorageShareMigrateState(t *testing.T) { + cases := map[string]struct { + StateVersion int + ID string + InputAttributes map[string]string + ExpectedAttributes map[string]string + Meta interface{} + }{ + "v0_1": { + StateVersion: 0, + ID: "some_id", + InputAttributes: map[string]string{ + "name": "some_id", + "resource_group_name": "some_rgn", + "storage_account_name": "some_sgn", + }, + ExpectedAttributes: map[string]string{ + "id": "some_id/some_rgn/some_sgn", + }, + }, + } + + for tn, tc := range cases { + is := &terraform.InstanceState{ + ID: tc.ID, + Attributes: tc.InputAttributes, + } + is, err := resourceStorageShareMigrateState(tc.StateVersion, is, tc.Meta) + + if err != nil { + t.Fatalf("bad: %s, err: %#v", tn, err) + } + + for k, v := range tc.ExpectedAttributes { + actual := is.Attributes[k] + if actual != v { + t.Fatalf("Bad Storage Share Migrate for %q: %q\n\n expected: %q", k, actual, v) + } + } + } +} diff --git a/azurerm/resource_arm_storage_share_test.go b/azurerm/resource_arm_storage_share_test.go index 3b227400950f..689d41344841 100644 --- a/azurerm/resource_arm_storage_share_test.go +++ b/azurerm/resource_arm_storage_share_test.go @@ -18,6 +18,7 @@ func TestAccAzureRMStorageShare_basic(t *testing.T) { ri := acctest.RandInt() rs := strings.ToLower(acctest.RandString(11)) config := testAccAzureRMStorageShare_basic(ri, rs, testLocation()) + resourceName := "azurerm_storage_share.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -27,9 +28,14 @@ func TestAccAzureRMStorageShare_basic(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMStorageShareExists("azurerm_storage_share.test", &sS), + testCheckAzureRMStorageShareExists(resourceName, &sS), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } @@ -40,6 +46,7 @@ func TestAccAzureRMStorageShare_disappears(t *testing.T) { ri := acctest.RandInt() rs := strings.ToLower(acctest.RandString(11)) config := testAccAzureRMStorageShare_basic(ri, rs, testLocation()) + resourceName := "azurerm_storage_share.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -49,8 +56,8 @@ func TestAccAzureRMStorageShare_disappears(t *testing.T) { { Config: config, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMStorageShareExists("azurerm_storage_share.test", &sS), - testAccARMStorageShareDisappears("azurerm_storage_share.test", &sS), + testCheckAzureRMStorageShareExists(resourceName, &sS), + testAccARMStorageShareDisappears(resourceName, &sS), ), ExpectNonEmptyPlan: true, }, @@ -58,6 +65,37 @@ func TestAccAzureRMStorageShare_disappears(t *testing.T) { }) } +func TestAccAzureRMStorageShare_updateQuota(t *testing.T) { + var sS storage.Share + + ri := acctest.RandInt() + rs := strings.ToLower(acctest.RandString(11)) + config := testAccAzureRMStorageShare_basic(ri, rs, testLocation()) + config2 := testAccAzureRMStorageShare_updateQuota(ri, rs, testLocation()) + resourceName := "azurerm_storage_share.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMStorageShareDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageShareExists(resourceName, &sS), + ), + }, + { + Config: config2, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMStorageShareExists(resourceName, &sS), + resource.TestCheckResourceAttr(resourceName, "quota", "5"), + ), + }, + }, + }) +} + func testCheckAzureRMStorageShareExists(name string, sS *storage.Share) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -193,6 +231,59 @@ func testCheckAzureRMStorageShareDestroy(s *terraform.State) error { return nil } +func testAccAzureRMStorageShare_basic(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_storage_account" "test" { + name = "acctestacc%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_share" "test" { + name = "testshare" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" +}`, rInt, location, rString) +} + +func testAccAzureRMStorageShare_updateQuota(rInt int, rString string, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_storage_account" "test" { + name = "acctestacc%s" + resource_group_name = "${azurerm_resource_group.test.name}" + location = "${azurerm_resource_group.test.location}" + account_tier = "Standard" + account_replication_type = "LRS" + + tags { + environment = "staging" + } +} + +resource "azurerm_storage_share" "test" { + name = "testshare" + resource_group_name = "${azurerm_resource_group.test.name}" + storage_account_name = "${azurerm_storage_account.test.name}" + quota = 5 +}`, rInt, location, rString) +} + func TestValidateArmStorageShareName(t *testing.T) { validNames := []string{ "valid-name", @@ -221,29 +312,3 @@ func TestValidateArmStorageShareName(t *testing.T) { } } } - -func testAccAzureRMStorageShare_basic(rInt int, rString string, location string) string { - return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" -} - -resource "azurerm_storage_account" "test" { - name = "acctestacc%s" - resource_group_name = "${azurerm_resource_group.test.name}" - location = "${azurerm_resource_group.test.location}" - account_tier = "Standard" - account_replication_type = "LRS" - - tags { - environment = "staging" - } -} - -resource "azurerm_storage_share" "test" { - name = "testshare" - resource_group_name = "${azurerm_resource_group.test.name}" - storage_account_name = "${azurerm_storage_account.test.name}" -}`, rInt, location, rString) -} diff --git a/azurerm/resource_arm_subnet.go b/azurerm/resource_arm_subnet.go index 16bb645dccd4..887ef32a8257 100644 --- a/azurerm/resource_arm_subnet.go +++ b/azurerm/resource_arm_subnet.go @@ -133,7 +133,7 @@ func resourceArmSubnetCreate(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error Creating/Updating Subnet %q (VN %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Subnet %q (VN %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } @@ -247,7 +247,7 @@ func resourceArmSubnetDelete(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Error deleting Subnet %q (VN %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion for Subnet %q (VN %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } diff --git a/azurerm/resource_arm_subnet_test.go b/azurerm/resource_arm_subnet_test.go index 0ca60630f81b..af95e34a828f 100644 --- a/azurerm/resource_arm_subnet_test.go +++ b/azurerm/resource_arm_subnet_test.go @@ -291,7 +291,7 @@ func testCheckAzureRMSubnetDisappears(name string) resource.TestCheckFunc { } } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Subnet %q (Network %q / Resource Group %q): %+v", name, vnetName, resourceGroup, err) } diff --git a/azurerm/resource_arm_template_deployment.go b/azurerm/resource_arm_template_deployment.go index ff57b7086490..f4a662de17f2 100644 --- a/azurerm/resource_arm_template_deployment.go +++ b/azurerm/resource_arm_template_deployment.go @@ -126,7 +126,7 @@ func resourceArmTemplateDeploymentCreate(d *schema.ResourceData, meta interface{ return fmt.Errorf("Error creating deployment: %+v", err) } - err = future.WaitForCompletion(ctx, deployClient.Client) + err = future.WaitForCompletionRef(ctx, deployClient.Client) if err != nil { return fmt.Errorf("Error creating deployment: %+v", err) } diff --git a/azurerm/resource_arm_virtual_machine.go b/azurerm/resource_arm_virtual_machine.go index 1eb3a49999da..f3c554e2c394 100644 --- a/azurerm/resource_arm_virtual_machine.go +++ b/azurerm/resource_arm_virtual_machine.go @@ -8,11 +8,13 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network" "github.com/Azure/azure-sdk-for-go/storage" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" + "golang.org/x/net/context" ) var virtualMachineResourceName = "azurerm_virtual_machine" @@ -637,7 +639,7 @@ func resourceArmVirtualMachineCreate(d *schema.ResourceData, meta interface{}) e return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -652,6 +654,24 @@ func resourceArmVirtualMachineCreate(d *schema.ResourceData, meta interface{}) e d.SetId(*read.ID) + ipAddress, err := determineVirtualMachineIPAddress(ctx, meta, read.VirtualMachineProperties) + if err != nil { + return fmt.Errorf("Error determining IP Address for Virtual Machine %q (Resource Group %q): %+v", name, resGroup, err) + } + + provisionerType := "ssh" + if props := read.VirtualMachineProperties; props != nil { + if profile := props.OsProfile; profile != nil { + if profile.WindowsConfiguration != nil { + provisionerType = "winrm" + } + } + } + d.SetConnInfo(map[string]string{ + "type": provisionerType, + "host": ipAddress, + }) + return resourceArmVirtualMachineRead(d, meta) } @@ -797,7 +817,7 @@ func resourceArmVirtualMachineDelete(d *schema.ResourceData, meta interface{}) e return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -915,7 +935,7 @@ func resourceArmVirtualMachineDeleteManagedDisk(managedDiskID string, meta inter return fmt.Errorf("Error deleting Managed Disk (%s %s) %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error deleting Managed Disk (%s %s) %+v", name, resGroup, err) } @@ -1742,3 +1762,80 @@ func resourceArmVirtualMachineGetManagedDiskInfo(disk *compute.ManagedDiskParame return &diskResp, nil } +func determineVirtualMachineIPAddress(ctx context.Context, meta interface{}, props *compute.VirtualMachineProperties) (string, error) { + nicClient := meta.(*ArmClient).ifaceClient + pipClient := meta.(*ArmClient).publicIPClient + + if props == nil { + return "", nil + } + + var networkInterface *network.Interface + + if profile := props.NetworkProfile; profile != nil { + if nicReferences := profile.NetworkInterfaces; nicReferences != nil { + for _, nicReference := range *nicReferences { + // pick out the primary if multiple NIC's are assigned + if len(*nicReferences) > 1 { + if nicReference.Primary == nil || !*nicReference.Primary { + continue + } + } + + id, err := parseAzureResourceID(*nicReference.ID) + if err != nil { + return "", err + } + + resourceGroup := id.ResourceGroup + name := id.Path["networkInterfaces"] + + nic, err := nicClient.Get(ctx, resourceGroup, name, "") + if err != nil { + return "", fmt.Errorf("Error obtaining NIC %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + networkInterface = &nic + break + } + } + } + + if networkInterface == nil { + return "", fmt.Errorf("A Network Interface wasn't found on the Virtual Machine") + } + + if props := networkInterface.InterfacePropertiesFormat; props != nil { + if configs := props.IPConfigurations; configs != nil { + for _, config := range *configs { + + if config.PublicIPAddress != nil { + id, err := parseAzureResourceID(*config.PublicIPAddress.ID) + if err != nil { + return "", err + } + + resourceGroup := id.ResourceGroup + name := id.Path["publicIPAddresses"] + + pip, err := pipClient.Get(ctx, resourceGroup, name, "") + if err != nil { + return "", fmt.Errorf("Error obtaining Public IP %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + if pipProps := pip.PublicIPAddressPropertiesFormat; props != nil { + if ip := pipProps.IPAddress; ip != nil { + return *ip, nil + } + } + } + + if ip := config.PrivateIPAddress; ip != nil { + return *ip, nil + } + } + } + } + + return "", fmt.Errorf("No Public or Private IP Address found on the Primary Network Interface") +} diff --git a/azurerm/resource_arm_virtual_machine_data_disk_attachment.go b/azurerm/resource_arm_virtual_machine_data_disk_attachment.go index bd440e4d3257..ed4f23494497 100644 --- a/azurerm/resource_arm_virtual_machine_data_disk_attachment.go +++ b/azurerm/resource_arm_virtual_machine_data_disk_attachment.go @@ -159,7 +159,7 @@ func resourceArmVirtualMachineDataDiskAttachmentCreateUpdate(d *schema.ResourceD return fmt.Errorf("Error updating Virtual Machine %q (Resource Group %q) with Disk %q: %+v", virtualMachineName, resourceGroup, name, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for Virtual Machine %q (Resource Group %q) to finish updating Disk %q: %+v", virtualMachineName, resourceGroup, name, err) } @@ -266,7 +266,7 @@ func resourceArmVirtualMachineDataDiskAttachmentDelete(d *schema.ResourceData, m return fmt.Errorf("Error removing Disk %q from Virtual Machine %q (Resource Group %q): %+v", name, virtualMachineName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for Disk %q to be removed from Virtual Machine %q (Resource Group %q): %+v", name, virtualMachineName, resourceGroup, err) } diff --git a/azurerm/resource_arm_virtual_machine_extension.go b/azurerm/resource_arm_virtual_machine_extension.go index d4a72c591ef0..b153743da3dd 100644 --- a/azurerm/resource_arm_virtual_machine_extension.go +++ b/azurerm/resource_arm_virtual_machine_extension.go @@ -124,7 +124,7 @@ func resourceArmVirtualMachineExtensionsCreate(d *schema.ResourceData, meta inte return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -213,7 +213,7 @@ func resourceArmVirtualMachineExtensionsDelete(d *schema.ResourceData, meta inte return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_virtual_machine_extension_test.go b/azurerm/resource_arm_virtual_machine_extension_test.go index 9146032a726f..6e813a717d68 100644 --- a/azurerm/resource_arm_virtual_machine_extension_test.go +++ b/azurerm/resource_arm_virtual_machine_extension_test.go @@ -196,7 +196,7 @@ resource "azurerm_virtual_machine" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" storage_image_reference { publisher = "Canonical" @@ -302,7 +302,7 @@ resource "azurerm_virtual_machine" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" storage_image_reference { publisher = "Canonical" @@ -409,7 +409,7 @@ resource "azurerm_virtual_machine" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" storage_image_reference { publisher = "Canonical" @@ -527,7 +527,7 @@ resource "azurerm_virtual_machine" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" storage_image_reference { publisher = "Canonical" diff --git a/azurerm/resource_arm_virtual_machine_managed_disks_test.go b/azurerm/resource_arm_virtual_machine_managed_disks_test.go index f2ee63e9adfa..b6526e514d7c 100644 --- a/azurerm/resource_arm_virtual_machine_managed_disks_test.go +++ b/azurerm/resource_arm_virtual_machine_managed_disks_test.go @@ -505,7 +505,7 @@ func testCheckAndStopAzureRMVirtualMachine(vm *compute.VirtualMachine) resource. return fmt.Errorf("Failed stopping virtual machine %q: %+v", resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Failed long polling for the stop of virtual machine %q: %+v", resourceGroup, err) } diff --git a/azurerm/resource_arm_virtual_machine_scale_set.go b/azurerm/resource_arm_virtual_machine_scale_set.go index 691df7c925df..a05fffecedec 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set.go +++ b/azurerm/resource_arm_virtual_machine_scale_set.go @@ -746,7 +746,7 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } @@ -922,7 +922,7 @@ func resourceArmVirtualMachineScaleSetDelete(d *schema.ResourceData, meta interf return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return err } diff --git a/azurerm/resource_arm_virtual_machine_scale_set_test.go b/azurerm/resource_arm_virtual_machine_scale_set_test.go index 2ea5bb886c09..2a5af53d980c 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set_test.go +++ b/azurerm/resource_arm_virtual_machine_scale_set_test.go @@ -749,7 +749,7 @@ func testCheckAzureRMVirtualMachineScaleSetDisappears(name string) resource.Test return fmt.Errorf("Bad: Delete on vmScaleSetClient: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Bad: Delete on vmScaleSetClient: %+v", err) } @@ -1849,7 +1849,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Automatic" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = "1" } @@ -1963,7 +1963,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Automatic" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = "1" } @@ -2081,7 +2081,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Automatic" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = "1" } @@ -3530,7 +3530,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Manual" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = 1 } @@ -3625,7 +3625,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Manual" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "standard" capacity = 2 } diff --git a/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go b/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go index efcf1bf1e4b0..c711ba8c7d5f 100644 --- a/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go +++ b/azurerm/resource_arm_virtual_machine_unmanaged_disks_test.go @@ -2983,7 +2983,7 @@ func testCheckAzureRMVirtualMachineDisappears(name string) resource.TestCheckFun return fmt.Errorf("Bad: Delete on vmClient: %+v", err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Bad: Delete on vmClient: %+v", err) } diff --git a/azurerm/resource_arm_virtual_network.go b/azurerm/resource_arm_virtual_network.go index 79197029a9d9..bd180bc5cbc4 100644 --- a/azurerm/resource_arm_virtual_network.go +++ b/azurerm/resource_arm_virtual_network.go @@ -124,7 +124,7 @@ func resourceArmVirtualNetworkCreate(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error Creating/Updating Virtual Network %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Virtual Network %q (Resource Group %q): %+v", name, resGroup, err) } @@ -214,7 +214,7 @@ func resourceArmVirtualNetworkDelete(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error deleting Virtual Network %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Virtual Network %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_virtual_network_gateway.go b/azurerm/resource_arm_virtual_network_gateway.go index 02812398cfec..48c4b3b4a0e4 100644 --- a/azurerm/resource_arm_virtual_network_gateway.go +++ b/azurerm/resource_arm_virtual_network_gateway.go @@ -279,7 +279,7 @@ func resourceArmVirtualNetworkGatewayCreateUpdate(d *schema.ResourceData, meta i return fmt.Errorf("Error Creating/Updating AzureRM Virtual Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of AzureRM Virtual Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } @@ -374,7 +374,7 @@ func resourceArmVirtualNetworkGatewayDelete(d *schema.ResourceData, meta interfa return fmt.Errorf("Error deleting Virtual Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Virtual Network Gateway %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_virtual_network_gateway_connection.go b/azurerm/resource_arm_virtual_network_gateway_connection.go index d63c36473c12..3477d23db1b6 100644 --- a/azurerm/resource_arm_virtual_network_gateway_connection.go +++ b/azurerm/resource_arm_virtual_network_gateway_connection.go @@ -235,7 +235,7 @@ func resourceArmVirtualNetworkGatewayConnectionCreateUpdate(d *schema.ResourceDa return fmt.Errorf("Error Creating/Updating AzureRM Virtual Network Gateway Connection %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Virtual Network Gateway Connection %q (Resource Group %q): %+v", name, resGroup, err) } @@ -346,7 +346,7 @@ func resourceArmVirtualNetworkGatewayConnectionDelete(d *schema.ResourceData, me return fmt.Errorf("Error Deleting Virtual Network Gateway Connection %q (Resource Group %q): %+v", name, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Virtual Network Gateway Connection %q (Resource Group %q): %+v", name, resGroup, err) } diff --git a/azurerm/resource_arm_virtual_network_peering.go b/azurerm/resource_arm_virtual_network_peering.go index 423ecac325f7..d9be5c3592be 100644 --- a/azurerm/resource_arm_virtual_network_peering.go +++ b/azurerm/resource_arm_virtual_network_peering.go @@ -95,7 +95,7 @@ func resourceArmVirtualNetworkPeeringCreate(d *schema.ResourceData, meta interfa return fmt.Errorf("Error Creating/Updating Virtual Network Peering %q (Network %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for completion of Virtual Network Peering %q (Network %q / Resource Group %q): %+v", name, vnetName, resGroup, err) } @@ -169,7 +169,7 @@ func resourceArmVirtualNetworkPeeringDelete(d *schema.ResourceData, meta interfa return fmt.Errorf("Error deleting Virtual Network Peering %q (Network %q / RG %q): %+v", name, vnetName, resGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Virtual Network Peering %q (Network %q / RG %q): %+v", name, vnetName, resGroup, err) } diff --git a/azurerm/resource_arm_virtual_network_peering_test.go b/azurerm/resource_arm_virtual_network_peering_test.go index 1d210ce0af24..fa68344d1504 100644 --- a/azurerm/resource_arm_virtual_network_peering_test.go +++ b/azurerm/resource_arm_virtual_network_peering_test.go @@ -158,7 +158,7 @@ func testCheckAzureRMVirtualNetworkPeeringDisappears(name string) resource.TestC return fmt.Errorf("Error deleting Peering %q (NW %q / RG %q): %+v", name, vnetName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Peering %q (NW %q / RG %q): %+v", name, vnetName, resourceGroup, err) } diff --git a/azurerm/resource_arm_virtual_network_test.go b/azurerm/resource_arm_virtual_network_test.go index c971b785cc8a..6dadede5c00b 100644 --- a/azurerm/resource_arm_virtual_network_test.go +++ b/azurerm/resource_arm_virtual_network_test.go @@ -65,7 +65,7 @@ func testSweepVirtualNetworks(region string) error { return err } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { if response.WasNotFound(future.Response()) { continue @@ -231,7 +231,7 @@ func testCheckAzureRMVirtualNetworkDisappears(name string) resource.TestCheckFun return fmt.Errorf("Error deleting Virtual Network %q (RG %q): %+v", virtualNetworkName, resourceGroup, err) } - err = future.WaitForCompletion(ctx, client.Client) + err = future.WaitForCompletionRef(ctx, client.Client) if err != nil { return fmt.Errorf("Error waiting for deletion of Virtual Network %q (RG %q): %+v", virtualNetworkName, resourceGroup, err) } diff --git a/examples/encrypt-running-linux-vm/variables.tf b/examples/encrypt-running-linux-vm/variables.tf index cce0baaa3b69..769da452c34d 100644 --- a/examples/encrypt-running-linux-vm/variables.tf +++ b/examples/encrypt-running-linux-vm/variables.tf @@ -33,7 +33,7 @@ variable "storage_replication_type" { variable "vm_size" { description = "Specifies the size of the virtual machine. This must be the same as the vm image from which you are copying." - default = "Standard_A0" + default = "Standard_F2" } variable "image_publisher" { diff --git a/examples/freebsd-jumpbox/variables.tf b/examples/freebsd-jumpbox/variables.tf index d301a2a91fdf..1e27ebc03fa2 100644 --- a/examples/freebsd-jumpbox/variables.tf +++ b/examples/freebsd-jumpbox/variables.tf @@ -52,7 +52,7 @@ variable "storage_replication_type" { variable "vm_size" { description = "Specifies the size of the virtual machine." - default = "Standard_A0" + default = "Standard_F2" } variable "image_publisher" { diff --git a/examples/vm-simple-linux-managed-disk/variables.tf b/examples/vm-simple-linux-managed-disk/variables.tf index 608c67db1986..97bed49dac11 100644 --- a/examples/vm-simple-linux-managed-disk/variables.tf +++ b/examples/vm-simple-linux-managed-disk/variables.tf @@ -47,7 +47,7 @@ variable "storage_replication_type" { variable "vm_size" { description = "Specifies the size of the virtual machine." - default = "Standard_A0" + default = "Standard_F2" } variable "image_publisher" { diff --git a/website/docs/d/kubernetes_cluster.html.markdown b/website/docs/d/kubernetes_cluster.html.markdown index 593ceb8ddcd4..fe538fe2846c 100644 --- a/website/docs/d/kubernetes_cluster.html.markdown +++ b/website/docs/d/kubernetes_cluster.html.markdown @@ -41,6 +41,8 @@ The following attributes are exported: * `kube_config_raw` - Base64 encoded Kubernetes configuration. +* `node_resource_group` - Auto-generated Resource Group containing AKS Cluster resources. + * `kube_config` - A `kube_config` block as defined below. * `location` - The Azure Region in which the managed Kubernetes Cluster exists. diff --git a/website/docs/d/network_interface.html.markdown b/website/docs/d/network_interface.html.markdown index 39923270f51c..8fe5e44b1d21 100644 --- a/website/docs/d/network_interface.html.markdown +++ b/website/docs/d/network_interface.html.markdown @@ -54,7 +54,7 @@ A `ip_configuration` block contains: * `name` - The name of the IP Configuration. * `subnet_id` - The ID of the Subnet which the Network Interface is connected to. * `private_ip_address` - The Private IP Address assigned to this Network Interface. -* `private_ip_address_allocation` - The IP Address allocation type for the Private address, such as `Dynamic` or `Standard`. +* `private_ip_address_allocation` - The IP Address allocation type for the Private address, such as `Dynamic` or `Static`. * `public_ip_address_id` - The ID of the Public IP Address which is connected to this Network Interface. * `application_gateway_backend_address_pools_ids` - A list of Backend Address Pool ID's within a Application Gateway that this Network Interface is connected to. * `load_balancer_backend_address_pools_ids` - A list of Backend Address Pool ID's within a Load Balancer that this Network Interface is connected to. diff --git a/website/docs/r/container_group.html.markdown b/website/docs/r/container_group.html.markdown index d95fd25e7cf4..8c6be69ca702 100644 --- a/website/docs/r/container_group.html.markdown +++ b/website/docs/r/container_group.html.markdown @@ -154,3 +154,11 @@ The following attributes are exported: * `ip_address` - The IP address allocated to the container group. * `fqdn` - The FQDN of the container group derived from `dns_name_label`. + +## Import + +Container Group's can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_container_group.containerGroup1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup1 +``` diff --git a/website/docs/r/container_service.html.markdown b/website/docs/r/container_service.html.markdown index 26c6bec3da54..f417c61bb1fe 100644 --- a/website/docs/r/container_service.html.markdown +++ b/website/docs/r/container_service.html.markdown @@ -44,7 +44,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent1" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } diagnostics_profile { @@ -88,7 +88,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent1" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } service_principal { @@ -137,7 +137,7 @@ resource "azurerm_container_service" "test" { name = "default" count = 1 dns_prefix = "acctestagent1" - vm_size = "Standard_A0" + vm_size = "Standard_F2" } diagnostics_profile { diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 124850b5fd1a..7f590df5b58f 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -267,6 +267,8 @@ The following attributes are exported: * `fqdn` - The FQDN of the Azure Kubernetes Managed Cluster. +* `node_resource_group` - Auto-generated Resource Group containing AKS Cluster resources. + * `kube_config_raw` - Base64 encoded Kubernetes configuration * `kube_config` - Kubernetes configuration, sub-attributes defined below: diff --git a/website/docs/r/storage_share.html.markdown b/website/docs/r/storage_share.html.markdown index 4e56c6252a0a..df36082dfcb1 100644 --- a/website/docs/r/storage_share.html.markdown +++ b/website/docs/r/storage_share.html.markdown @@ -48,7 +48,7 @@ The following arguments are supported: * `storage_account_name` - (Required) Specifies the storage account in which to create the share. Changing this forces a new resource to be created. -* `quota` - (Optional) The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5 TB (5120 GB). Default is 0, which results in setting the quota to 5 TB. +* `quota` - (Optional) The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5 TB (5120 GB). Default is 5120. ## Attributes Reference @@ -57,3 +57,13 @@ The following attributes are exported in addition to the arguments listed above: * `id` - The storage share Resource ID. * `url` - The URL of the share + +## Import + +Storage Shares can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_storage_share.testShare storageShareName/resourceGroupName/storageAccoutName +``` + +-> **NOTE:** This identifier is unique to Terraform diff --git a/website/docs/r/virtual_machine_extension.html.markdown b/website/docs/r/virtual_machine_extension.html.markdown index 796f9554e336..84d7e698def5 100644 --- a/website/docs/r/virtual_machine_extension.html.markdown +++ b/website/docs/r/virtual_machine_extension.html.markdown @@ -12,7 +12,9 @@ description: |- Manages a Virtual Machine Extension to provide post deployment configuration and run automated tasks. -~> **Please Note:** The CustomScript extensions for Linux & Windows require that the `commandToExecute` returns a `0` exit code to be classified as successfully deployed. You can achieve this by appending `exit 0` to the end of your `commandToExecute`. +~> **NOTE:** Custom Script Extensions for Linux & Windows require that the `commandToExecute` returns a `0` exit code to be classified as successfully deployed. You can achieve this by appending `exit 0` to the end of your `commandToExecute`. + +-> **NOTE:** Custom Script Extensions require that the Azure Virtual Machine Guest Agent is running on the Virtual Machine. ## Example Usage @@ -25,7 +27,7 @@ resource "azurerm_resource_group" "test" { resource "azurerm_virtual_network" "test" { name = "acctvn" address_space = ["10.0.0.0/16"] - location = "West US" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } @@ -38,7 +40,7 @@ resource "azurerm_subnet" "test" { resource "azurerm_network_interface" "test" { name = "acctni" - location = "West US" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" ip_configuration { @@ -51,7 +53,7 @@ resource "azurerm_network_interface" "test" { resource "azurerm_storage_account" "test" { name = "accsa" resource_group_name = "${azurerm_resource_group.test.name}" - location = "westus" + location = "${azurerm_resource_group.test.location}" account_tier = "Standard" account_replication_type = "LRS" @@ -69,10 +71,10 @@ resource "azurerm_storage_container" "test" { resource "azurerm_virtual_machine" "test" { name = "acctvm" - location = "West US" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" network_interface_ids = ["${azurerm_network_interface.test.id}"] - vm_size = "Standard_A0" + vm_size = "Standard_F2" storage_image_reference { publisher = "Canonical" @@ -105,7 +107,7 @@ resource "azurerm_virtual_machine" "test" { resource "azurerm_virtual_machine_extension" "test" { name = "hostname" - location = "West US" + location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" virtual_machine_name = "${azurerm_virtual_machine.test.name}" publisher = "Microsoft.Azure.Extensions" diff --git a/website/docs/r/virtual_machine_scale_set.html.markdown b/website/docs/r/virtual_machine_scale_set.html.markdown index df3c18508924..22c9bab57216 100644 --- a/website/docs/r/virtual_machine_scale_set.html.markdown +++ b/website/docs/r/virtual_machine_scale_set.html.markdown @@ -83,7 +83,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Manual" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = 2 } @@ -190,7 +190,7 @@ resource "azurerm_virtual_machine_scale_set" "test" { upgrade_policy_mode = "Manual" sku { - name = "Standard_A0" + name = "Standard_F2" tier = "Standard" capacity = 2 }