From d5b462508581db50997aa9d9be2a4a1b6d404158 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 28 Oct 2020 14:57:35 -0400 Subject: [PATCH 1/2] provider: Stabilization of remaining data source id attributes and enable R015, R016, R017 linters Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14579 Changes: * data-source/aws_autoscaling_groups: Prevent plan differences with the `id` attribute * data-source/aws_caller_identity: Prevent plan differences with the `id` attribute * data-source/aws_ebs_snapshot_ids: Prevent plan differences with the `id` attribute * data-source/aws_ebs_volumes: Prevent plan differences with the `id` attribute * data-source/aws_ec2_coip_pools: Prevent plan differences with the `id` attribute * data-source/aws_ec2_instance_type_offerings: Prevent plan differences with the `id` attribute * data-source/aws_ec2_local_gateway_route_tables: Prevent plan differences with the `id` attribute * data-source/aws_ec2_local_gateway_virtual_interface_groups: Prevent plan differences with the `id` attribute * data-source/aws_ec2_local_gateways: Prevent plan differences with the `id` attribute * data-source/aws_ec2_spot_price: Prevent plan differences with the `id` attribute * data-source/aws_efs_access_points: Prevent plan differences with the `id` attribute * data-source/aws_glue_script: Prevent plan differences with the `id` attribute * data-source/aws_inspector_rules_packages: Prevent plan differences with the `id` attribute * data-source/aws_instances: Prevent plan differences with the `id` attribute * data-source/aws_kms_ciphertext: Prevent plan differences with the `id` attribute * data-source/aws_network_acls: Prevent plan differences with the `id` attribute * data-source/aws_network_interfaces: Prevent plan differences with the `id` attribute * data-source/aws_organizations_organizational_units: Prevent plan differences with the `id` attribute * data-source/aws_outposts_outposts: Prevent plan differences with the `id` attribute * data-source/aws_outposts_sites: Prevent plan differences with the `id` attribute * data-source/aws_route_tables: Prevent plan differences with the `id` attribute * data-source/aws_route53_resolver_rules: Prevent plan differences with the `id` attribute * data-source/aws_s3_bucket_objects: Prevent plan differences with the `id` attribute * data-source/aws_security_groups: Prevent plan differences with the `id` attribute * data-source/aws_vpc_peering_connections: Prevent plan differences with the `id` attribute * data-source/aws_vpcs: Prevent plan differences with the `id` attribute Output from acceptance testing: ``` --- PASS: TestAccAWSAutoscalingAttachment_albTargetGroup (111.36s) --- PASS: TestAccAWSAutoscalingAttachment_elb (118.66s) --- PASS: TestAccAWSAutoscalingGroups_basic (162.22s) --- PASS: TestAccAWSCallerIdentity_basic (55.69s) --- PASS: TestAccAWSEBSEncryptionByDefault_basic (52.71s) --- PASS: TestAccAWSEc2InstanceTypeOfferingsDataSource_Filter (57.28s) --- PASS: TestAccAWSEc2InstanceTypeOfferingsDataSource_LocationType (58.79s) --- PASS: TestAccAwsEc2SpotPriceDataSource_basic (54.47s) --- PASS: TestAccAwsEc2SpotPriceDataSource_Filter (59.40s) --- PASS: TestAccAWSELBAttachment_basic (185.93s) --- PASS: TestAccAWSELBAttachment_drift (113.04s) --- PASS: TestAccAWSInspectorRulesPackages_basic (58.00s) --- PASS: TestAccAWSInstancesDataSource_basic (137.19s) --- PASS: TestAccAWSInstancesDataSource_instance_state_names (122.56s) --- PASS: TestAccAWSInstancesDataSource_tags (120.98s) --- PASS: TestAccDataSourceAwsEbsSnapshotIds_basic (92.82s) --- PASS: TestAccDataSourceAwsEbsSnapshotIds_empty (57.58s) --- PASS: TestAccDataSourceAwsEbsSnapshotIds_sorted (195.34s) --- PASS: TestAccDataSourceAwsEbsVolumes_basic (178.56s) --- PASS: TestAccDataSourceAWSEFSAccessPoints_basic (71.87s) --- PASS: TestAccDataSourceAWSGlueScript_Language_Python (57.14s) --- PASS: TestAccDataSourceAWSGlueScript_Language_Scala (57.67s) --- PASS: TestAccDataSourceAwsKmsCiphertext_basic (61.22s) --- PASS: TestAccDataSourceAwsKmsCiphertext_validate (60.99s) --- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (60.77s) --- PASS: TestAccDataSourceAwsNetworkAcls_basic (112.54s) --- PASS: TestAccDataSourceAwsNetworkAcls_Filter (62.55s) --- PASS: TestAccDataSourceAwsNetworkAcls_Tags (58.95s) --- PASS: TestAccDataSourceAwsNetworkAcls_VpcID (60.22s) --- PASS: TestAccDataSourceAwsNetworkInterfaces_Filter (95.49s) --- PASS: TestAccDataSourceAwsNetworkInterfaces_Tags (97.05s) --- PASS: TestAccDataSourceAwsRoute53ResolverRules_basic (57.40s) --- PASS: TestAccDataSourceAwsRoute53ResolverRules_ResolverEndpointId (264.98s) --- PASS: TestAccDataSourceAwsRouteTables_basic (120.92s) --- PASS: TestAccDataSourceAWSS3BucketObjects_all (120.73s) --- PASS: TestAccDataSourceAWSS3BucketObjects_basic (122.61s) --- PASS: TestAccDataSourceAWSS3BucketObjects_basicViaAccessPoint (122.87s) --- PASS: TestAccDataSourceAWSS3BucketObjects_encoded (115.55s) --- PASS: TestAccDataSourceAWSS3BucketObjects_fetchOwner (102.52s) --- PASS: TestAccDataSourceAWSS3BucketObjects_maxKeys (100.50s) --- PASS: TestAccDataSourceAWSS3BucketObjects_prefixes (117.61s) --- PASS: TestAccDataSourceAWSS3BucketObjects_startAfter (102.55s) --- PASS: TestAccDataSourceAwsSecurityGroups_filter (70.25s) --- PASS: TestAccDataSourceAwsSecurityGroups_tag (68.53s) --- PASS: TestAccDataSourceAwsVpcPeeringConnections_basic (70.67s) --- PASS: TestAccDataSourceAwsVpcs_basic (65.12s) --- PASS: TestAccDataSourceAwsVpcs_filters (56.35s) --- PASS: TestAccDataSourceAwsVpcs_tags (58.15s) --- SKIP: TestAccAWSOutpostsOutpostsDataSource_basic (2.12s) --- SKIP: TestAccAWSOutpostsSitesDataSource_basic (1.42s) --- SKIP: TestAccDataSourceAwsEc2CoipPools_basic (15.89s) --- SKIP: TestAccDataSourceAwsEc2CoipPools_Filter (14.35s) --- SKIP: TestAccDataSourceAwsEc2LocalGatewayRouteTables_basic (14.72s) --- SKIP: TestAccDataSourceAwsEc2LocalGatewayRouteTables_Filter (2.24s) --- SKIP: TestAccDataSourceAwsEc2LocalGateways_basic (2.51s) --- SKIP: TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_basic (3.57s) --- SKIP: TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_Filter (2.13s) --- SKIP: TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_Tags (1.99s) ``` --- GNUmakefile | 3 +++ aws/data_source_aws_autoscaling_groups.go | 4 ++-- aws/data_source_aws_caller_identity.go | 4 ++-- aws/data_source_aws_ebs_snapshot_ids.go | 4 ++-- aws/data_source_aws_ebs_volumes.go | 4 ++-- aws/data_source_aws_ec2_coip_pools.go | 4 ++-- aws/data_source_aws_ec2_instance_type_offerings.go | 3 +-- aws/data_source_aws_ec2_local_gateway_route_tables.go | 4 ++-- ..._source_aws_ec2_local_gateway_virtual_interface_groups.go | 3 +-- aws/data_source_aws_ec2_local_gateways.go | 4 ++-- aws/data_source_aws_ec2_spot_price.go | 3 +-- aws/data_source_aws_efs_access_points.go | 3 +-- aws/data_source_aws_glue_script.go | 3 +-- aws/data_source_aws_inspector_rules_packages.go | 4 ++-- aws/data_source_aws_instances.go | 4 ++-- aws/data_source_aws_kms_ciphertext.go | 5 ++--- aws/data_source_aws_network_acls.go | 4 ++-- aws/data_source_aws_network_interfaces.go | 4 ++-- aws/data_source_aws_organizations_organizational_units.go | 4 ++-- aws/data_source_aws_outposts_outposts.go | 3 +-- aws/data_source_aws_outposts_sites.go | 3 +-- aws/data_source_aws_route53_resolver_rules.go | 4 ++-- aws/data_source_aws_route_tables.go | 4 ++-- aws/data_source_aws_s3_bucket_objects.go | 5 ++--- aws/data_source_aws_security_groups.go | 4 ++-- aws/data_source_aws_vpc_peering_connections.go | 4 ++-- aws/data_source_aws_vpcs.go | 4 ++-- aws/resource_aws_autoscaling_attachment.go | 1 + aws/resource_aws_ebs_encryption_by_default.go | 1 + aws/resource_aws_elb_attachment.go | 1 + aws/resource_aws_iam_group_policy_attachment.go | 2 ++ aws/resource_aws_iam_role_policy_attachment.go | 2 ++ aws/resource_aws_iam_user_group_membership.go | 3 +++ aws/resource_aws_iam_user_policy_attachment.go | 2 ++ aws/resource_aws_kms_ciphertext.go | 1 + aws/resource_aws_lb_target_group_attachment.go | 1 + website/docs/d/autoscaling_groups.html.markdown | 3 ++- website/docs/d/caller_identity.html.markdown | 1 + website/docs/d/ebs_snapshot_ids.html.markdown | 4 ++-- website/docs/d/ebs_volumes.html.markdown | 1 + website/docs/d/ec2_coip_pools.html.markdown | 1 + website/docs/d/ec2_instance_type_offerings.html.markdown | 1 + website/docs/d/ec2_local_gateway_route_tables.html.markdown | 1 + .../ec2_local_gateway_virtual_interface_groups.html.markdown | 1 + website/docs/d/ec2_local_gateways.html.markdown | 1 + website/docs/d/ec2_spot_price.html.markdown | 1 + website/docs/d/efs_access_points.html.markdown | 2 +- website/docs/d/glue_script.html.markdown | 1 + website/docs/d/inspector_rules_packages.html.markdown | 1 + website/docs/d/instances.html.markdown | 1 + website/docs/d/kms_ciphertext.html.markdown | 1 + website/docs/d/network_acls.html.markdown | 1 + website/docs/d/network_interfaces.html.markdown | 1 + .../docs/d/organizations_organizational_units.html.markdown | 1 + website/docs/d/outposts_outposts.html.markdown | 1 + website/docs/d/outposts_sites.html.markdown | 1 + website/docs/d/route53_resolver_rules.html.markdown | 1 + website/docs/d/route_tables.html.markdown | 1 + website/docs/d/s3_bucket_objects.html.markdown | 1 + website/docs/d/security_groups.html.markdown | 1 + website/docs/d/vpc_peering_connections.html.markdown | 1 + website/docs/d/vpcs.html.markdown | 1 + 62 files changed, 90 insertions(+), 58 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 09e0fce77af..2ac25194d74 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -112,6 +112,9 @@ awsproviderlint: -R012 \ -R013 \ -R014 \ + -R015 \ + -R016 \ + -R017 \ -S001 \ -S002 \ -S003 \ diff --git a/aws/data_source_aws_autoscaling_groups.go b/aws/data_source_aws_autoscaling_groups.go index 5594920a6f1..fbe4b71d389 100644 --- a/aws/data_source_aws_autoscaling_groups.go +++ b/aws/data_source_aws_autoscaling_groups.go @@ -4,7 +4,6 @@ import ( "fmt" "log" "sort" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/autoscaling" @@ -52,7 +51,6 @@ func dataSourceAwsAutoscalingGroupsRead(d *schema.ResourceData, meta interface{} conn := meta.(*AWSClient).autoscalingconn log.Printf("[DEBUG] Reading Autoscaling Groups.") - d.SetId(time.Now().UTC().String()) var rawName []string var rawArn []string @@ -103,6 +101,8 @@ func dataSourceAwsAutoscalingGroupsRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("Error fetching Autoscaling Groups: %s", err) } + d.SetId(meta.(*AWSClient).region) + sort.Strings(rawName) sort.Strings(rawArn) diff --git a/aws/data_source_aws_caller_identity.go b/aws/data_source_aws_caller_identity.go index 0fcade2eeae..8c4f9a3847e 100644 --- a/aws/data_source_aws_caller_identity.go +++ b/aws/data_source_aws_caller_identity.go @@ -3,8 +3,8 @@ package aws import ( "fmt" "log" - "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -44,7 +44,7 @@ func dataSourceAwsCallerIdentityRead(d *schema.ResourceData, meta interface{}) e log.Printf("[DEBUG] Received Caller Identity: %s", res) - d.SetId(time.Now().UTC().String()) + d.SetId(aws.StringValue(res.Account)) d.Set("account_id", res.Account) d.Set("arn", res.Arn) d.Set("user_id", res.UserId) diff --git a/aws/data_source_aws_ebs_snapshot_ids.go b/aws/data_source_aws_ebs_snapshot_ids.go index 3f63e5f0e93..833c9a44395 100644 --- a/aws/data_source_aws_ebs_snapshot_ids.go +++ b/aws/data_source_aws_ebs_snapshot_ids.go @@ -8,7 +8,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" ) func dataSourceAwsEbsSnapshotIds() *schema.Resource { @@ -74,7 +73,8 @@ func dataSourceAwsEbsSnapshotIdsRead(d *schema.ResourceData, meta interface{}) e snapshotIds = append(snapshotIds, *snapshot.SnapshotId) } - d.SetId(fmt.Sprintf("%d", hashcode.String(params.String()))) + d.SetId(meta.(*AWSClient).region) + d.Set("ids", snapshotIds) return nil diff --git a/aws/data_source_aws_ebs_volumes.go b/aws/data_source_aws_ebs_volumes.go index ad3bb86a93b..5e4216a7cc1 100644 --- a/aws/data_source_aws_ebs_volumes.go +++ b/aws/data_source_aws_ebs_volumes.go @@ -6,7 +6,6 @@ import ( "log" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" @@ -67,7 +66,8 @@ func dataSourceAwsEbsVolumesRead(d *schema.ResourceData, meta interface{}) error volumes = append(volumes, *volume.VolumeId) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", volumes); err != nil { return fmt.Errorf("error setting ids: %w", err) } diff --git a/aws/data_source_aws_ec2_coip_pools.go b/aws/data_source_aws_ec2_coip_pools.go index 71989497b1a..a1b8d30c02e 100644 --- a/aws/data_source_aws_ec2_coip_pools.go +++ b/aws/data_source_aws_ec2_coip_pools.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -66,7 +65,8 @@ func dataSourceAwsEc2CoipPoolsRead(d *schema.ResourceData, meta interface{}) err coippools = append(coippools, aws.StringValue(coippool.PoolId)) } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("pool_ids", coippools); err != nil { return fmt.Errorf("Error setting coip pool ids: %s", err) } diff --git a/aws/data_source_aws_ec2_instance_type_offerings.go b/aws/data_source_aws_ec2_instance_type_offerings.go index cfcf4842cd8..754618bce1f 100644 --- a/aws/data_source_aws_ec2_instance_type_offerings.go +++ b/aws/data_source_aws_ec2_instance_type_offerings.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -79,7 +78,7 @@ func dataSourceAwsEc2InstanceTypeOfferingsRead(d *schema.ResourceData, meta inte return fmt.Errorf("error setting instance_types: %s", err) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) return nil } diff --git a/aws/data_source_aws_ec2_local_gateway_route_tables.go b/aws/data_source_aws_ec2_local_gateway_route_tables.go index 33eddaab9ff..cf86861ab1d 100644 --- a/aws/data_source_aws_ec2_local_gateway_route_tables.go +++ b/aws/data_source_aws_ec2_local_gateway_route_tables.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -62,7 +61,8 @@ func dataSourceAwsEc2LocalGatewayRouteTablesRead(d *schema.ResourceData, meta in localgatewayroutetables = append(localgatewayroutetables, aws.StringValue(localgatewayroutetable.LocalGatewayRouteTableId)) } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", localgatewayroutetables); err != nil { return fmt.Errorf("Error setting local gateway route table ids: %s", err) } diff --git a/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups.go b/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups.go index 29e36982290..d7eecdbb3b6 100644 --- a/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups.go +++ b/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -65,7 +64,7 @@ func dataSourceAwsEc2LocalGatewayVirtualInterfaceGroupsRead(d *schema.ResourceDa localGatewayVirtualInterfaceIds = append(localGatewayVirtualInterfaceIds, group.LocalGatewayVirtualInterfaceIds...) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) if err := d.Set("ids", ids); err != nil { return fmt.Errorf("error setting ids: %w", err) diff --git a/aws/data_source_aws_ec2_local_gateways.go b/aws/data_source_aws_ec2_local_gateways.go index 849d916655a..ccc7a1afdc1 100644 --- a/aws/data_source_aws_ec2_local_gateways.go +++ b/aws/data_source_aws_ec2_local_gateways.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -66,7 +65,8 @@ func dataSourceAwsEc2LocalGatewaysRead(d *schema.ResourceData, meta interface{}) localgateways = append(localgateways, aws.StringValue(localgateway.LocalGatewayId)) } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", localgateways); err != nil { return fmt.Errorf("Error setting local gateway ids: %s", err) } diff --git a/aws/data_source_aws_ec2_spot_price.go b/aws/data_source_aws_ec2_spot_price.go index ac0d7edfa74..2234717e438 100644 --- a/aws/data_source_aws_ec2_spot_price.go +++ b/aws/data_source_aws_ec2_spot_price.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -82,7 +81,7 @@ func dataSourceAwsEc2SpotPriceRead(d *schema.ResourceData, meta interface{}) err d.Set("spot_price", resultSpotPrice.SpotPrice) d.Set("spot_price_timestamp", (*resultSpotPrice.Timestamp).Format(time.RFC3339)) - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) return nil } diff --git a/aws/data_source_aws_efs_access_points.go b/aws/data_source_aws_efs_access_points.go index 441c8eb0591..bca32a13b25 100644 --- a/aws/data_source_aws_efs_access_points.go +++ b/aws/data_source_aws_efs_access_points.go @@ -2,7 +2,6 @@ package aws import ( "fmt" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/efs" @@ -62,7 +61,7 @@ func dataSourceAwsEfsAccessPointsRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("no matching EFS Access Points for File System (%s) found", fileSystemId) } - d.SetId(time.Now().UTC().String()) + d.SetId(fileSystemId) var arns, ids []string diff --git a/aws/data_source_aws_glue_script.go b/aws/data_source_aws_glue_script.go index b99c8929086..4143847f305 100644 --- a/aws/data_source_aws_glue_script.go +++ b/aws/data_source_aws_glue_script.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/glue" @@ -123,7 +122,7 @@ func dataSourceAwsGlueScriptRead(d *schema.ResourceData, meta interface{}) error return errors.New("script not created") } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) d.Set("python_script", output.PythonScript) d.Set("scala_code", output.ScalaCode) diff --git a/aws/data_source_aws_inspector_rules_packages.go b/aws/data_source_aws_inspector_rules_packages.go index f5499ca8f6d..ef2b94702da 100644 --- a/aws/data_source_aws_inspector_rules_packages.go +++ b/aws/data_source_aws_inspector_rules_packages.go @@ -5,7 +5,6 @@ import ( "fmt" "log" "sort" - "time" "github.com/aws/aws-sdk-go/service/inspector" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -29,7 +28,6 @@ func dataSourceAwsInspectorRulesPackagesRead(d *schema.ResourceData, meta interf conn := meta.(*AWSClient).inspectorconn log.Printf("[DEBUG] Reading Rules Packages.") - d.SetId(time.Now().UTC().String()) var arns []string @@ -49,6 +47,8 @@ func dataSourceAwsInspectorRulesPackagesRead(d *schema.ResourceData, meta interf return errors.New("No rules packages found.") } + d.SetId(meta.(*AWSClient).region) + sort.Strings(arns) d.Set("arns", arns) diff --git a/aws/data_source_aws_instances.go b/aws/data_source_aws_instances.go index 4ad94d9676e..60f1c1a8dba 100644 --- a/aws/data_source_aws_instances.go +++ b/aws/data_source_aws_instances.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" @@ -114,7 +113,8 @@ func dataSourceAwsInstancesRead(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Found %d instances via given filter", len(instanceIds)) - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + err = d.Set("ids", instanceIds) if err != nil { return err diff --git a/aws/data_source_aws_kms_ciphertext.go b/aws/data_source_aws_kms_ciphertext.go index c039b237d0d..3d035ffbe5e 100644 --- a/aws/data_source_aws_kms_ciphertext.go +++ b/aws/data_source_aws_kms_ciphertext.go @@ -3,7 +3,6 @@ package aws import ( "encoding/base64" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/kms" @@ -43,8 +42,6 @@ func dataSourceAwsKmsCiphertext() *schema.Resource { func dataSourceAwsKmsCiphertextRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).kmsconn - d.SetId(time.Now().UTC().String()) - req := &kms.EncryptInput{ KeyId: aws.String(d.Get("key_id").(string)), Plaintext: []byte(d.Get("plaintext").(string)), @@ -60,6 +57,8 @@ func dataSourceAwsKmsCiphertextRead(d *schema.ResourceData, meta interface{}) er return err } + d.SetId(d.Get("key_id").(string)) + d.Set("ciphertext_blob", base64.StdEncoding.EncodeToString(resp.CiphertextBlob)) return nil diff --git a/aws/data_source_aws_network_acls.go b/aws/data_source_aws_network_acls.go index deb928e7454..12a0d4fc6ef 100644 --- a/aws/data_source_aws_network_acls.go +++ b/aws/data_source_aws_network_acls.go @@ -7,7 +7,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -84,7 +83,8 @@ func dataSourceAwsNetworkAclsRead(d *schema.ResourceData, meta interface{}) erro networkAcls = append(networkAcls, aws.StringValue(networkAcl.NetworkAclId)) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", networkAcls); err != nil { return fmt.Errorf("Error setting network ACL ids: %s", err) } diff --git a/aws/data_source_aws_network_interfaces.go b/aws/data_source_aws_network_interfaces.go index 13eb917302b..859d4c12b03 100644 --- a/aws/data_source_aws_network_interfaces.go +++ b/aws/data_source_aws_network_interfaces.go @@ -7,7 +7,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -71,7 +70,8 @@ func dataSourceAwsNetworkInterfacesRead(d *schema.ResourceData, meta interface{} networkInterfaces = append(networkInterfaces, aws.StringValue(networkInterface.NetworkInterfaceId)) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", networkInterfaces); err != nil { return fmt.Errorf("Error setting network interfaces ids: %s", err) } diff --git a/aws/data_source_aws_organizations_organizational_units.go b/aws/data_source_aws_organizations_organizational_units.go index 08d49df5674..d56705db6b5 100644 --- a/aws/data_source_aws_organizations_organizational_units.go +++ b/aws/data_source_aws_organizations_organizational_units.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/organizations" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -46,7 +45,6 @@ func dataSourceAwsOrganizationsOrganizationalUnitsRead(d *schema.ResourceData, m conn := meta.(*AWSClient).organizationsconn parent_id := d.Get("parent_id").(string) - d.SetId(resource.UniqueId()) params := &organizations.ListOrganizationalUnitsForParentInput{ ParentId: aws.String(parent_id), @@ -65,6 +63,8 @@ func dataSourceAwsOrganizationsOrganizationalUnitsRead(d *schema.ResourceData, m return fmt.Errorf("error listing Organizations Organization Units for parent (%s): %s", parent_id, err) } + d.SetId(parent_id) + if err := d.Set("children", flattenOrganizationsOrganizationalUnits(children)); err != nil { return fmt.Errorf("Error setting children: %s", err) } diff --git a/aws/data_source_aws_outposts_outposts.go b/aws/data_source_aws_outposts_outposts.go index e16fa7526e9..43b296ee5a7 100644 --- a/aws/data_source_aws_outposts_outposts.go +++ b/aws/data_source_aws_outposts_outposts.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/outposts" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -91,7 +90,7 @@ func dataSourceAwsOutpostsOutpostsRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("error setting ids: %w", err) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) return nil } diff --git a/aws/data_source_aws_outposts_sites.go b/aws/data_source_aws_outposts_sites.go index 6150f01e95d..82f47c22baf 100644 --- a/aws/data_source_aws_outposts_sites.go +++ b/aws/data_source_aws_outposts_sites.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/outposts" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -54,7 +53,7 @@ func dataSourceAwsOutpostsSitesRead(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("error setting ids: %w", err) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) return nil } diff --git a/aws/data_source_aws_route53_resolver_rules.go b/aws/data_source_aws_route53_resolver_rules.go index 91315f8a118..e4d45645798 100644 --- a/aws/data_source_aws_route53_resolver_rules.go +++ b/aws/data_source_aws_route53_resolver_rules.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/route53resolver" @@ -91,7 +90,8 @@ func dataSourceAwsRoute53ResolverRulesRead(d *schema.ResourceData, meta interfac return fmt.Errorf("error getting Route53 Resolver rules: %s", err) } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) + err = d.Set("resolver_rule_ids", flattenStringSet(resolverRuleIds)) if err != nil { return fmt.Errorf("error setting resolver_rule_ids: %s", err) diff --git a/aws/data_source_aws_route_tables.go b/aws/data_source_aws_route_tables.go index 6d1090cc681..e970016a0c6 100644 --- a/aws/data_source_aws_route_tables.go +++ b/aws/data_source_aws_route_tables.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -72,7 +71,8 @@ func dataSourceAwsRouteTablesRead(d *schema.ResourceData, meta interface{}) erro routeTables = append(routeTables, aws.StringValue(routeTable.RouteTableId)) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + if err = d.Set("ids", routeTables); err != nil { return fmt.Errorf("error setting ids: %s", err) } diff --git a/aws/data_source_aws_s3_bucket_objects.go b/aws/data_source_aws_s3_bucket_objects.go index a567bc62f7d..87dafb4fa44 100644 --- a/aws/data_source_aws_s3_bucket_objects.go +++ b/aws/data_source_aws_s3_bucket_objects.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/s3" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -70,8 +69,6 @@ func dataSourceAwsS3BucketObjectsRead(d *schema.ResourceData, meta interface{}) bucket := d.Get("bucket").(string) prefix := d.Get("prefix").(string) - d.SetId(resource.UniqueId()) - listInput := s3.ListObjectsV2Input{ Bucket: aws.String(bucket), } @@ -134,6 +131,8 @@ func dataSourceAwsS3BucketObjectsRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("error listing S3 Bucket (%s) Objects: %s", bucket, err) } + d.SetId(bucket) + if err := d.Set("common_prefixes", commonPrefixes); err != nil { return fmt.Errorf("error setting common_prefixes: %s", err) } diff --git a/aws/data_source_aws_security_groups.go b/aws/data_source_aws_security_groups.go index 7de62c2b964..e2a7b5a8641 100644 --- a/aws/data_source_aws_security_groups.go +++ b/aws/data_source_aws_security_groups.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -80,7 +79,8 @@ func dataSourceAwsSecurityGroupsRead(d *schema.ResourceData, meta interface{}) e log.Printf("[DEBUG] Found %d security groups via given filter: %s", len(ids), req) - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + err := d.Set("ids", ids) if err != nil { return err diff --git a/aws/data_source_aws_vpc_peering_connections.go b/aws/data_source_aws_vpc_peering_connections.go index 534d3935ccf..0fb9f71b5ad 100644 --- a/aws/data_source_aws_vpc_peering_connections.go +++ b/aws/data_source_aws_vpc_peering_connections.go @@ -5,7 +5,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -56,7 +55,8 @@ func dataSourceAwsVpcPeeringConnectionsRead(d *schema.ResourceData, meta interfa ids = append(ids, aws.StringValue(pcx.VpcPeeringConnectionId)) } - d.SetId(resource.UniqueId()) + d.SetId(meta.(*AWSClient).region) + err = d.Set("ids", ids) if err != nil { return err diff --git a/aws/data_source_aws_vpcs.go b/aws/data_source_aws_vpcs.go index c52694ff735..b3e50a988b4 100644 --- a/aws/data_source_aws_vpcs.go +++ b/aws/data_source_aws_vpcs.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -66,7 +65,8 @@ func dataSourceAwsVpcsRead(d *schema.ResourceData, meta interface{}) error { vpcs = append(vpcs, aws.StringValue(vpc.VpcId)) } - d.SetId(time.Now().UTC().String()) + d.SetId(meta.(*AWSClient).region) + if err := d.Set("ids", vpcs); err != nil { return fmt.Errorf("Error setting vpc ids: %s", err) } diff --git a/aws/resource_aws_autoscaling_attachment.go b/aws/resource_aws_autoscaling_attachment.go index 2eaa1a74316..f15e1abde08 100644 --- a/aws/resource_aws_autoscaling_attachment.go +++ b/aws/resource_aws_autoscaling_attachment.go @@ -68,6 +68,7 @@ func resourceAwsAutoscalingAttachmentCreate(d *schema.ResourceData, meta interfa } } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", asgName))) return resourceAwsAutoscalingAttachmentRead(d, meta) diff --git a/aws/resource_aws_ebs_encryption_by_default.go b/aws/resource_aws_ebs_encryption_by_default.go index 2cfa56b7aed..5943de3f7da 100644 --- a/aws/resource_aws_ebs_encryption_by_default.go +++ b/aws/resource_aws_ebs_encryption_by_default.go @@ -35,6 +35,7 @@ func resourceAwsEbsEncryptionByDefaultCreate(d *schema.ResourceData, meta interf return fmt.Errorf("error creating EBS encryption by default (%t): %s", enabled, err) } + //lintignore:R015 // Allow legacy unstable ID usage in managed resource d.SetId(resource.UniqueId()) return resourceAwsEbsEncryptionByDefaultRead(d, meta) diff --git a/aws/resource_aws_elb_attachment.go b/aws/resource_aws_elb_attachment.go index 4c2b57e9699..b182d4c1668 100644 --- a/aws/resource_aws_elb_attachment.go +++ b/aws/resource_aws_elb_attachment.go @@ -66,6 +66,7 @@ func resourceAwsElbAttachmentCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Failure registering instances with ELB: %s", err) } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", elbName))) return nil diff --git a/aws/resource_aws_iam_group_policy_attachment.go b/aws/resource_aws_iam_group_policy_attachment.go index ea00767168b..7128e8cb394 100644 --- a/aws/resource_aws_iam_group_policy_attachment.go +++ b/aws/resource_aws_iam_group_policy_attachment.go @@ -47,7 +47,9 @@ func resourceAwsIamGroupPolicyAttachmentCreate(d *schema.ResourceData, meta inte return fmt.Errorf("Error attaching policy %s to IAM group %s: %v", arn, group, err) } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", group))) + return resourceAwsIamGroupPolicyAttachmentRead(d, meta) } diff --git a/aws/resource_aws_iam_role_policy_attachment.go b/aws/resource_aws_iam_role_policy_attachment.go index 19fb402868c..f3dcf3124ae 100644 --- a/aws/resource_aws_iam_role_policy_attachment.go +++ b/aws/resource_aws_iam_role_policy_attachment.go @@ -46,7 +46,9 @@ func resourceAwsIamRolePolicyAttachmentCreate(d *schema.ResourceData, meta inter return fmt.Errorf("Error attaching policy %s to IAM Role %s: %v", arn, role, err) } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", role))) + return resourceAwsIamRolePolicyAttachmentRead(d, meta) } diff --git a/aws/resource_aws_iam_user_group_membership.go b/aws/resource_aws_iam_user_group_membership.go index a9f275c01e2..9536ffda6d4 100644 --- a/aws/resource_aws_iam_user_group_membership.go +++ b/aws/resource_aws_iam_user_group_membership.go @@ -47,6 +47,7 @@ func resourceAwsIamUserGroupMembershipCreate(d *schema.ResourceData, meta interf return err } + //lintignore:R015 // Allow legacy unstable ID usage in managed resource d.SetId(resource.UniqueId()) return resourceAwsIamUserGroupMembershipRead(d, meta) @@ -178,6 +179,8 @@ func resourceAwsIamUserGroupMembershipImport(d *schema.ResourceData, meta interf d.Set("user", userName) d.Set("groups", groupList) + + //lintignore:R015 // Allow legacy unstable ID usage in managed resource d.SetId(resource.UniqueId()) return []*schema.ResourceData{d}, nil diff --git a/aws/resource_aws_iam_user_policy_attachment.go b/aws/resource_aws_iam_user_policy_attachment.go index 4f25dd40e68..e46bd71ef46 100644 --- a/aws/resource_aws_iam_user_policy_attachment.go +++ b/aws/resource_aws_iam_user_policy_attachment.go @@ -47,7 +47,9 @@ func resourceAwsIamUserPolicyAttachmentCreate(d *schema.ResourceData, meta inter return fmt.Errorf("Error attaching policy %s to IAM User %s: %v", arn, user, err) } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", user))) + return resourceAwsIamUserPolicyAttachmentRead(d, meta) } diff --git a/aws/resource_aws_kms_ciphertext.go b/aws/resource_aws_kms_ciphertext.go index be54bf8ff7e..34d04b87cbb 100644 --- a/aws/resource_aws_kms_ciphertext.go +++ b/aws/resource_aws_kms_ciphertext.go @@ -49,6 +49,7 @@ func resourceAwsKmsCiphertext() *schema.Resource { func resourceAwsKmsCiphertextCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).kmsconn + //lintignore:R017 // Allow legacy unstable ID usage in managed resource d.SetId(time.Now().UTC().String()) req := &kms.EncryptInput{ diff --git a/aws/resource_aws_lb_target_group_attachment.go b/aws/resource_aws_lb_target_group_attachment.go index 5f971040838..878b2649960 100644 --- a/aws/resource_aws_lb_target_group_attachment.go +++ b/aws/resource_aws_lb_target_group_attachment.go @@ -72,6 +72,7 @@ func resourceAwsLbAttachmentCreate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Error registering targets with target group: %s", err) } + //lintignore:R016 // Allow legacy unstable ID usage in managed resource d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", d.Get("target_group_arn")))) return nil diff --git a/website/docs/d/autoscaling_groups.html.markdown b/website/docs/d/autoscaling_groups.html.markdown index a19dd412c3e..bf88ea9987f 100644 --- a/website/docs/d/autoscaling_groups.html.markdown +++ b/website/docs/d/autoscaling_groups.html.markdown @@ -50,5 +50,6 @@ resource "aws_autoscaling_notification" "slack_notifications" { In addition to all arguments above, the following attributes are exported: -* `names` - A list of the Autoscaling Groups in the current region. * `arns` - A list of the Autoscaling Groups Arns in the current region. +* `id` - AWS Region. +* `names` - A list of the Autoscaling Groups in the current region. diff --git a/website/docs/d/caller_identity.html.markdown b/website/docs/d/caller_identity.html.markdown index e32d1ea2d38..2507ead90c1 100644 --- a/website/docs/d/caller_identity.html.markdown +++ b/website/docs/d/caller_identity.html.markdown @@ -38,4 +38,5 @@ There are no arguments available for this data source. * `account_id` - The AWS Account ID number of the account that owns or contains the calling entity. * `arn` - The AWS ARN associated with the calling entity. +* `id` - The AWS Account ID number of the account that owns or contains the calling entity. * `user_id` - The unique identifier of the calling entity. diff --git a/website/docs/d/ebs_snapshot_ids.html.markdown b/website/docs/d/ebs_snapshot_ids.html.markdown index 62ce523a655..f5bcf0e48f6 100644 --- a/website/docs/d/ebs_snapshot_ids.html.markdown +++ b/website/docs/d/ebs_snapshot_ids.html.markdown @@ -43,7 +43,7 @@ several valid keys, for a full reference, check out ## Attributes Reference -`ids` is set to the list of EBS snapshot IDs, sorted by creation time in -descending order. +* `id` - AWS Region. +* `ids` - Set of EBS snapshot IDs, sorted by creation time in descending order. [1]: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-snapshots.html diff --git a/website/docs/d/ebs_volumes.html.markdown b/website/docs/d/ebs_volumes.html.markdown index 46d8ae4fe89..65e6d8f6136 100644 --- a/website/docs/d/ebs_volumes.html.markdown +++ b/website/docs/d/ebs_volumes.html.markdown @@ -64,5 +64,6 @@ data "aws_ebs_volumes" "ten_or_twenty_gb_volumes" { ## Attributes Reference +* `id` - AWS Region. * `ids` - A set of all the EBS Volume IDs found. This data source will fail if no volumes match the provided criteria. diff --git a/website/docs/d/ec2_coip_pools.html.markdown b/website/docs/d/ec2_coip_pools.html.markdown index 952d2ae0cf1..1a0f24d3c5e 100644 --- a/website/docs/d/ec2_coip_pools.html.markdown +++ b/website/docs/d/ec2_coip_pools.html.markdown @@ -40,4 +40,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `pool_ids` - Set of COIP Pool Identifiers diff --git a/website/docs/d/ec2_instance_type_offerings.html.markdown b/website/docs/d/ec2_instance_type_offerings.html.markdown index c65c2c4e020..ef8f5f7c13b 100644 --- a/website/docs/d/ec2_instance_type_offerings.html.markdown +++ b/website/docs/d/ec2_instance_type_offerings.html.markdown @@ -44,4 +44,5 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: +* `id` - AWS Region. * `instance_types` - Set of EC2 Instance Types. diff --git a/website/docs/d/ec2_local_gateway_route_tables.html.markdown b/website/docs/d/ec2_local_gateway_route_tables.html.markdown index c84d9d89f50..7df320c3918 100644 --- a/website/docs/d/ec2_local_gateway_route_tables.html.markdown +++ b/website/docs/d/ec2_local_gateway_route_tables.html.markdown @@ -40,4 +40,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - Set of Local Gateway Route Table identifiers diff --git a/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown b/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown index 8560bb4f6db..9dfe7df2473 100644 --- a/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown +++ b/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown @@ -34,5 +34,6 @@ The `filter` configuration block supports the following arguments: In addition to all arguments above, the following attributes are exported: +* `id` - AWS Region. * `ids` - Set of EC2 Local Gateway Virtual Interface Group identifiers. * `local_gateway_virtual_interface_ids` - Set of EC2 Local Gateway Virtual Interface identifiers. diff --git a/website/docs/d/ec2_local_gateways.html.markdown b/website/docs/d/ec2_local_gateways.html.markdown index 614691ee00b..194d832c36b 100644 --- a/website/docs/d/ec2_local_gateways.html.markdown +++ b/website/docs/d/ec2_local_gateways.html.markdown @@ -44,4 +44,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - Set of all the Local Gateway identifiers diff --git a/website/docs/d/ec2_spot_price.html.markdown b/website/docs/d/ec2_spot_price.html.markdown index f344533d84d..95736419d7d 100644 --- a/website/docs/d/ec2_spot_price.html.markdown +++ b/website/docs/d/ec2_spot_price.html.markdown @@ -41,5 +41,6 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: +* `id` - AWS Region. * `spot_price` - The most recent Spot Price value for the given instance type and AZ. * `spot_price_timestamp` - The timestamp at which the Spot Price value was published. diff --git a/website/docs/d/efs_access_points.html.markdown b/website/docs/d/efs_access_points.html.markdown index d71e8c1d429..3f8482e432d 100644 --- a/website/docs/d/efs_access_points.html.markdown +++ b/website/docs/d/efs_access_points.html.markdown @@ -29,5 +29,5 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: * `arns` - Set of Amazon Resource Names (ARNs). -* `id` - RFC3339 timestamp when the data source was invoked. +* `id` - EFS File System identifier. * `ids` - Set of identifiers. diff --git a/website/docs/d/glue_script.html.markdown b/website/docs/d/glue_script.html.markdown index 90514f25153..ed8839695bc 100644 --- a/website/docs/d/glue_script.html.markdown +++ b/website/docs/d/glue_script.html.markdown @@ -243,5 +243,6 @@ output "scala_code" { ## Attributes Reference +* `id` - AWS Region. * `python_script` - The Python script generated from the DAG when the `language` argument is set to `PYTHON`. * `scala_code` - The Scala code generated from the DAG when the `language` argument is set to `SCALA`. diff --git a/website/docs/d/inspector_rules_packages.html.markdown b/website/docs/d/inspector_rules_packages.html.markdown index ca257d61710..ba2889c4e84 100644 --- a/website/docs/d/inspector_rules_packages.html.markdown +++ b/website/docs/d/inspector_rules_packages.html.markdown @@ -43,4 +43,5 @@ resource "aws_inspector_assessment_template" "assessment" { In addition to all arguments above, the following attributes are exported: +* `id` - AWS Region. * `arns` - A list of the AWS Inspector Rules Packages arns available in the AWS region. diff --git a/website/docs/d/instances.html.markdown b/website/docs/d/instances.html.markdown index 773550f37f3..04c8ffb108f 100644 --- a/website/docs/d/instances.html.markdown +++ b/website/docs/d/instances.html.markdown @@ -56,6 +56,7 @@ several valid keys, for a full reference, check out ## Attributes Reference +* `id` - AWS Region. * `ids` - IDs of instances found through the filter * `private_ips` - Private IP addresses of instances found through the filter * `public_ips` - Public IP addresses of instances found through the filter diff --git a/website/docs/d/kms_ciphertext.html.markdown b/website/docs/d/kms_ciphertext.html.markdown index be9de4a2641..2a4f5addf01 100644 --- a/website/docs/d/kms_ciphertext.html.markdown +++ b/website/docs/d/kms_ciphertext.html.markdown @@ -48,4 +48,5 @@ The following arguments are supported: All of the argument attributes are also exported as result attributes. +* `id` - AWS Region. * `ciphertext_blob` - Base64 encoded ciphertext diff --git a/website/docs/d/network_acls.html.markdown b/website/docs/d/network_acls.html.markdown index 311072a911e..dfd9d09153e 100644 --- a/website/docs/d/network_acls.html.markdown +++ b/website/docs/d/network_acls.html.markdown @@ -69,4 +69,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - A list of all the network ACL ids found. This data source will fail if none are found. diff --git a/website/docs/d/network_interfaces.html.markdown b/website/docs/d/network_interfaces.html.markdown index ec7e70064ed..ebc3e3bad7b 100644 --- a/website/docs/d/network_interfaces.html.markdown +++ b/website/docs/d/network_interfaces.html.markdown @@ -67,5 +67,6 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - A list of all the network interface ids found. This data source will fail if none are found. diff --git a/website/docs/d/organizations_organizational_units.html.markdown b/website/docs/d/organizations_organizational_units.html.markdown index 357c94b4eb1..4994ff7830c 100644 --- a/website/docs/d/organizations_organizational_units.html.markdown +++ b/website/docs/d/organizations_organizational_units.html.markdown @@ -29,3 +29,4 @@ data "aws_organizations_organizational_units" "ou" { * `arn` - ARN of the organizational unit * `name` - Name of the organizational unit * `id` - ID of the organizational unit +* `id` - Parent identifier of the organizational units. diff --git a/website/docs/d/outposts_outposts.html.markdown b/website/docs/d/outposts_outposts.html.markdown index c75f6856229..9dddab04518 100644 --- a/website/docs/d/outposts_outposts.html.markdown +++ b/website/docs/d/outposts_outposts.html.markdown @@ -31,4 +31,5 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: * `arns` - Set of Amazon Resource Names (ARNs). +* `id` - AWS Region. * `ids` - Set of identifiers. diff --git a/website/docs/d/outposts_sites.html.markdown b/website/docs/d/outposts_sites.html.markdown index 0144f7a4642..e749b32308f 100644 --- a/website/docs/d/outposts_sites.html.markdown +++ b/website/docs/d/outposts_sites.html.markdown @@ -24,4 +24,5 @@ There are no arguments available for this data source. The following attributes are exported: +* `id` - AWS Region. * `ids` - Set of Outposts Site identifiers. diff --git a/website/docs/d/route53_resolver_rules.html.markdown b/website/docs/d/route53_resolver_rules.html.markdown index b94c849aded..dde2f13b699 100644 --- a/website/docs/d/route53_resolver_rules.html.markdown +++ b/website/docs/d/route53_resolver_rules.html.markdown @@ -42,4 +42,5 @@ The arguments of this data source act as filters for querying the available reso The following attributes are exported: +* `id` - AWS Region. * `resolver_rule_ids` - The IDs of the matched resolver rules. diff --git a/website/docs/d/route_tables.html.markdown b/website/docs/d/route_tables.html.markdown index afe3fa1dd09..bb66ba77c0c 100644 --- a/website/docs/d/route_tables.html.markdown +++ b/website/docs/d/route_tables.html.markdown @@ -54,4 +54,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - A set of all the route table ids found. This data source will fail if none are found. diff --git a/website/docs/d/s3_bucket_objects.html.markdown b/website/docs/d/s3_bucket_objects.html.markdown index 75648efe2b4..eb467392e5f 100644 --- a/website/docs/d/s3_bucket_objects.html.markdown +++ b/website/docs/d/s3_bucket_objects.html.markdown @@ -46,4 +46,5 @@ In addition to all arguments above, the following attributes are exported: * `keys` - List of strings representing object keys * `common_prefixes` - List of any keys between `prefix` and the next occurrence of `delimiter` (i.e., similar to subdirectories of the `prefix` "directory"); the list is only returned when you specify `delimiter` +* `id` - S3 Bucket. * `owners` - List of strings representing object owner IDs (see `fetch_owner` above) diff --git a/website/docs/d/security_groups.html.markdown b/website/docs/d/security_groups.html.markdown index c5b097a1c36..c5827552869 100644 --- a/website/docs/d/security_groups.html.markdown +++ b/website/docs/d/security_groups.html.markdown @@ -47,6 +47,7 @@ several valid keys, for a full reference, check out ## Attributes Reference +* `id` - AWS Region. * `ids` - IDs of the matches security groups. * `vpc_ids` - The VPC IDs of the matched security groups. The data source's tag or filter *will span VPCs* unless the `vpc-id` filter is also used. diff --git a/website/docs/d/vpc_peering_connections.html.markdown b/website/docs/d/vpc_peering_connections.html.markdown index 6b1a89009b3..5942ba9cf90 100644 --- a/website/docs/d/vpc_peering_connections.html.markdown +++ b/website/docs/d/vpc_peering_connections.html.markdown @@ -54,4 +54,5 @@ which take the following arguments: All of the argument attributes except `filter` are also exported as result attributes. +* `id` - AWS Region. * `ids` - The IDs of the VPC Peering Connections. diff --git a/website/docs/d/vpcs.html.markdown b/website/docs/d/vpcs.html.markdown index 9eb8b7fc2f0..c0f0e99619c 100644 --- a/website/docs/d/vpcs.html.markdown +++ b/website/docs/d/vpcs.html.markdown @@ -70,4 +70,5 @@ which take the following arguments: ## Attributes Reference +* `id` - AWS Region. * `ids` - A list of all the VPC Ids found. This data source will fail if none are found. From 1aff03b9284b763634cc54846c3e113137925388 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 29 Oct 2020 14:20:27 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: angie pinilla --- aws/data_source_aws_kms_ciphertext.go | 2 +- website/docs/d/kms_ciphertext.html.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/data_source_aws_kms_ciphertext.go b/aws/data_source_aws_kms_ciphertext.go index 3d035ffbe5e..19fef6cb310 100644 --- a/aws/data_source_aws_kms_ciphertext.go +++ b/aws/data_source_aws_kms_ciphertext.go @@ -57,7 +57,7 @@ func dataSourceAwsKmsCiphertextRead(d *schema.ResourceData, meta interface{}) er return err } - d.SetId(d.Get("key_id").(string)) + d.SetId(aws.StringValue(resp.KeyId)) d.Set("ciphertext_blob", base64.StdEncoding.EncodeToString(resp.CiphertextBlob)) diff --git a/website/docs/d/kms_ciphertext.html.markdown b/website/docs/d/kms_ciphertext.html.markdown index 2a4f5addf01..e7b9c50c426 100644 --- a/website/docs/d/kms_ciphertext.html.markdown +++ b/website/docs/d/kms_ciphertext.html.markdown @@ -48,5 +48,5 @@ The following arguments are supported: All of the argument attributes are also exported as result attributes. -* `id` - AWS Region. +* `id` - Globally unique key ID for the customer master key. * `ciphertext_blob` - Base64 encoded ciphertext