Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech debt: Reduce tags boilerplate code - PoC #29838

Merged
merged 78 commits into from
Mar 23, 2023
Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Mar 7, 2023

Description

Attempts to reduce the amount of boilerplate tags-related code in each resource by centralizing that code.
This proof of concept implementation modifies a small number of resources implemented using Plugin SDK v2 or Plugin Framework:

  • aws_sns_topic
  • aws_vpc
  • aws_resourceexplorer2_index

Self-registration for all resources has opened up additional possibilities that allow common functionality to be injected transparently on initialization and run during resource CRUD operations.

Details

Function Annotations

Use an annotation on each resource’s (and data source’s) factory function to opt in to transparent tags handling. This annotation mechanism is similar to the one used for resource self-registration - A specially formatted comment is added to eligible functions and the code generation build step (make gen) generates a structure exported from each service package containing information processed during provider initialization.

The proposed syntax for the annotation is

// @SDKResource("aws_service_thing")
// @Tags(identifierAttribute="arn")
func ResourceServiceThing() *schema.Resource {

where identifierAttribute is the name of the attribute in the resource’s schema that is used in ListTags and UpdateTags calls.

Inject Interceptors

Interceptors are a mechanism to flexibly and extensibly change or augment a software system’s usual processing cycle. For the Terraform AWS Provider we will implement an interceptor capability to dynamically change resource CRUD handler processing.

Interceptors consist of a When and a Why:

// When represents the point in the CRUD request lifecycle that an interceptor is run.
// Multiple values can be ORed together.
type When uint16

const (
	Before  When = 1 << iota // Interceptor is invoked before call to method in schema
	After                    // Interceptor is invoked after successful call to method in schema
	OnError                  // Interceptor is invoked after unsuccessful call to method in schema
	Finally                  // Interceptor is invoked after After or OnError
)

// Why represents the CRUD operation(s) that an interceptor is run.
// Multiple values can be ORed together.
type Why uint16

const (
	Create Why = 1 << iota // Interceptor is invoked for a Create call
	Read                   // Interceptor is invoked for a Read call
	Update                 // Interceptor is invoked for a Update call
	Delete                 // Interceptor is invoked for a Delete call
)

and functionality that is run on match.

Interceptors register with a dispatcher and this dispatcher is invoked on each CRUD request.

  • Before interceptors are run in registration order
    • If any Before interceptor reports an error, the dispatcher immediately returns
  • The resource’s original CRUD handler is invoked
  • If the original CRUD handler reports no error, After interceptors are run in reverse order
  • Else OnError interceptors are run in reverse order
  • Finally interceptors are run in reverse order

There are interceptor variants for Plugin SDK v2 and Plugin Framework resources, as CRUD handler signatures differ.

Each interceptor has access to the current Context, handler request and response (via schema.ResourceData for Terraform Plugin SDK) and provider state (meta for Terraform Plugin SDK).
Interceptors return a Context (so as to be able to enrich the passed in Context) and Diagnostics (so as to accumulate and signal errors and warnings).

Transparent Tagging Interceptor

During provider initialization, as the lists of supported resources and data sources are being built, inspect the information generated from the annotations and, if transparent tagging support is enabled, inject an interceptor around each of the resource’s CRUD handlers.

The transparent tagging interceptor will run Before and After resource Create, Read and Update and will

  • Enhance the Context, adding default_tags and ignore_tags values from provider state
// InContext represents the tagging information kept in Context.
type InContext struct {
	DefaultConfig *DefaultConfig
	IgnoreConfig  *IgnoreConfig
}
  • Before Update, if the resource’s service package implements an UpdateTags method, run standard tags update logic:
if d.HasChange("tags_all") {
	o, n := d.GetChange("tags_all")
	err := v.UpdateTags(ctx, meta, identifier, o, n)
	...
})

where identifier is the value of the Tags annotation’s identifierAttribute field

  • After Create, Read or Update, if the resource’s service package implements a ListTags method, run standard tags read logic:
tags, err := v.ListTags(ctx, meta, identifier)
...
tags = tags.IgnoreAWS().IgnoreConfig(t.IgnoreConfig)

if err := d.Set("tags", tags.RemoveDefaultConfig(t.DefaultConfig).Map()); err != nil {
	return ctx, sdkdiag.AppendErrorf(diags, "setting tags: %s", err)
}

if err := d.Set("tags_all", tags.Map()); err != nil {
	return ctx, sdkdiag.AppendErrorf(diags, "setting tags_all: %s", err)
}

Boilerplate tagging code can now be removed from the resource’s CRUD handler functions.

