Merge pull request #9073 from carinadigital/GH-9072

provider/azurerm: set resource_group_name on resource import
This commit is contained in:
Paul Stack 2016-10-07 13:29:08 +01:00 committed by GitHub
commit 250be11fdd
57 changed files with 185 additions and 165 deletions

View File

@ -28,8 +28,6 @@ func TestAccAzureRMAvailabilitySet_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
//this isn't returned from the API!
},
},
})

View File

@ -27,7 +27,6 @@ func TestAccAzureRMDnsZone_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -22,8 +22,6 @@ func TestAccAzureRMLocalNetworkGateway_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
//this isn't returned from the API!
},
},
})

View File

@ -22,7 +22,6 @@ func TestAccAzureRMNetworkSecurityGroup_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -22,7 +22,7 @@ func TestAccAzureRMNetworkSecurityRule_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name", "network_security_group_name"},
ImportStateVerifyIgnore: []string{"network_security_group_name"},
},
},
})

View File

@ -27,7 +27,6 @@ func TestAccAzureRMPublicIpStatic_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -27,7 +27,7 @@ func TestAccAzureRMSqlFirewallRule_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name", "server_name"},
ImportStateVerifyIgnore: []string{"server_name"},
},
},
})

View File

@ -29,7 +29,6 @@ func TestAccAzureRMStorageAccount_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -27,9 +27,6 @@ func TestAccAzureRMTrafficManagerEndpoint_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"resource_group_name",
},
},
},
})

View File

@ -27,7 +27,6 @@ func TestAccAzureRMTrafficManagerProfile_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -27,7 +27,6 @@ func TestAccAzureRMVirtualNetworkPeering_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -27,7 +27,6 @@ func TestAccAzureRMVirtualNetwork_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"resource_group_name"},
},
},
})

View File

@ -237,3 +237,9 @@ func azureStateRefreshFunc(resourceURI string, client *ArmClient, command rivier
panic(fmt.Errorf("azureStateRefreshFunc called on structure %T with no mapstructure:provisioningState tag. This is a bug", res.Parsed))
}
}
// Resource group names can be capitalised, but we store them in lowercase.
// Use a custom diff function to avoid creation of new resources.
func resourceAzurermResourceGroupNameDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
return strings.ToLower(old) == strings.ToLower(new)
}

View File

@ -126,6 +126,7 @@ func resourceArmAvailabilitySetRead(d *schema.ResourceData, meta interface{}) er
}
availSet := *resp.Properties
d.Set("resource_group_name", resGroup)
d.Set("platform_update_domain_count", availSet.PlatformUpdateDomainCount)
d.Set("platform_fault_domain_count", availSet.PlatformFaultDomainCount)
d.Set("name", resp.Name)

View File

