provider/aws: Rename zone_id to hosted_zone_id in aws_db_instance

Also added a test to prove that the computed value gets set

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSDBInstance_basic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/11/10 06:26:22 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSDBInstance_basic -timeout 120m
=== RUN   TestAccAWSDBInstance_basic
--- PASS: TestAccAWSDBInstance_basic (634.33s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws634.347s
```
This commit is contained in:
stack72 2016-11-10 06:41:43 +00:00
parent 58412762eb
commit e02960810d
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 3 additions and 2 deletions

View File

@ -236,7 +236,7 @@ func resourceAwsDbInstance() *schema.Resource {
Computed: true, Computed: true,
}, },
"zone_id": &schema.Schema{ "hosted_zone_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
@ -674,7 +674,7 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
if v.Endpoint != nil { if v.Endpoint != nil {
d.Set("port", v.Endpoint.Port) d.Set("port", v.Endpoint.Port)
d.Set("address", v.Endpoint.Address) d.Set("address", v.Endpoint.Address)
d.Set("zone_id", v.Endpoint.HostedZoneId) d.Set("hosted_zone_id", v.Endpoint.HostedZoneId)
if v.Endpoint.Address != nil && v.Endpoint.Port != nil { if v.Endpoint.Address != nil && v.Endpoint.Port != nil {
d.Set("endpoint", d.Set("endpoint",
fmt.Sprintf("%s:%d", *v.Endpoint.Address, *v.Endpoint.Port)) fmt.Sprintf("%s:%d", *v.Endpoint.Address, *v.Endpoint.Port))

View File

@ -46,6 +46,7 @@ func TestAccAWSDBInstance_basic(t *testing.T) {
"aws_db_instance.bar", "username", "foo"), "aws_db_instance.bar", "username", "foo"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_db_instance.bar", "parameter_group_name", "default.mysql5.6"), "aws_db_instance.bar", "parameter_group_name", "default.mysql5.6"),
resource.TestCheckResourceAttrSet("aws_db_instance.bar", "hosted_zone_id"),
), ),
}, },
}, },