From 35f4201b9e8746f985d1813429464f8286822eca Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 20 Apr 2016 10:48:22 -0700 Subject: [PATCH] providers/aws: instance_tenancy is computed, set --- builtin/providers/aws/resource_aws_vpc.go | 2 ++ helper/resource/testing.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_vpc.go b/builtin/providers/aws/resource_aws_vpc.go index d4689c5ad..68155c1a6 100644 --- a/builtin/providers/aws/resource_aws_vpc.go +++ b/builtin/providers/aws/resource_aws_vpc.go @@ -31,6 +31,7 @@ func resourceAwsVpc() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + Computed: true, }, "enable_dns_hostnames": &schema.Schema{ @@ -140,6 +141,7 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { vpcid := d.Id() d.Set("cidr_block", vpc.CidrBlock) d.Set("dhcp_options_id", vpc.DhcpOptionsId) + d.Set("instance_tenancy", vpc.InstanceTenancy) // Tags d.Set("tags", tagsToMap(vpc.Tags)) diff --git a/helper/resource/testing.go b/helper/resource/testing.go index 9d6c363ec..8e2bff466 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -289,7 +289,14 @@ func testIDOnlyRefresh(opts terraform.ContextOpts, r *terraform.ResourceState) e } // Verify attribute equivalence. - actual := state.RootModule().Resources[name].Primary.Attributes + actualR := state.RootModule().Resources[name] + if actualR == nil { + return fmt.Errorf("Resource gone!") + } + if actualR.Primary == nil { + return fmt.Errorf("Resource has no primary instance") + } + actual := actualR.Primary.Attributes expected := r.Primary.Attributes if !reflect.DeepEqual(actual, expected) { // Determine only the different attributes