@ -203,7 +203,7 @@ func testCheckAzureRMAvailabilitySetDestroy(s *terraform.State) error {
var testAccAzureRMVAvailabilitySet_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_availability_set" "test" {
@ -215,7 +215,7 @@ resource "azurerm_availability_set" "test" {
var testAccAzureRMVAvailabilitySet_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_availability_set" "test" {
@ -232,7 +232,7 @@ resource "azurerm_availability_set" "test" {
var testAccAzureRMVAvailabilitySet_withUpdatedTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_availability_set" "test" {
@ -248,7 +248,7 @@ resource "azurerm_availability_set" "test" {
var testAccAzureRMVAvailabilitySet_withDomainCounts = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_availability_set" "test" {

View File

@ -171,7 +171,7 @@ func testCheckAzureRMCdnEndpointDestroy(s *terraform.State) error {
var testAccAzureRMCdnEndpoint_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {
@ -198,7 +198,7 @@ resource "azurerm_cdn_endpoint" "test" {
var testAccAzureRMCdnEndpoint_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {
@ -230,7 +230,7 @@ resource "azurerm_cdn_endpoint" "test" {
var testAccAzureRMCdnEndpoint_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {

View File

@ -164,7 +164,7 @@ func testCheckAzureRMCdnProfileDestroy(s *terraform.State) error {
var testAccAzureRMCdnProfile_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {
@ -177,7 +177,7 @@ resource "azurerm_cdn_profile" "test" {
var testAccAzureRMCdnProfile_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {
@ -195,7 +195,7 @@ resource "azurerm_cdn_profile" "test" {
var testAccAzureRMCdnProfile_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_cdn_profile" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsARecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsARecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -161,7 +161,7 @@ resource "azurerm_dns_a_record" "test" {
var testAccAzureRMDnsARecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -180,7 +180,7 @@ resource "azurerm_dns_a_record" "test" {
var testAccAzureRMDnsARecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -204,7 +204,7 @@ resource "azurerm_dns_a_record" "test" {
var testAccAzureRMDnsARecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsAAAARecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsAAAARecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -161,7 +161,7 @@ resource "azurerm_dns_aaaa_record" "test" {
var testAccAzureRMDnsAAAARecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -180,7 +180,7 @@ resource "azurerm_dns_aaaa_record" "test" {
var testAccAzureRMDnsAAAARecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -204,7 +204,7 @@ resource "azurerm_dns_aaaa_record" "test" {
var testAccAzureRMDnsAAAARecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -159,7 +159,7 @@ func testCheckAzureRMDnsCNameRecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsCNameRecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -178,7 +178,7 @@ resource "azurerm_dns_cname_record" "test" {
var testAccAzureRMDnsCNameRecord_subdomain = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -197,7 +197,7 @@ resource "azurerm_dns_cname_record" "test" {
var testAccAzureRMDnsCNameRecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -216,7 +216,7 @@ resource "azurerm_dns_cname_record" "test" {
var testAccAzureRMDnsCNameRecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -240,7 +240,7 @@ resource "azurerm_dns_cname_record" "test" {
var testAccAzureRMDnsCNameRecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsMxRecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsMxRecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -170,7 +170,7 @@ resource "azurerm_dns_mx_record" "test" {
var testAccAzureRMDnsMxRecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -203,7 +203,7 @@ resource "azurerm_dns_mx_record" "test" {
var testAccAzureRMDnsMxRecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -236,7 +236,7 @@ resource "azurerm_dns_mx_record" "test" {
var testAccAzureRMDnsMxRecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsNsRecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsNsRecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -168,7 +168,7 @@ resource "azurerm_dns_ns_record" "test" {
var testAccAzureRMDnsNsRecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -198,7 +198,7 @@ resource "azurerm_dns_ns_record" "test" {
var testAccAzureRMDnsNsRecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -229,7 +229,7 @@ resource "azurerm_dns_ns_record" "test" {
var testAccAzureRMDnsNsRecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsSrvRecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsSrvRecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -174,7 +174,7 @@ resource "azurerm_dns_srv_record" "test" {
var testAccAzureRMDnsSrvRecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -213,7 +213,7 @@ resource "azurerm_dns_srv_record" "test" {
var testAccAzureRMDnsSrvRecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -250,7 +250,7 @@ resource "azurerm_dns_srv_record" "test" {
var testAccAzureRMDnsSrvRecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -142,7 +142,7 @@ func testCheckAzureRMDnsTxtRecordDestroy(s *terraform.State) error {
var testAccAzureRMDnsTxtRecord_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -168,7 +168,7 @@ resource "azurerm_dns_txt_record" "test" {
var testAccAzureRMDnsTxtRecord_updateRecords = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -198,7 +198,7 @@ resource "azurerm_dns_txt_record" "test" {
var testAccAzureRMDnsTxtRecord_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {
@ -229,7 +229,7 @@ resource "azurerm_dns_txt_record" "test" {
var testAccAzureRMDnsTxtRecord_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -29,6 +29,7 @@ func resourceArmDnsZone() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: resourceAzurermResourceGroupNameDiffSuppress,
},
"number_of_record_sets": &schema.Schema{
@ -96,6 +97,12 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
rivieraClient := client.rivieraClient
id, err := parseAzureResourceID(d.Id())
if err != nil {
return err
}
resGroup := id.ResourceGroup
readRequest := rivieraClient.NewRequestForURI(d.Id())
readRequest.Command = &dns.GetDNSZone{}
@ -111,6 +118,7 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
resp := readResponse.Parsed.(*dns.GetDNSZoneResponse)
d.Set("resource_group_name", resGroup)
d.Set("number_of_record_sets", resp.NumberOfRecordSets)
d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets)
d.Set("name", resp.Name)

View File

@ -80,7 +80,7 @@ func testCheckAzureRMDnsZoneDestroy(s *terraform.State) error {
var testAccAzureRMDnsZone_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_dns_zone" "test" {

View File

@ -117,6 +117,7 @@ func resourceArmLocalNetworkGatewayRead(d *schema.ResourceData, meta interface{}
return fmt.Errorf("Error reading the state of Azure ARM local network gateway '%s': %s", name, err)
}
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("location", resp.Location)
d.Set("gateway_address", resp.Properties.GatewayIPAddress)

View File

@ -203,6 +203,7 @@ func resourceArmNetworkSecurityGroupRead(d *schema.ResourceData, meta interface{
d.Set("security_rule", flattenNetworkSecurityRules(resp.Properties.SecurityRules))
}
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("location", resp.Location)
flattenAndSetTags(d, resp.Tags)

View File

@ -183,6 +183,7 @@ func resourceArmNetworkSecurityRuleRead(d *schema.ResourceData, meta interface{}
return fmt.Errorf("Error making Read request on Azure Network Security Rule %s: %s", sgRuleName, err)
}
d.Set("resource_group_name", resGroup)
d.Set("access", resp.Properties.Access)
d.Set("destination_address_prefix", resp.Properties.DestinationAddressPrefix)
d.Set("destination_port_range", resp.Properties.DestinationPortRange)

View File

@ -173,6 +173,7 @@ func resourceArmPublicIpRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error making Read request on Azure public ip %s: %s", name, err)
}
d.Set("resource_group_name", resGroup)
d.Set("location", resp.Location)
d.Set("name", resp.Name)
d.Set("public_ip_address_allocation", strings.ToLower(string(resp.Properties.PublicIPAllocationMethod)))

View File

@ -314,7 +314,7 @@ func testCheckAzureRMPublicIpDestroy(s *terraform.State) error {
var testAccAzureRMVPublicIpStatic_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {
@ -327,7 +327,7 @@ resource "azurerm_public_ip" "test" {
var testAccAzureRMVPublicIpStatic_update = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {
@ -341,7 +341,7 @@ resource "azurerm_public_ip" "test" {
var testAccAzureRMVPublicIpStatic_idleTimeout = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {
@ -355,7 +355,7 @@ resource "azurerm_public_ip" "test" {
var testAccAzureRMVPublicIpDynamic_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {
@ -368,7 +368,7 @@ resource "azurerm_public_ip" "test" {
var testAccAzureRMVPublicIpStatic_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {
@ -386,7 +386,7 @@ resource "azurerm_public_ip" "test" {
var testAccAzureRMVPublicIpStatic_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_public_ip" "test" {

View File

@ -160,14 +160,14 @@ func testCheckAzureRMResourceGroupDestroy(s *terraform.State) error {
var testAccAzureRMResourceGroup_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
`
var testAccAzureRMResourceGroup_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
tags {
@ -179,7 +179,7 @@ resource "azurerm_resource_group" "test" {
var testAccAzureRMResourceGroup_withTagsUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
tags {

View File

@ -251,7 +251,7 @@ func testCheckAzureRMRouteTableDestroy(s *terraform.State) error {
var testAccAzureRMRouteTable_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -270,7 +270,7 @@ resource "azurerm_route_table" "test" {
var testAccAzureRMRouteTable_multipleRoutes = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -295,7 +295,7 @@ resource "azurerm_route_table" "test" {
var testAccAzureRMRouteTable_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -319,7 +319,7 @@ resource "azurerm_route_table" "test" {
var testAccAzureRMRouteTable_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -164,7 +164,7 @@ func testCheckAzureRMRouteDestroy(s *terraform.State) error {
var testAccAzureRMRoute_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -186,7 +186,7 @@ resource "azurerm_route" "test" {
var testAccAzureRMRoute_multipleRoutes = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -117,7 +117,7 @@ func testCheckAzureRMSearchServiceDestroy(s *terraform.State) error {
var testAccAzureRMSearchService_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_search_service" "test" {
@ -135,7 +135,7 @@ resource "azurerm_search_service" "test" {
var testAccAzureRMSearchService_updated = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_search_service" "test" {

View File

@ -178,7 +178,7 @@ func testCheckAzureRMServiceBusNamespaceExists(name string) resource.TestCheckFu
var testAccAzureRMServiceBusNamespace_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_servicebus_namespace" "test" {

View File

@ -165,7 +165,7 @@ func testCheckAzureRMSqlDatabaseDestroy(s *terraform.State) error {
var testAccAzureRMSqlDatabase_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
@ -191,7 +191,7 @@ resource "azurerm_sql_database" "test" {
var testAccAzureRMSqlDatabase_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
@ -222,7 +222,7 @@ resource "azurerm_sql_database" "test" {
var testAccAzureRMSqlDatabase_withTagsUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {

View File

@ -94,6 +94,12 @@ func resourceArmSqlFirewallRuleCreate(d *schema.ResourceData, meta interface{})
}
func resourceArmSqlFirewallRuleRead(d *schema.ResourceData, meta interface{}) error {
id, err := parseAzureResourceID(d.Id())
if err != nil {
return err
}
resGroup := id.ResourceGroup
client := meta.(*ArmClient)
rivieraClient := client.rivieraClient
@ -112,6 +118,7 @@ func resourceArmSqlFirewallRuleRead(d *schema.ResourceData, meta interface{}) er
resp := readResponse.Parsed.(*sql.GetFirewallRuleResponse)
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("start_ip_address", resp.StartIPAddress)
d.Set("end_ip_address", resp.EndIPAddress)

View File

@ -92,7 +92,7 @@ func testCheckAzureRMSqlFirewallRuleDestroy(s *terraform.State) error {
var testAccAzureRMSqlFirewallRule_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
@ -115,7 +115,7 @@ resource "azurerm_sql_firewall_rule" "test" {
var testAccAzureRMSqlFirewallRule_withUpdates = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {

View File

@ -111,7 +111,7 @@ func testCheckAzureRMSqlServerDestroy(s *terraform.State) error {
var testAccAzureRMSqlServer_basic = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
@ -126,7 +126,7 @@ resource "azurerm_sql_server" "test" {
var testAccAzureRMSqlServer_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
@ -146,7 +146,7 @@ resource "azurerm_sql_server" "test" {
var testAccAzureRMSqlServer_withTagsUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctest_rg_%d"
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {

View File

@ -40,6 +40,7 @@ func resourceArmStorageAccount() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: resourceAzurermResourceGroupNameDiffSuppress,
},
"location": {
@ -312,6 +313,7 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err
}
accessKeys := *keys.Keys
d.Set("resource_group_name", resGroup)
d.Set("primary_access_key", accessKeys[0].Value)
d.Set("secondary_access_key", accessKeys[1].Value)
d.Set("location", resp.Location)

View File

@ -482,7 +482,7 @@ func testCheckAzureRMStorageBlobDestroy(s *terraform.State) error {
var testAccAzureRMStorageBlob_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}
@ -518,7 +518,7 @@ resource "azurerm_storage_blob" "test" {
var testAccAzureRMStorageBlobBlock_source = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}
@ -556,7 +556,7 @@ resource "azurerm_storage_blob" "source" {
var testAccAzureRMStorageBlobPage_source = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}
@ -594,7 +594,7 @@ resource "azurerm_storage_blob" "source" {
var testAccAzureRMStorageBlob_source_uri = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}

View File

@ -217,7 +217,7 @@ func TestValidateArmStorageContainerName(t *testing.T) {
var testAccAzureRMStorageContainer_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}

View File

@ -145,7 +145,7 @@ func testCheckAzureRMStorageQueueDestroy(s *terraform.State) error {
var testAccAzureRMStorageQueue_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}

View File

@ -214,7 +214,7 @@ func TestValidateArmStorageTableName(t *testing.T) {
var testAccAzureRMStorageTable_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "westus"
}

View File

@ -136,7 +136,7 @@ func testCheckAzureRMSubnetDestroy(s *terraform.State) error {
var testAccAzureRMSubnet_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -165,7 +165,7 @@ func testCheckAzureRMTemplateDeploymentDestroy(s *terraform.State) error {
var testAccAzureRMTemplateDeployment_basicExample = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -230,7 +230,7 @@ DEPLOY
var testAccAzureRMTemplateDeployment_withParams = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -315,7 +315,7 @@ DEPLOY
// StorageAccount name is too long, forces error
var testAccAzureRMTemplateDeployment_withError = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -89,6 +89,7 @@ func resourceArmTrafficManagerEndpoint() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: resourceAzurermResourceGroupNameDiffSuppress,
},
},
}
@ -162,6 +163,7 @@ func resourceArmTrafficManagerEndpointRead(d *schema.ResourceData, meta interfac
endpoint := *resp.Properties
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("type", endpointType)
d.Set("profile_name", profileName)

View File

@ -263,7 +263,7 @@ func testCheckAzureRMTrafficManagerEndpointDestroy(s *terraform.State) error {
var testAccAzureRMTrafficManagerEndpoint_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -313,7 +313,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternal" {
var testAccAzureRMTrafficManagerEndpoint_basicDisableExternal = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -364,7 +364,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternal" {
var testAccAzureRMTrafficManagerEndpoint_weight = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -406,7 +406,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
var testAccAzureRMTrafficManagerEndpoint_updateWeight = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -448,7 +448,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
var testAccAzureRMTrafficManagerEndpoint_priority = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -490,7 +490,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
var testAccAzureRMTrafficManagerEndpoint_updatePriority = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -532,7 +532,7 @@ resource "azurerm_traffic_manager_endpoint" "testExternalNew" {
var testAccAzureRMTrafficManagerEndpoint_nestedEndpoints = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -96,6 +96,7 @@ func resourceArmTrafficManagerProfile() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: resourceAzurermResourceGroupNameDiffSuppress,
},
"tags": tagsSchema(),
@ -161,6 +162,7 @@ func resourceArmTrafficManagerProfileRead(d *schema.ResourceData, meta interface
profile := *resp.Properties
// update appropriate values
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("profile_status", profile.ProfileStatus)
d.Set("traffic_routing_method", profile.TrafficRoutingMethod)

View File

@ -175,7 +175,7 @@ func testCheckAzureRMTrafficManagerProfileDestroy(s *terraform.State) error {
var testAccAzureRMTrafficManagerProfile_weighted = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -199,7 +199,7 @@ resource "azurerm_traffic_manager_profile" "test" {
var testAccAzureRMTrafficManagerProfile_performance = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -223,7 +223,7 @@ resource "azurerm_traffic_manager_profile" "test" {
var testAccAzureRMTrafficManagerProfile_priority = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -247,7 +247,7 @@ resource "azurerm_traffic_manager_profile" "test" {
var testAccAzureRMTrafficManagerProfile_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -276,7 +276,7 @@ resource "azurerm_traffic_manager_profile" "test" {
var testAccAzureRMTrafficManagerProfile_withTagsUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -148,7 +148,7 @@ func testCheckAzureRMVirtualMachineScaleSetDestroy(s *terraform.State) error {
var testAccAzureRMVirtualMachineScaleSet_basicLinux = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -241,7 +241,7 @@ resource "azurerm_virtual_machine_scale_set" "test" {
var testAccAzureRMVirtualMachineScaleSet_basicWindows = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -457,7 +457,7 @@ func testCheckAzureRMVirtualMachineDisappears(name string, vm *compute.VirtualMa
var testAccAzureRMVirtualMachine_basicLinuxMachine = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -545,7 +545,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_machineNameBeforeUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -634,7 +634,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_basicLinuxMachineDestroyDisks = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -734,7 +734,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_basicLinuxMachineDeleteVM = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -785,7 +785,7 @@ resource "azurerm_storage_container" "test" {
var testAccAzureRMVirtualMachine_withDataDisk = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -881,7 +881,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_basicLinuxMachineUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -968,7 +968,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_updatedLinuxMachine = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1051,7 +1051,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_basicWindowsMachine = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1135,7 +1135,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_windowsUnattendedConfig = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1225,7 +1225,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_diagnosticsProfile = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1311,7 +1311,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_winRMConfig = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1396,7 +1396,7 @@ resource "azurerm_virtual_machine" "test" {
var testAccAzureRMVirtualMachine_withAvailabilitySet = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1487,7 +1487,7 @@ var testAccAzureRMVirtualMachine_withAvailabilitySet = `
var testAccAzureRMVirtualMachine_updateAvailabilitySet = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -1578,7 +1578,7 @@ var testAccAzureRMVirtualMachine_updateAvailabilitySet = `
var testAccAzureRMVirtualMachine_updateMachineName = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -143,6 +143,7 @@ func resourceArmVirtualNetworkRead(d *schema.ResourceData, meta interface{}) err
vnet := *resp.Properties
// update appropriate values
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("location", resp.Location)
d.Set("address_space", vnet.AddressSpace.AddressPrefixes)

View File

@ -134,6 +134,7 @@ func resourceArmVirtualNetworkPeeringRead(d *schema.ResourceData, meta interface
peer := *resp.Properties
// update appropriate values
d.Set("resource_group_name", resGroup)
d.Set("name", resp.Name)
d.Set("virtual_network_name", vnetName)
d.Set("allow_virtual_network_access", peer.AllowVirtualNetworkAccess)

View File

@ -190,7 +190,7 @@ func testCheckAzureRMVirtualNetworkPeeringDestroy(s *terraform.State) error {
var testAccAzureRMVirtualNetworkPeering_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -227,7 +227,7 @@ resource "azurerm_virtual_network_peering" "test2" {
var testAccAzureRMVirtualNetworkPeering_basicUpdate = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}

View File

@ -173,7 +173,7 @@ func testCheckAzureRMVirtualNetworkDestroy(s *terraform.State) error {
var testAccAzureRMVirtualNetwork_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -192,7 +192,7 @@ resource "azurerm_virtual_network" "test" {
var testAccAzureRMVirtualNetwork_withTags = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}
@ -216,7 +216,7 @@ resource "azurerm_virtual_network" "test" {
var testAccAzureRMVirtualNetwork_withTagsUpdated = `
resource "azurerm_resource_group" "test" {
name = "acctestrg-%d"
name = "acctestRG-%d"
location = "West US"
}