diff --git a/aws/data_source_aws_availability_zone.go b/aws/data_source_aws_availability_zone.go index edab7c92615..6fdf34281df 100644 --- a/aws/data_source_aws_availability_zone.go +++ b/aws/data_source_aws_availability_zone.go @@ -79,7 +79,6 @@ func dataSourceAwsAvailabilityZoneRead(d *schema.ResourceData, meta interface{}) nameSuffix := (*az.ZoneName)[len(*az.RegionName):] d.SetId(*az.ZoneName) - d.Set("id", az.ZoneName) d.Set("name", az.ZoneName) d.Set("name_suffix", nameSuffix) d.Set("region", az.RegionName) diff --git a/aws/data_source_aws_canonical_user_id.go b/aws/data_source_aws_canonical_user_id.go index ba6a0b09884..0c8a89e390a 100644 --- a/aws/data_source_aws_canonical_user_id.go +++ b/aws/data_source_aws_canonical_user_id.go @@ -14,10 +14,6 @@ func dataSourceAwsCanonicalUserId() *schema.Resource { Read: dataSourceAwsCanonicalUserIdRead, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, "display_name": { Type: schema.TypeString, Computed: true, @@ -41,7 +37,6 @@ func dataSourceAwsCanonicalUserIdRead(d *schema.ResourceData, meta interface{}) } d.SetId(aws.StringValue(resp.Owner.ID)) - d.Set("id", resp.Owner.ID) d.Set("display_name", resp.Owner.DisplayName) return nil diff --git a/aws/data_source_aws_eip.go b/aws/data_source_aws_eip.go index 0352f48bf7a..2e301a06cd1 100644 --- a/aws/data_source_aws_eip.go +++ b/aws/data_source_aws_eip.go @@ -19,7 +19,6 @@ func dataSourceAwsEip() *schema.Resource { Optional: true, Computed: true, }, - "public_ip": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -34,8 +33,8 @@ func dataSourceAwsEipRead(d *schema.ResourceData, meta interface{}) error { req := &ec2.DescribeAddressesInput{} - if id := d.Get("id"); id != "" { - req.AllocationIds = []*string{aws.String(id.(string))} + if id := d.Id(); id != "" { + req.AllocationIds = []*string{aws.String(id)} } if public_ip := d.Get("public_ip"); public_ip != "" { @@ -57,7 +56,6 @@ func dataSourceAwsEipRead(d *schema.ResourceData, meta interface{}) error { eip := resp.Addresses[0] d.SetId(*eip.AllocationId) - d.Set("id", eip.AllocationId) d.Set("public_ip", eip.PublicIp) return nil diff --git a/aws/data_source_aws_iam_server_certificate.go b/aws/data_source_aws_iam_server_certificate.go index 854bc39b442..4be79462334 100644 --- a/aws/data_source_aws_iam_server_certificate.go +++ b/aws/data_source_aws_iam_server_certificate.go @@ -58,11 +58,6 @@ func dataSourceAwsIAMServerCertificate() *schema.Resource { Computed: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, - "path": { Type: schema.TypeString, Computed: true, @@ -130,7 +125,6 @@ func dataSourceAwsIAMServerCertificateRead(d *schema.ResourceData, meta interfac d.SetId(*metadata.ServerCertificateId) d.Set("arn", *metadata.Arn) d.Set("path", *metadata.Path) - d.Set("id", *metadata.ServerCertificateId) d.Set("name", *metadata.ServerCertificateName) if metadata.Expiration != nil { d.Set("expiration_date", metadata.Expiration.Format("2006-01-02T15:04:05")) diff --git a/aws/data_source_aws_prefix_list.go b/aws/data_source_aws_prefix_list.go index 8bed8550678..876af586db3 100644 --- a/aws/data_source_aws_prefix_list.go +++ b/aws/data_source_aws_prefix_list.go @@ -23,11 +23,6 @@ func dataSourceAwsPrefixList() *schema.Resource { Optional: true, Computed: true, }, - // Computed values. - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, "cidr_blocks": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -63,7 +58,6 @@ func dataSourceAwsPrefixListRead(d *schema.ResourceData, meta interface{}) error pl := resp.PrefixLists[0] d.SetId(*pl.PrefixListId) - d.Set("id", pl.PrefixListId) d.Set("name", pl.PrefixListName) cidrs := make([]string, len(pl.Cidrs)) diff --git a/aws/data_source_aws_region.go b/aws/data_source_aws_region.go index ed75f705610..6d2a21d1d6d 100644 --- a/aws/data_source_aws_region.go +++ b/aws/data_source_aws_region.go @@ -75,7 +75,6 @@ func dataSourceAwsRegionRead(d *schema.ResourceData, meta interface{}) error { region := resp.Regions[0] d.SetId(*region.RegionName) - d.Set("id", region.RegionName) d.Set("name", region.RegionName) d.Set("endpoint", region.Endpoint) d.Set("current", *region.RegionName == currentRegion) diff --git a/aws/data_source_aws_security_group.go b/aws/data_source_aws_security_group.go index 223d33823f1..888697f98a2 100644 --- a/aws/data_source_aws_security_group.go +++ b/aws/data_source_aws_security_group.go @@ -46,8 +46,8 @@ func dataSourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) er conn := meta.(*AWSClient).ec2conn req := &ec2.DescribeSecurityGroupsInput{} - if id, idExists := d.GetOk("id"); idExists { - req.GroupIds = []*string{aws.String(id.(string))} + if id := d.Id(); id != "" { + req.GroupIds = []*string{aws.String(id)} } req.Filters = buildEC2AttributeFilterList( @@ -82,7 +82,6 @@ func dataSourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) er sg := resp.SecurityGroups[0] d.SetId(*sg.GroupId) - d.Set("id", sg.VpcId) d.Set("name", sg.GroupName) d.Set("description", sg.Description) d.Set("vpc_id", sg.VpcId) diff --git a/aws/data_source_aws_subnet.go b/aws/data_source_aws_subnet.go index 188a09dd2af..a26690b776f 100644 --- a/aws/data_source_aws_subnet.go +++ b/aws/data_source_aws_subnet.go @@ -83,8 +83,8 @@ func dataSourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { req := &ec2.DescribeSubnetsInput{} - if id := d.Get("id"); id != "" { - req.SubnetIds = []*string{aws.String(id.(string))} + if id := d.Id(); id != "" { + req.SubnetIds = []*string{aws.String(id)} } // We specify default_for_az as boolean, but EC2 filters want @@ -139,7 +139,6 @@ func dataSourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { subnet := resp.Subnets[0] d.SetId(*subnet.SubnetId) - d.Set("id", subnet.SubnetId) d.Set("vpc_id", subnet.VpcId) d.Set("availability_zone", subnet.AvailabilityZone) d.Set("cidr_block", subnet.CidrBlock) diff --git a/aws/data_source_aws_vpc.go b/aws/data_source_aws_vpc.go index a4acbfc43bf..8b7f7691c6f 100644 --- a/aws/data_source_aws_vpc.go +++ b/aws/data_source_aws_vpc.go @@ -81,8 +81,8 @@ func dataSourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { req := &ec2.DescribeVpcsInput{} - if id := d.Get("id"); id != "" { - req.VpcIds = []*string{aws.String(id.(string))} + if id := d.Id(); id != "" { + req.VpcIds = []*string{aws.String(id)} } // We specify "default" as boolean, but EC2 filters want @@ -129,7 +129,6 @@ func dataSourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { vpc := resp.Vpcs[0] d.SetId(*vpc.VpcId) - d.Set("id", vpc.VpcId) d.Set("cidr_block", vpc.CidrBlock) d.Set("dhcp_options_id", vpc.DhcpOptionsId) d.Set("instance_tenancy", vpc.InstanceTenancy) diff --git a/aws/data_source_aws_vpc_endpoint.go b/aws/data_source_aws_vpc_endpoint.go index c1593312974..462ff26c0ff 100644 --- a/aws/data_source_aws_vpc_endpoint.go +++ b/aws/data_source_aws_vpc_endpoint.go @@ -56,8 +56,8 @@ func dataSourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) erro req := &ec2.DescribeVpcEndpointsInput{} - if id, ok := d.GetOk("id"); ok { - req.VpcEndpointIds = aws.StringSlice([]string{id.(string)}) + if id := d.Id(); id != "" { + req.VpcEndpointIds = aws.StringSlice([]string{id}) } req.Filters = buildEC2AttributeFilterList( @@ -90,7 +90,6 @@ func dataSourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) erro } d.SetId(aws.StringValue(vpce.VpcEndpointId)) - d.Set("id", vpce.VpcEndpointId) d.Set("state", vpce.State) d.Set("vpc_id", vpce.VpcId) d.Set("service_name", vpce.ServiceName) diff --git a/aws/data_source_aws_vpc_peering_connection.go b/aws/data_source_aws_vpc_peering_connection.go index 8d800751f53..a7fa70e143c 100644 --- a/aws/data_source_aws_vpc_peering_connection.go +++ b/aws/data_source_aws_vpc_peering_connection.go @@ -77,8 +77,8 @@ func dataSourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interfac req := &ec2.DescribeVpcPeeringConnectionsInput{} - if id, ok := d.GetOk("id"); ok { - req.VpcPeeringConnectionIds = aws.StringSlice([]string{id.(string)}) + if id := d.Id(); id != "" { + req.VpcPeeringConnectionIds = aws.StringSlice([]string{id}) } req.Filters = buildEC2AttributeFilterList( @@ -117,7 +117,6 @@ func dataSourceAwsVpcPeeringConnectionRead(d *schema.ResourceData, meta interfac pcx := resp.VpcPeeringConnections[0] d.SetId(aws.StringValue(pcx.VpcPeeringConnectionId)) - d.Set("id", pcx.VpcPeeringConnectionId) d.Set("status", pcx.Status.Code) d.Set("vpc_id", pcx.RequesterVpcInfo.VpcId) d.Set("owner_id", pcx.RequesterVpcInfo.OwnerId) diff --git a/aws/data_source_aws_vpn_gateway.go b/aws/data_source_aws_vpn_gateway.go index 5d088e54845..11e138b0488 100644 --- a/aws/data_source_aws_vpn_gateway.go +++ b/aws/data_source_aws_vpn_gateway.go @@ -47,8 +47,8 @@ func dataSourceAwsVpnGatewayRead(d *schema.ResourceData, meta interface{}) error req := &ec2.DescribeVpnGatewaysInput{} - if id, ok := d.GetOk("id"); ok { - req.VpnGatewayIds = aws.StringSlice([]string{id.(string)}) + if id := d.Id(); id != "" { + req.VpnGatewayIds = aws.StringSlice([]string{id}) } req.Filters = buildEC2AttributeFilterList( diff --git a/aws/opsworks_layers.go b/aws/opsworks_layers.go index c4bfeb6b2ac..42ba8628511 100644 --- a/aws/opsworks_layers.go +++ b/aws/opsworks_layers.go @@ -45,11 +45,6 @@ var ( func (lt *opsworksLayerType) SchemaResource() *schema.Resource { resourceSchema := map[string]*schema.Schema{ - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "auto_assign_elastic_ips": &schema.Schema{ Type: schema.TypeBool, Optional: true, @@ -281,7 +276,7 @@ func (lt *opsworksLayerType) Read(d *schema.ResourceData, client *opsworks.OpsWo } layer := resp.Layers[0] - d.Set("id", layer.LayerId) + d.SetId(aws.StringValue(layer.LayerId)) d.Set("auto_assign_elastic_ips", layer.AutoAssignElasticIps) d.Set("auto_assign_public_ips", layer.AutoAssignPublicIps) d.Set("custom_instance_profile_arn", layer.CustomInstanceProfileArn) @@ -370,7 +365,6 @@ func (lt *opsworksLayerType) Create(d *schema.ResourceData, client *opsworks.Ops layerId := *resp.LayerId d.SetId(layerId) - d.Set("id", layerId) loadBalancer := aws.String(d.Get("elastic_load_balancer").(string)) if loadBalancer != nil && *loadBalancer != "" { diff --git a/aws/resource_aws_ami.go b/aws/resource_aws_ami.go index f6b4ffb0771..b5ca0c9915e 100644 --- a/aws/resource_aws_ami.go +++ b/aws/resource_aws_ami.go @@ -110,10 +110,8 @@ func resourceAwsAmiCreate(d *schema.ResourceData, meta interface{}) error { id := *res.ImageId d.SetId(id) - d.Partial(true) // make sure we record the id even if the rest of this gets interrupted - d.Set("id", id) + d.Partial(true) d.Set("manage_ebs_block_devices", false) - d.SetPartial("id") d.SetPartial("manage_ebs_block_devices") d.Partial(false) @@ -397,10 +395,6 @@ func resourceAwsAmiCommonSchema(computed bool) map[string]*schema.Schema { } return map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, "image_location": { Type: schema.TypeString, Optional: !computed, diff --git a/aws/resource_aws_ami_copy.go b/aws/resource_aws_ami_copy.go index 3452d5b5287..9ac1d66ced8 100644 --- a/aws/resource_aws_ami_copy.go +++ b/aws/resource_aws_ami_copy.go @@ -75,9 +75,7 @@ func resourceAwsAmiCopyCreate(d *schema.ResourceData, meta interface{}) error { id := *res.ImageId d.SetId(id) d.Partial(true) // make sure we record the id even if the rest of this gets interrupted - d.Set("id", id) d.Set("manage_ebs_snapshots", true) - d.SetPartial("id") d.SetPartial("manage_ebs_snapshots") d.Partial(false) diff --git a/aws/resource_aws_ami_from_instance.go b/aws/resource_aws_ami_from_instance.go index cc272d3c15d..005a11f1294 100644 --- a/aws/resource_aws_ami_from_instance.go +++ b/aws/resource_aws_ami_from_instance.go @@ -55,9 +55,7 @@ func resourceAwsAmiFromInstanceCreate(d *schema.ResourceData, meta interface{}) id := *res.ImageId d.SetId(id) d.Partial(true) // make sure we record the id even if the rest of this gets interrupted - d.Set("id", id) d.Set("manage_ebs_snapshots", true) - d.SetPartial("id") d.SetPartial("manage_ebs_snapshots") d.Partial(false) diff --git a/aws/resource_aws_opsworks_application.go b/aws/resource_aws_opsworks_application.go index 7333018e5f6..9d3df69cde8 100644 --- a/aws/resource_aws_opsworks_application.go +++ b/aws/resource_aws_opsworks_application.go @@ -21,10 +21,6 @@ func resourceAwsOpsworksApplication() *schema.Resource { Update: resourceAwsOpsworksApplicationUpdate, Delete: resourceAwsOpsworksApplicationDelete, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, "name": { Type: schema.TypeString, Required: true, @@ -345,7 +341,6 @@ func resourceAwsOpsworksApplicationCreate(d *schema.ResourceData, meta interface appID := *resp.AppId d.SetId(appID) - d.Set("id", appID) return resourceAwsOpsworksApplicationRead(d, meta) } diff --git a/aws/resource_aws_opsworks_instance.go b/aws/resource_aws_opsworks_instance.go index 255487727e7..08770b35985 100644 --- a/aws/resource_aws_opsworks_instance.go +++ b/aws/resource_aws_opsworks_instance.go @@ -32,11 +32,6 @@ func resourceAwsOpsworksInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, - "agent_version": { Type: schema.TypeString, Optional: true, @@ -564,7 +559,6 @@ func resourceAwsOpsworksInstanceRead(d *schema.ResourceData, meta interface{}) e d.Set("hostname", instance.Hostname) d.Set("infrastructure_class", instance.InfrastructureClass) d.Set("install_updates_on_boot", instance.InstallUpdatesOnBoot) - d.Set("id", instanceId) d.Set("instance_profile_arn", instance.InstanceProfileArn) d.Set("instance_type", instance.InstanceType) d.Set("last_service_error_id", instance.LastServiceErrorId) @@ -785,7 +779,6 @@ func resourceAwsOpsworksInstanceCreate(d *schema.ResourceData, meta interface{}) instanceId := *resp.InstanceId d.SetId(instanceId) - d.Set("id", instanceId) if v, ok := d.GetOk("state"); ok && v.(string) == "running" { err := startOpsworksInstance(d, meta, true, d.Timeout(schema.TimeoutCreate)) @@ -806,9 +799,9 @@ func resourceAwsOpsworksInstanceUpdate(d *schema.ResourceData, meta interface{}) } req := &opsworks.UpdateInstanceInput{ + InstanceId: aws.String(d.Id()), AgentVersion: aws.String(d.Get("agent_version").(string)), Architecture: aws.String(d.Get("architecture").(string)), - InstanceId: aws.String(d.Get("id").(string)), InstallUpdatesOnBoot: aws.Bool(d.Get("install_updates_on_boot").(bool)), } @@ -918,7 +911,7 @@ func resourceAwsOpsworksInstanceImport( func startOpsworksInstance(d *schema.ResourceData, meta interface{}, wait bool, timeout time.Duration) error { client := meta.(*AWSClient).opsworksconn - instanceId := d.Get("id").(string) + instanceId := d.Id() req := &opsworks.StartInstanceInput{ InstanceId: aws.String(instanceId), @@ -956,7 +949,7 @@ func startOpsworksInstance(d *schema.ResourceData, meta interface{}, wait bool, func stopOpsworksInstance(d *schema.ResourceData, meta interface{}, wait bool, timeout time.Duration) error { client := meta.(*AWSClient).opsworksconn - instanceId := d.Get("id").(string) + instanceId := d.Id() req := &opsworks.StopInstanceInput{ InstanceId: aws.String(instanceId), diff --git a/aws/resource_aws_opsworks_permission.go b/aws/resource_aws_opsworks_permission.go index f1292a2fe65..13757228d44 100644 --- a/aws/resource_aws_opsworks_permission.go +++ b/aws/resource_aws_opsworks_permission.go @@ -20,10 +20,6 @@ func resourceAwsOpsworksPermission() *schema.Resource { Read: resourceAwsOpsworksPermissionRead, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, "allow_ssh": { Type: schema.TypeBool, Computed: true, @@ -104,7 +100,6 @@ func resourceAwsOpsworksPermissionRead(d *schema.ResourceData, meta interface{}) if d.Get("user_arn").(string)+d.Get("stack_id").(string) == id { found = true d.SetId(id) - d.Set("id", id) d.Set("allow_ssh", permission.AllowSsh) d.Set("allow_sudo", permission.AllowSudo) d.Set("user_arn", permission.IamUserArn) diff --git a/aws/resource_aws_opsworks_rds_db_instance.go b/aws/resource_aws_opsworks_rds_db_instance.go index d1aee903016..ef0d61f70fe 100644 --- a/aws/resource_aws_opsworks_rds_db_instance.go +++ b/aws/resource_aws_opsworks_rds_db_instance.go @@ -20,10 +20,6 @@ func resourceAwsOpsworksRdsDbInstance() *schema.Resource { Read: resourceAwsOpsworksRdsDbInstanceRead, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, "stack_id": { Type: schema.TypeString, Required: true, @@ -154,7 +150,6 @@ func resourceAwsOpsworksRdsDbInstanceRead(d *schema.ResourceData, meta interface if fmt.Sprintf("%s%s", d.Get("rds_db_instance_arn").(string), d.Get("stack_id").(string)) == id { found = true d.SetId(id) - d.Set("id", id) d.Set("stack_id", instance.StackId) d.Set("rds_db_instance_arn", instance.RdsDbInstanceArn) d.Set("db_user", instance.DbUser) diff --git a/aws/resource_aws_opsworks_stack.go b/aws/resource_aws_opsworks_stack.go index f7f2283f114..a173da10a79 100644 --- a/aws/resource_aws_opsworks_stack.go +++ b/aws/resource_aws_opsworks_stack.go @@ -40,11 +40,6 @@ func resourceAwsOpsworksStack() *schema.Resource { Computed: true, }, - "id": { - Type: schema.TypeString, - Computed: true, - }, - "name": { Type: schema.TypeString, Required: true, @@ -476,7 +471,6 @@ func resourceAwsOpsworksStackCreate(d *schema.ResourceData, meta interface{}) er stackId := *resp.StackId d.SetId(stackId) - d.Set("id", stackId) if inVpc && *req.UseOpsworksSecurityGroups { // For VPC-based stacks, OpsWorks asynchronously creates some default diff --git a/aws/resource_aws_opsworks_user_profile.go b/aws/resource_aws_opsworks_user_profile.go index 39670b29549..ce24f5b2fdc 100644 --- a/aws/resource_aws_opsworks_user_profile.go +++ b/aws/resource_aws_opsworks_user_profile.go @@ -18,11 +18,6 @@ func resourceAwsOpsworksUserProfile() *schema.Resource { Delete: resourceAwsOpsworksUserProfileDelete, Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, - }, - "user_arn": { Type: schema.TypeString, Required: true,