Skip to content

Commit

Permalink
provider: Stabilization of remaining data source id attributes and en…
Browse files Browse the repository at this point in the history
…able R015, R016, R017 linters (#15896)

* provider: Stabilization of remaining data source id attributes and enable R015, R016, R017 linters

Reference: #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)
```

* Apply suggestions from code review

Co-authored-by: angie pinilla <[email protected]>

Co-authored-by: angie pinilla <[email protected]>
  • Loading branch information
bflad and anGie44 authored Oct 29, 2020
1 parent 5f2bca2 commit 6f4442a
Show file tree
Hide file tree
Showing 62 changed files with 90 additions and 58 deletions.
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ awsproviderlint:
-R012 \
-R013 \
-R014 \
-R015 \
-R016 \
-R017 \
-S001 \
-S002 \
-S003 \
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_autoscaling_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"log"
"sort"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/autoscaling"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_caller_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_ebs_snapshot_ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_ebs_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_ec2_coip_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions aws/data_source_aws_ec2_instance_type_offerings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions aws/data_source_aws_ec2_local_gateway_route_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_ec2_local_gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions aws/data_source_aws_ec2_spot_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
3 changes: 1 addition & 2 deletions aws/data_source_aws_efs_access_points.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package aws

import (
"fmt"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/efs"
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions aws/data_source_aws_glue_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"log"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/glue"
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_inspector_rules_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions aws/data_source_aws_kms_ciphertext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)),
Expand All @@ -60,6 +57,8 @@ func dataSourceAwsKmsCiphertextRead(d *schema.ResourceData, meta interface{}) er
return err
}

d.SetId(aws.StringValue(resp.KeyId))

d.Set("ciphertext_blob", base64.StdEncoding.EncodeToString(resp.CiphertextBlob))

return nil
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_network_acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_network_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions aws/data_source_aws_organizations_organizational_units.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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),
Expand All @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions aws/data_source_aws_outposts_outposts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
3 changes: 1 addition & 2 deletions aws/data_source_aws_outposts_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Loading

0 comments on commit 6f4442a

Please sign in to comment.