Relations

Relates #29747.

Output from Acceptance Testing

% make sanity ACCTEST_PARALLELISM=3
==> Sanity Check (48 tests of Top 30 resources)
==> NOTE: This is meant to find big problems with the provider as a whole.
==> This is not an exhaustive test.
=== RUN   TestAccLogsGroup_basic
=== PAUSE TestAccLogsGroup_basic
=== RUN   TestAccLogsGroup_multiple
=== PAUSE TestAccLogsGroup_multiple
=== CONT  TestAccLogsGroup_basic
=== CONT  TestAccLogsGroup_multiple
--- PASS: TestAccLogsGroup_multiple (43.08s)
--- PASS: TestAccLogsGroup_basic (47.20s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/logs	67.007s
=== RUN   TestAccVPCDataSource_basic
=== PAUSE TestAccVPCDataSource_basic
=== RUN   TestAccVPCRouteTableAssociation_Subnet_basic
=== PAUSE TestAccVPCRouteTableAssociation_Subnet_basic
=== RUN   TestAccVPCRouteTable_basic
=== PAUSE TestAccVPCRouteTable_basic
=== RUN   TestAccVPCSecurityGroupRule_race
=== PAUSE TestAccVPCSecurityGroupRule_race
=== RUN   TestAccVPCSecurityGroupRule_protocolChange
=== PAUSE TestAccVPCSecurityGroupRule_protocolChange
=== RUN   TestAccVPCSecurityGroup_basic
=== PAUSE TestAccVPCSecurityGroup_basic
=== RUN   TestAccVPCSecurityGroup_ipRangesWithSameRules
=== PAUSE TestAccVPCSecurityGroup_ipRangesWithSameRules
=== RUN   TestAccVPCSecurityGroup_vpcAllEgress
=== PAUSE TestAccVPCSecurityGroup_vpcAllEgress
=== RUN   TestAccVPCSubnet_basic
=== PAUSE TestAccVPCSubnet_basic
=== RUN   TestAccVPC_tenancy
=== PAUSE TestAccVPC_tenancy
=== CONT  TestAccVPCDataSource_basic
=== CONT  TestAccVPCSecurityGroup_basic
=== CONT  TestAccVPC_tenancy
--- PASS: TestAccVPCSecurityGroup_basic (55.85s)
=== CONT  TestAccVPCSubnet_basic
--- PASS: TestAccVPCDataSource_basic (61.87s)
=== CONT  TestAccVPCSecurityGroup_vpcAllEgress
--- PASS: TestAccVPCSubnet_basic (46.17s)
=== CONT  TestAccVPCSecurityGroup_ipRangesWithSameRules
--- PASS: TestAccVPCSecurityGroup_vpcAllEgress (47.46s)
=== CONT  TestAccVPCSecurityGroupRule_race
--- PASS: TestAccVPC_tenancy (115.52s)
=== CONT  TestAccVPCSecurityGroupRule_protocolChange
--- PASS: TestAccVPCSecurityGroup_ipRangesWithSameRules (38.28s)
=== CONT  TestAccVPCRouteTable_basic
--- PASS: TestAccVPCRouteTable_basic (35.32s)
=== CONT  TestAccVPCRouteTableAssociation_Subnet_basic
--- PASS: TestAccVPCSecurityGroupRule_protocolChange (94.03s)
--- PASS: TestAccVPCRouteTableAssociation_Subnet_basic (58.27s)
--- PASS: TestAccVPCSecurityGroupRule_race (181.80s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	318.855s
=== RUN   TestAccECSService_basic
=== PAUSE TestAccECSService_basic
=== RUN   TestAccECSService_basicImport
=== PAUSE TestAccECSService_basicImport
=== RUN   TestAccECSTaskDefinition_basic
=== PAUSE TestAccECSTaskDefinition_basic
=== CONT  TestAccECSService_basic
=== CONT  TestAccECSTaskDefinition_basic
=== CONT  TestAccECSService_basicImport
--- PASS: TestAccECSTaskDefinition_basic (79.63s)
--- PASS: TestAccECSService_basic (132.06s)
--- PASS: TestAccECSService_basicImport (223.75s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecs	238.000s
=== RUN   TestAccELBV2TargetGroup_basic
=== PAUSE TestAccELBV2TargetGroup_basic
=== CONT  TestAccELBV2TargetGroup_basic
--- PASS: TestAccELBV2TargetGroup_basic (46.52s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/elbv2	53.999s
=== RUN   TestAccIAMInstanceProfile_basic
=== PAUSE TestAccIAMInstanceProfile_basic
=== RUN   TestAccIAMInstanceProfile_tags
=== PAUSE TestAccIAMInstanceProfile_tags
=== RUN   TestAccIAMPolicyDocumentDataSource_basic
=== PAUSE TestAccIAMPolicyDocumentDataSource_basic
=== RUN   TestAccIAMPolicyDocumentDataSource_sourceConflicting
=== PAUSE TestAccIAMPolicyDocumentDataSource_sourceConflicting
=== RUN   TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON
=== PAUSE TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON
=== RUN   TestAccIAMPolicy_basic
=== PAUSE TestAccIAMPolicy_basic
=== RUN   TestAccIAMPolicy_tags
=== PAUSE TestAccIAMPolicy_tags
=== RUN   TestAccIAMPolicy_policy
=== PAUSE TestAccIAMPolicy_policy
=== RUN   TestAccIAMRolePolicyAttachment_basic
=== PAUSE TestAccIAMRolePolicyAttachment_basic
=== RUN   TestAccIAMRolePolicyAttachment_disappears
=== PAUSE TestAccIAMRolePolicyAttachment_disappears
=== RUN   TestAccIAMRolePolicyAttachment_Disappears_role
=== PAUSE TestAccIAMRolePolicyAttachment_Disappears_role
=== RUN   TestAccIAMRolePolicy_basic
=== PAUSE TestAccIAMRolePolicy_basic
=== RUN   TestAccIAMRolePolicy_unknownsInPolicy
=== PAUSE TestAccIAMRolePolicy_unknownsInPolicy
=== RUN   TestAccIAMRole_basic
=== PAUSE TestAccIAMRole_basic
=== RUN   TestAccIAMRole_namePrefix
=== PAUSE TestAccIAMRole_namePrefix
=== RUN   TestAccIAMRole_disappears
=== PAUSE TestAccIAMRole_disappears
=== RUN   TestAccIAMRole_InlinePolicy_basic
=== PAUSE TestAccIAMRole_InlinePolicy_basic
=== CONT  TestAccIAMInstanceProfile_basic
=== CONT  TestAccIAMRolePolicyAttachment_disappears
=== CONT  TestAccIAMRole_InlinePolicy_basic
--- PASS: TestAccIAMRolePolicyAttachment_disappears (42.20s)
=== CONT  TestAccIAMRole_disappears
--- PASS: TestAccIAMInstanceProfile_basic (48.63s)
=== CONT  TestAccIAMRole_namePrefix
--- PASS: TestAccIAMRole_disappears (39.73s)
=== CONT  TestAccIAMRole_basic
--- PASS: TestAccIAMRole_namePrefix (47.73s)
=== CONT  TestAccIAMRolePolicy_unknownsInPolicy
--- PASS: TestAccIAMRole_InlinePolicy_basic (109.82s)
=== CONT  TestAccIAMRolePolicy_basic
=== CONT  TestAccIAMRolePolicy_unknownsInPolicy
    role_policy_test.go:261: Step 1/1 error: Error running apply: exit status 1
        
        Error: error creating S3 bucket ACL for tf-acc-test-7732178383407774463: AccessControlListNotSupported: The bucket does not allow ACLs
        	status code: 400, request id: 3G4Q7KYC0XFK1P9S, host id: rZJ4bVUMaLrO7Op0lzMkQVjudj3qJ9HThVCT/Uzi88Mt+1LSAdZxyhcHaAH9jLamd0GD+jNiXMY=
        
          with aws_s3_bucket_acl.test,
          on terraform_plugin_test.tf line 26, in resource "aws_s3_bucket_acl" "test":
          26: resource "aws_s3_bucket_acl" "test" {
        
--- FAIL: TestAccIAMRolePolicy_unknownsInPolicy (19.98s)
=== CONT  TestAccIAMRolePolicyAttachment_Disappears_role
--- PASS: TestAccIAMRole_basic (40.11s)
=== CONT  TestAccIAMPolicy_basic
--- PASS: TestAccIAMRolePolicyAttachment_Disappears_role (25.91s)
=== CONT  TestAccIAMRolePolicyAttachment_basic
--- PASS: TestAccIAMPolicy_basic (29.98s)
=== CONT  TestAccIAMPolicy_policy
--- PASS: TestAccIAMRolePolicy_basic (51.22s)
=== CONT  TestAccIAMPolicy_tags
--- PASS: TestAccIAMRolePolicyAttachment_basic (46.01s)
=== CONT  TestAccIAMPolicyDocumentDataSource_sourceConflicting
--- PASS: TestAccIAMPolicy_policy (48.54s)
=== CONT  TestAccIAMPolicyDocumentDataSource_basic
--- PASS: TestAccIAMPolicyDocumentDataSource_sourceConflicting (22.75s)
=== CONT  TestAccIAMInstanceProfile_tags
--- PASS: TestAccIAMPolicyDocumentDataSource_basic (33.89s)
=== CONT  TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON
--- PASS: TestAccIAMPolicy_tags (85.69s)
--- PASS: TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON (32.99s)
--- PASS: TestAccIAMInstanceProfile_tags (81.34s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/iam	302.944s
=== RUN   TestAccKMSKey_basic
=== PAUSE TestAccKMSKey_basic
=== CONT  TestAccKMSKey_basic
--- PASS: TestAccKMSKey_basic (46.68s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/kms	70.232s
=== RUN   TestAccLambdaFunction_basic
=== PAUSE TestAccLambdaFunction_basic
=== RUN   TestAccLambdaPermission_basic
=== PAUSE TestAccLambdaPermission_basic
=== CONT  TestAccLambdaFunction_basic
=== CONT  TestAccLambdaPermission_basic
--- PASS: TestAccLambdaPermission_basic (63.56s)
--- PASS: TestAccLambdaFunction_basic (69.15s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lambda	103.476s
=== RUN   TestAccMetaPartitionDataSource_basic
=== PAUSE TestAccMetaPartitionDataSource_basic
=== RUN   TestAccMetaRegionDataSource_basic
=== PAUSE TestAccMetaRegionDataSource_basic
=== RUN   TestAccMetaRegionDataSource_endpoint
=== PAUSE TestAccMetaRegionDataSource_endpoint
=== RUN   TestAccMetaRegionDataSource_endpointAndName
=== PAUSE TestAccMetaRegionDataSource_endpointAndName
=== CONT  TestAccMetaPartitionDataSource_basic
=== CONT  TestAccMetaRegionDataSource_basic
=== CONT  TestAccMetaRegionDataSource_endpointAndName
--- PASS: TestAccMetaPartitionDataSource_basic (33.27s)
=== CONT  TestAccMetaRegionDataSource_endpoint
--- PASS: TestAccMetaRegionDataSource_basic (36.05s)
--- PASS: TestAccMetaRegionDataSource_endpointAndName (36.22s)
--- PASS: TestAccMetaRegionDataSource_endpoint (25.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	78.287s
=== RUN   TestAccRoute53Record_basic
=== PAUSE TestAccRoute53Record_basic
=== RUN   TestAccRoute53Record_Latency_basic
=== PAUSE TestAccRoute53Record_Latency_basic
=== RUN   TestAccRoute53ZoneDataSource_name
=== PAUSE TestAccRoute53ZoneDataSource_name
=== CONT  TestAccRoute53Record_basic
=== CONT  TestAccRoute53ZoneDataSource_name
=== CONT  TestAccRoute53Record_Latency_basic
--- PASS: TestAccRoute53ZoneDataSource_name (72.25s)
--- PASS: TestAccRoute53Record_basic (140.35s)
--- PASS: TestAccRoute53Record_Latency_basic (150.80s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/route53	183.104s
=== RUN   TestAccS3BucketACL_updateACL
=== PAUSE TestAccS3BucketACL_updateACL
=== RUN   TestAccS3BucketPolicy_basic
=== PAUSE TestAccS3BucketPolicy_basic
=== RUN   TestAccS3BucketPublicAccessBlock_basic
=== PAUSE TestAccS3BucketPublicAccessBlock_basic
=== RUN   TestAccS3Bucket_Basic_basic
=== PAUSE TestAccS3Bucket_Basic_basic
=== RUN   TestAccS3Bucket_Security_corsUpdate
=== PAUSE TestAccS3Bucket_Security_corsUpdate
=== CONT  TestAccS3BucketACL_updateACL
=== CONT  TestAccS3Bucket_Basic_basic
=== CONT  TestAccS3BucketPublicAccessBlock_basic
=== CONT  TestAccS3BucketACL_updateACL
    bucket_acl_test.go:476: Step 1/3 error: Error running apply: exit status 1
        
        Error: error creating S3 bucket ACL for tf-test-bucket-5854458102035455282: AccessDenied: Access Denied
        	status code: 403, request id: RGPMJ85ZCWH13A0B, host id: rP8/SIzO9sjAjyopeKXIk6zE1ACNNY30zC672hI609pzLjpNcbDZ5ImrqeC7za/PWk8IyarFLU/bCUX8KQbgxA==
        
          with aws_s3_bucket_acl.test,
          on terraform_plugin_test.tf line 6, in resource "aws_s3_bucket_acl" "test":
           6: resource "aws_s3_bucket_acl" "test" {
        
--- FAIL: TestAccS3BucketACL_updateACL (33.53s)
=== CONT  TestAccS3BucketPolicy_basic
    bucket_policy_test.go:43: Step 1/2 error: Error running apply: exit status 1
        
        Error: Error putting S3 policy: AccessDenied: Access Denied
        	status code: 403, request id: 7QSW49P5YFGDB13W, host id: 4hhjTCaldaMXuEN55Cr8/dvnJ8XqJeZdLCD2S50iTV7NPCfY+3vWzz1fWDJLquUHHV4S2qouDC4=
        
          with aws_s3_bucket_policy.bucket,
          on terraform_plugin_test.tf line 10, in resource "aws_s3_bucket_policy" "bucket":
          10: resource "aws_s3_bucket_policy" "bucket" {
        
--- FAIL: TestAccS3BucketPolicy_basic (20.20s)
=== CONT  TestAccS3Bucket_Security_corsUpdate
--- PASS: TestAccS3Bucket_Basic_basic (55.91s)
--- PASS: TestAccS3BucketPublicAccessBlock_basic (56.86s)
--- PASS: TestAccS3Bucket_Security_corsUpdate (40.93s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/s3	108.154s
=== RUN   TestAccSecretsManagerSecret_basic
=== PAUSE TestAccSecretsManagerSecret_basic
=== RUN   TestAccSecretsManagerSecret_basicReplica
=== PAUSE TestAccSecretsManagerSecret_basicReplica
=== CONT  TestAccSecretsManagerSecret_basic
=== CONT  TestAccSecretsManagerSecret_basicReplica
--- PASS: TestAccSecretsManagerSecret_basic (56.06s)
--- PASS: TestAccSecretsManagerSecret_basicReplica (62.88s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager	71.781s
=== RUN   TestAccSTSCallerIdentityDataSource_basic
=== PAUSE TestAccSTSCallerIdentityDataSource_basic
=== CONT  TestAccSTSCallerIdentityDataSource_basic
--- PASS: TestAccSTSCallerIdentityDataSource_basic (35.56s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sts	58.199s
FAIL
make: *** [sanity] Error 1

Failures are unrelated to this change.

% make testacc TESTARGS='-run=TestAccSNSTopic_' PKG=sns ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 3  -run=TestAccSNSTopic_ -timeout 180m
=== RUN   TestAccSNSTopic_basic
=== PAUSE TestAccSNSTopic_basic
=== RUN   TestAccSNSTopic_disappears
=== PAUSE TestAccSNSTopic_disappears
=== RUN   TestAccSNSTopic_name
=== PAUSE TestAccSNSTopic_name
=== RUN   TestAccSNSTopic_namePrefix
=== PAUSE TestAccSNSTopic_namePrefix
=== RUN   TestAccSNSTopic_tags
=== PAUSE TestAccSNSTopic_tags
=== RUN   TestAccSNSTopic_policy
=== PAUSE TestAccSNSTopic_policy
=== RUN   TestAccSNSTopic_withIAMRole
=== PAUSE TestAccSNSTopic_withIAMRole
=== RUN   TestAccSNSTopic_withFakeIAMRole
=== PAUSE TestAccSNSTopic_withFakeIAMRole
=== RUN   TestAccSNSTopic_withDeliveryPolicy
=== PAUSE TestAccSNSTopic_withDeliveryPolicy
=== RUN   TestAccSNSTopic_deliveryStatus
=== PAUSE TestAccSNSTopic_deliveryStatus
=== RUN   TestAccSNSTopic_NameGenerated_fifoTopic
=== PAUSE TestAccSNSTopic_NameGenerated_fifoTopic
=== RUN   TestAccSNSTopic_Name_fifoTopic
=== PAUSE TestAccSNSTopic_Name_fifoTopic
=== RUN   TestAccSNSTopic_NamePrefix_fifoTopic
=== PAUSE TestAccSNSTopic_NamePrefix_fifoTopic
=== RUN   TestAccSNSTopic_fifoWithContentBasedDeduplication
=== PAUSE TestAccSNSTopic_fifoWithContentBasedDeduplication
=== RUN   TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== PAUSE TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
=== RUN   TestAccSNSTopic_encryption
=== PAUSE TestAccSNSTopic_encryption
=== CONT  TestAccSNSTopic_basic
=== CONT  TestAccSNSTopic_withDeliveryPolicy
=== CONT  TestAccSNSTopic_NamePrefix_fifoTopic
--- PASS: TestAccSNSTopic_basic (22.50s)
=== CONT  TestAccSNSTopic_fifoExpectContentBasedDeduplicationError
--- PASS: TestAccSNSTopic_NamePrefix_fifoTopic (22.59s)
=== CONT  TestAccSNSTopic_encryption
--- PASS: TestAccSNSTopic_withDeliveryPolicy (23.02s)
=== CONT  TestAccSNSTopic_NameGenerated_fifoTopic
--- PASS: TestAccSNSTopic_fifoExpectContentBasedDeduplicationError (2.72s)
=== CONT  TestAccSNSTopic_Name_fifoTopic
--- PASS: TestAccSNSTopic_NameGenerated_fifoTopic (19.91s)
=== CONT  TestAccSNSTopic_deliveryStatus
--- PASS: TestAccSNSTopic_Name_fifoTopic (19.41s)
=== CONT  TestAccSNSTopic_tags
--- PASS: TestAccSNSTopic_encryption (31.24s)
=== CONT  TestAccSNSTopic_withFakeIAMRole
--- PASS: TestAccSNSTopic_deliveryStatus (31.48s)
=== CONT  TestAccSNSTopic_withIAMRole
--- PASS: TestAccSNSTopic_tags (42.65s)
=== CONT  TestAccSNSTopic_policy
--- PASS: TestAccSNSTopic_withIAMRole (28.72s)
=== CONT  TestAccSNSTopic_fifoWithContentBasedDeduplication
--- PASS: TestAccSNSTopic_policy (19.07s)
=== CONT  TestAccSNSTopic_name
--- PASS: TestAccSNSTopic_name (16.74s)
=== CONT  TestAccSNSTopic_namePrefix
--- PASS: TestAccSNSTopic_fifoWithContentBasedDeduplication (27.58s)
=== CONT  TestAccSNSTopic_disappears
--- PASS: TestAccSNSTopic_namePrefix (16.19s)
--- PASS: TestAccSNSTopic_disappears (12.30s)
--- PASS: TestAccSNSTopic_withFakeIAMRole (128.25s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	187.793s
% make testacc TESTARGS='-run=TestAccResourceExplorer2_serial/Index' PKG=resourceexplorer2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/resourceexplorer2/... -v -count 1 -parallel 20  -run=TestAccResourceExplorer2_serial/Index -timeout 180m
=== RUN   TestAccResourceExplorer2_serial
=== PAUSE TestAccResourceExplorer2_serial
=== CONT  TestAccResourceExplorer2_serial
=== RUN   TestAccResourceExplorer2_serial/Index
=== RUN   TestAccResourceExplorer2_serial/Index/basic
=== RUN   TestAccResourceExplorer2_serial/Index/disappears
=== RUN   TestAccResourceExplorer2_serial/Index/tags
=== RUN   TestAccResourceExplorer2_serial/Index/type
--- PASS: TestAccResourceExplorer2_serial (114.05s)
    --- PASS: TestAccResourceExplorer2_serial/Index (114.05s)
        --- PASS: TestAccResourceExplorer2_serial/Index/basic (19.26s)
        --- PASS: TestAccResourceExplorer2_serial/Index/disappears (16.40s)
        --- PASS: TestAccResourceExplorer2_serial/Index/tags (44.25s)
        --- PASS: TestAccResourceExplorer2_serial/Index/type (34.14s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/resourceexplorer2	119.013s
% make testacc TESTARGS='-run=TestAccVPC_' PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3  -run=TestAccVPC_ -timeout 180m
=== RUN   TestAccVPC_basic
=== PAUSE TestAccVPC_basic
=== RUN   TestAccVPC_disappears
=== PAUSE TestAccVPC_disappears
=== RUN   TestAccVPC_tags
=== PAUSE TestAccVPC_tags
=== RUN   TestAccVPC_DefaultTags_providerOnly
=== PAUSE TestAccVPC_DefaultTags_providerOnly
=== RUN   TestAccVPC_DefaultTags_updateToProviderOnly
=== PAUSE TestAccVPC_DefaultTags_updateToProviderOnly
=== RUN   TestAccVPC_DefaultTags_updateToResourceOnly
=== PAUSE TestAccVPC_DefaultTags_updateToResourceOnly
=== RUN   TestAccVPC_DefaultTagsProviderAndResource_nonOverlappingTag
=== PAUSE TestAccVPC_DefaultTagsProviderAndResource_nonOverlappingTag
=== RUN   TestAccVPC_DefaultTagsProviderAndResource_overlappingTag
=== PAUSE TestAccVPC_DefaultTagsProviderAndResource_overlappingTag
=== RUN   TestAccVPC_DefaultTagsProviderAndResource_duplicateTag
=== PAUSE TestAccVPC_DefaultTagsProviderAndResource_duplicateTag
=== RUN   TestAccVPC_DynamicResourceTagsMergedWithLocals_ignoreChanges
=== PAUSE TestAccVPC_DynamicResourceTagsMergedWithLocals_ignoreChanges
=== RUN   TestAccVPC_DynamicResourceTags_ignoreChanges
=== PAUSE TestAccVPC_DynamicResourceTags_ignoreChanges
=== RUN   TestAccVPC_defaultAndIgnoreTags
=== PAUSE TestAccVPC_defaultAndIgnoreTags
=== RUN   TestAccVPC_ignoreTags
=== PAUSE TestAccVPC_ignoreTags
=== RUN   TestAccVPC_tenancy
=== PAUSE TestAccVPC_tenancy
=== RUN   TestAccVPC_updateDNSHostnames
=== PAUSE TestAccVPC_updateDNSHostnames
=== RUN   TestAccVPC_bothDNSOptionsSet
=== PAUSE TestAccVPC_bothDNSOptionsSet
=== RUN   TestAccVPC_disabledDNSSupport
=== PAUSE TestAccVPC_disabledDNSSupport
=== RUN   TestAccVPC_enableNetworkAddressUsageMetrics
=== PAUSE TestAccVPC_enableNetworkAddressUsageMetrics
=== RUN   TestAccVPC_assignGeneratedIPv6CIDRBlock
=== PAUSE TestAccVPC_assignGeneratedIPv6CIDRBlock
=== RUN   TestAccVPC_assignGeneratedIPv6CIDRBlockWithNetworkBorderGroup
=== PAUSE TestAccVPC_assignGeneratedIPv6CIDRBlockWithNetworkBorderGroup
=== RUN   TestAccVPC_IPAMIPv4BasicNetmask
=== PAUSE TestAccVPC_IPAMIPv4BasicNetmask
=== RUN   TestAccVPC_IPAMIPv4BasicExplicitCIDR
=== PAUSE TestAccVPC_IPAMIPv4BasicExplicitCIDR
=== CONT  TestAccVPC_basic
=== CONT  TestAccVPC_defaultAndIgnoreTags
=== CONT  TestAccVPC_enableNetworkAddressUsageMetrics
--- PASS: TestAccVPC_basic (21.27s)
=== CONT  TestAccVPC_updateDNSHostnames
--- PASS: TestAccVPC_enableNetworkAddressUsageMetrics (31.39s)
=== CONT  TestAccVPC_disabledDNSSupport
--- PASS: TestAccVPC_defaultAndIgnoreTags (36.10s)
=== CONT  TestAccVPC_bothDNSOptionsSet
--- PASS: TestAccVPC_updateDNSHostnames (41.40s)
=== CONT  TestAccVPC_tenancy
--- PASS: TestAccVPC_disabledDNSSupport (31.70s)
=== CONT  TestAccVPC_DefaultTagsProviderAndResource_nonOverlappingTag
--- PASS: TestAccVPC_bothDNSOptionsSet (34.01s)
=== CONT  TestAccVPC_DynamicResourceTags_ignoreChanges
--- PASS: TestAccVPC_DynamicResourceTags_ignoreChanges (35.00s)
=== CONT  TestAccVPC_DynamicResourceTagsMergedWithLocals_ignoreChanges
--- PASS: TestAccVPC_DefaultTagsProviderAndResource_nonOverlappingTag (48.26s)
=== CONT  TestAccVPC_DefaultTagsProviderAndResource_duplicateTag
--- PASS: TestAccVPC_DefaultTagsProviderAndResource_duplicateTag (2.22s)
=== CONT  TestAccVPC_DefaultTagsProviderAndResource_overlappingTag
--- PASS: TestAccVPC_tenancy (57.28s)
=== CONT  TestAccVPC_IPAMIPv4BasicNetmask
--- PASS: TestAccVPC_DynamicResourceTagsMergedWithLocals_ignoreChanges (36.17s)
=== CONT  TestAccVPC_IPAMIPv4BasicExplicitCIDR
=== CONT  TestAccVPC_IPAMIPv4BasicNetmask
    acctest.go:1342: skipping test for aws/us-west-2: Error running apply: exit status 1
        
        Error: creating EC2 VPC: UnsupportedOperation: The operation AllocateIpamPoolCidr is not supported. Account 123456789012 is not monitored by IPAM ipam-0128f37b278700ac6.
        	status code: 400, request id: 69e228b2-92cc-4f9d-bac7-cd770964ee65
        
          with aws_vpc.test,
          on terraform_plugin_test.tf line 29, in resource "aws_vpc" "test":
          29: resource "aws_vpc" "test" {
        
--- PASS: TestAccVPC_DefaultTagsProviderAndResource_overlappingTag (45.55s)
=== CONT  TestAccVPC_ignoreTags
=== CONT  TestAccVPC_IPAMIPv4BasicExplicitCIDR
    acctest.go:1342: skipping test for aws/us-west-2: Error running apply: exit status 1
        
        Error: creating EC2 VPC: UnsupportedOperation: The operation AllocateIpamPoolCidr is not supported. Account 123456789012 is not monitored by IPAM ipam-040f3e350c695175b.
        	status code: 400, request id: 462e8b58-3e01-4b42-a18c-6f61935d524c
        
          with aws_vpc.test,
          on terraform_plugin_test.tf line 29, in resource "aws_vpc" "test":
          29: resource "aws_vpc" "test" {
        
--- PASS: TestAccVPC_ignoreTags (35.70s)
=== CONT  TestAccVPC_DefaultTags_providerOnly
--- SKIP: TestAccVPC_IPAMIPv4BasicNetmask (82.21s)
=== CONT  TestAccVPC_DefaultTags_updateToResourceOnly
--- SKIP: TestAccVPC_IPAMIPv4BasicExplicitCIDR (79.75s)
=== CONT  TestAccVPC_DefaultTags_updateToProviderOnly
--- PASS: TestAccVPC_DefaultTags_updateToResourceOnly (30.81s)
=== CONT  TestAccVPC_assignGeneratedIPv6CIDRBlockWithNetworkBorderGroup
--- PASS: TestAccVPC_DefaultTags_providerOnly (41.56s)
=== CONT  TestAccVPC_assignGeneratedIPv6CIDRBlock
=== CONT  TestAccVPC_assignGeneratedIPv6CIDRBlockWithNetworkBorderGroup
    vpc_test.go:819: Step 1/3 error: Error running apply: exit status 1
        
        Error: creating EC2 VPC: InvalidParameterValue: us-west-2-las-1
        	status code: 400, request id: ac9ce922-9af9-4a8c-8974-8a587a8076cc
        
          with aws_vpc.test,
          on terraform_plugin_test.tf line 22, in resource "aws_vpc" "test":
          22: resource "aws_vpc" "test" {
        
--- FAIL: TestAccVPC_assignGeneratedIPv6CIDRBlockWithNetworkBorderGroup (8.36s)
=== CONT  TestAccVPC_tags
--- PASS: TestAccVPC_DefaultTags_updateToProviderOnly (31.92s)
=== CONT  TestAccVPC_disappears
--- PASS: TestAccVPC_disappears (16.82s)
--- PASS: TestAccVPC_tags (54.26s)
--- PASS: TestAccVPC_assignGeneratedIPv6CIDRBlock (84.85s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	326.178s
FAIL
make: *** [testacc] Error 1

Failures are unrelated to this change.

@github-actions
Copy link

github-actions bot commented Mar 7, 2023

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added the size/XL Managed by automation to categorize the size of a PR. label Mar 7, 2023
@ewbankkit ewbankkit added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label Mar 7, 2023
@ewbankkit ewbankkit marked this pull request as ready for review March 22, 2023 19:56
@ewbankkit ewbankkit changed the title Tech debt: Reduce tags boilerplate code Tech debt: Reduce tags boilerplate code - PoC Mar 23, 2023
@ewbankkit ewbankkit merged commit f5f0e1a into main Mar 23, 2023
@ewbankkit ewbankkit deleted the f-reduce-tags-boilerplate branch March 23, 2023 18:42
@github-actions github-actions bot added this to the v4.60.0 milestone Mar 23, 2023
github-actions bot pushed a commit that referenced this pull request Mar 23, 2023
@github-actions
Copy link

This functionality has been released in v4.60.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. provider Pertains to the provider itself, rather than any interaction with AWS. service/resourceexplorer2 Issues and PRs that pertain to the resourceexplorer2 service. service/sns Issues and PRs that pertain to the sns service. service/vpc Issues and PRs that pertain to the vpc service. size/XL Managed by automation to categorize the size of a PR. tags Pertains to resource tagging. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants