From f80d1d8effdae7dc9f4e7178746d68d77288c1e9 Mon Sep 17 00:00:00 2001 From: Madhav Vishnubhatta Date: Thu, 21 Nov 2024 13:51:35 +0000 Subject: [PATCH 01/14] New resource aws_vpc_block_public_access_exclusion --- internal/service/ec2/errors.go | 1 + internal/service/ec2/exports_test.go | 1 + internal/service/ec2/service_package_gen.go | 7 + .../tags/main_gen.tf | 26 + .../tagsComputed1/main_gen.tf | 30 + .../tagsComputed2/main_gen.tf | 41 + .../tags_defaults/main_gen.tf | 37 + .../tags_ignore/main_gen.tf | 46 + ...pc_block_public_access_exclusion_tags.gtpl | 10 + .../ec2/vpc_block_public_access_exclusion.go | 483 ++++ ...k_public_access_exclusion_tags_gen_test.go | 2237 +++++++++++++++++ .../vpc_block_public_access_exclusion_test.go | 272 ++ ...lock_public_access_exclusion.html.markdown | 93 + 13 files changed, 3284 insertions(+) create mode 100644 internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf create mode 100644 internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf create mode 100644 internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf create mode 100644 internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf create mode 100644 internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf create mode 100644 internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl create mode 100644 internal/service/ec2/vpc_block_public_access_exclusion.go create mode 100644 internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go create mode 100644 internal/service/ec2/vpc_block_public_access_exclusion_test.go create mode 100644 website/docs/r/vpc_block_public_access_exclusion.html.markdown diff --git a/internal/service/ec2/errors.go b/internal/service/ec2/errors.go index 4be42cf480e..8747006586f 100644 --- a/internal/service/ec2/errors.go +++ b/internal/service/ec2/errors.go @@ -138,6 +138,7 @@ const ( errCodeVPNConnectionLimitExceeded = "VpnConnectionLimitExceeded" errCodeVPNGatewayLimitExceeded = "VpnGatewayLimitExceeded" errCodeVolumeInUse = "VolumeInUse" + errCodeInvalidVpcBlockPublicAccessExclusionId = "InvalidVpcBlockPublicAccessExclusionId.NotFound" ) func cancelSpotFleetRequestError(apiObject *awstypes.CancelSpotFleetRequestsError) error { diff --git a/internal/service/ec2/exports_test.go b/internal/service/ec2/exports_test.go index 62696df93b7..ec2eac4cc5e 100644 --- a/internal/service/ec2/exports_test.go +++ b/internal/service/ec2/exports_test.go @@ -123,6 +123,7 @@ var ( ResourceVerifiedAccessInstanceTrustProviderAttachment = resourceVerifiedAccessInstanceTrustProviderAttachment ResourceVerifiedAccessTrustProvider = resourceVerifiedAccessTrustProvider ResourceVolumeAttachment = resourceVolumeAttachment + ResourceVPCBlockPublicAccessExclusion = newResourceVPCBlockPublicAccessExclusion CustomFiltersSchema = customFiltersSchema CustomerGatewayConfigurationToTunnelInfo = customerGatewayConfigurationToTunnelInfo diff --git a/internal/service/ec2/service_package_gen.go b/internal/service/ec2/service_package_gen.go index 05915034f5d..589955b4734 100644 --- a/internal/service/ec2/service_package_gen.go +++ b/internal/service/ec2/service_package_gen.go @@ -65,6 +65,13 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic Factory: newResourceSecurityGroupVPCAssociation, Name: "Security Group VPC Association", }, + { + Factory: newResourceVPCBlockPublicAccessExclusion, + Name: "Block Public Access Exclusion", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: names.AttrID, + }, + }, { Factory: newResourceVPCBlockPublicAccessOptions, Name: "VPC Block Public Access Options", diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf new file mode 100644 index 00000000000..cbff7e9a4f2 --- /dev/null +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf @@ -0,0 +1,26 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + + tags = var.resource_tags +} + +variable "rName" { + description = "Name for resource" + type = string + nullable = false +} + +variable "resource_tags" { + description = "Tags to set on resource. To specify no tags, set to `null`" + # Not setting a default, so that this must explicitly be set to `null` to specify no tags + type = map(string) + nullable = true +} diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..9b211550e2f --- /dev/null +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf @@ -0,0 +1,30 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + description = "Name for resource" + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..9d65806c0cb --- /dev/null +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf @@ -0,0 +1,41 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + description = "Name for resource" + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf new file mode 100644 index 00000000000..52fba41c371 --- /dev/null +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf @@ -0,0 +1,37 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "aws" { + default_tags { + tags = var.provider_tags + } +} + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + + tags = var.resource_tags +} + +variable "rName" { + description = "Name for resource" + type = string + nullable = false +} + +variable "resource_tags" { + description = "Tags to set on resource. To specify no tags, set to `null`" + # Not setting a default, so that this must explicitly be set to `null` to specify no tags + type = map(string) + nullable = true +} + +variable "provider_tags" { + type = map(string) + nullable = false +} diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf new file mode 100644 index 00000000000..e850e01c1f6 --- /dev/null +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf @@ -0,0 +1,46 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "aws" { + default_tags { + tags = var.provider_tags + } + ignore_tags { + keys = var.ignore_tag_keys + } +} + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + + tags = var.resource_tags +} + +variable "rName" { + description = "Name for resource" + type = string + nullable = false +} + +variable "resource_tags" { + description = "Tags to set on resource. To specify no tags, set to `null`" + # Not setting a default, so that this must explicitly be set to `null` to specify no tags + type = map(string) + nullable = true +} + +variable "provider_tags" { + type = map(string) + nullable = true + default = null +} + +variable "ignore_tag_keys" { + type = set(string) + nullable = false +} diff --git a/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl b/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl new file mode 100644 index 00000000000..9a505dc2543 --- /dev/null +++ b/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl @@ -0,0 +1,10 @@ +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = "allow-bidirectional" + vpc_id = aws_vpc.test.id + +{{- template "tags" . }} +} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go new file mode 100644 index 00000000000..2739d21d9c0 --- /dev/null +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -0,0 +1,483 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package ec2 + +import ( + "context" + "errors" + "fmt" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/arn" + "github.com/aws/aws-sdk-go-v2/service/ec2" + awstypes "github.com/aws/aws-sdk-go-v2/service/ec2/types" + "github.com/hashicorp/aws-sdk-go-base/v2/tfawserr" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" + "github.com/hashicorp/terraform-provider-aws/internal/create" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/framework" + "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" +) + +// @FrameworkResource("aws_vpc_block_public_access_exclusion", name="Block Public Access Exclusion") +// @Tags(identifierAttribute="id") +// @Testing(tagsTest=true) +func newResourceVPCBlockPublicAccessExclusion(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &resourceVPCBlockPublicAccessExclusion{} + + r.SetDefaultCreateTimeout(30 * time.Minute) + r.SetDefaultUpdateTimeout(30 * time.Minute) + r.SetDefaultDeleteTimeout(30 * time.Minute) + + return r, nil +} + +const ( + ResNameVPCBlockPublicAccessExclusion = "VPC Block Public Access Exclusion" +) + +type resourceVPCBlockPublicAccessExclusion struct { + framework.ResourceWithConfigure + framework.WithTimeouts +} + +func (r *resourceVPCBlockPublicAccessExclusion) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = "aws_vpc_block_public_access_exclusion" +} + +func (r *resourceVPCBlockPublicAccessExclusion) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "creation_timestamp": schema.StringAttribute{ + CustomType: timetypes.RFC3339Type{}, + Computed: true, + }, + "exclusion_id": schema.StringAttribute{ + Computed: true, + }, + "internet_gateway_exclusion_mode": schema.StringAttribute{ + Required: true, + Validators: []validator.String{ + enum.FrameworkValidate[awstypes.InternetGatewayExclusionMode](), + }, + }, + names.AttrID: framework.IDAttribute(), + "last_update_timestamp": schema.StringAttribute{ + CustomType: timetypes.RFC3339Type{}, + Computed: true, + }, + "reason": schema.StringAttribute{ + Computed: true, + }, + names.AttrResourceARN: framework.ARNAttributeComputedOnly(), + names.AttrSubnetID: schema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + names.AttrTags: tftags.TagsAttribute(), + names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), + names.AttrVPCID: schema.StringAttribute{ + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + }, + Blocks: map[string]schema.Block{ + names.AttrTimeouts: timeouts.Block(ctx, timeouts.Opts{ + Create: true, + Update: true, + Delete: true, + }), + }, + } +} + +func (r *resourceVPCBlockPublicAccessExclusion) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + + conn := r.Meta().EC2Client(ctx) + + var plan resourceVPCBlockPublicAccessExclusionModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + input := &ec2.CreateVpcBlockPublicAccessExclusionInput{ + TagSpecifications: getTagSpecificationsIn(ctx, awstypes.ResourceTypeVpcBlockPublicAccessExclusion), + } + + resp.Diagnostics.Append(flex.Expand(ctx, plan, input)...) + + if resp.Diagnostics.HasError() { + return + } + + out, err := conn.CreateVpcBlockPublicAccessExclusion(ctx, input) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionCreating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), err), + err.Error(), + ) + return + } + if out == nil || out.VpcBlockPublicAccessExclusion == nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionCreating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), nil), + errors.New("empty output").Error(), + ) + return + } + + resp.Diagnostics.Append(flex.Flatten(ctx, out.VpcBlockPublicAccessExclusion, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + plan.setID() + + createTimeout := r.CreateTimeout(ctx, plan.Timeouts) + _, err = waitVPCBlockPublicAccessExclusionCreated(ctx, conn, plan.ID.ValueString(), createTimeout) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForCreation, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), err), + err.Error(), + ) + return + } + + // TODO: Read again because the LastUpdateTimeStamp is not provided in the output of the Create Call. At the time of release, if this is changed, then remove this part and uncomment the part above where the output of create is used to update the plan. + desc_out, desc_err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, plan.ID.ValueString()) + if tfresource.NotFound(desc_err) { + resp.State.RemoveResource(ctx) + return + } + if desc_err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), desc_err), + err.Error(), + ) + return + } + resp.Diagnostics.Append(fwflex.Flatten(ctx, desc_out, &plan)...) + + resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) +} + +func (r *resourceVPCBlockPublicAccessExclusion) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + r.SetTagsAll(ctx, req, resp) +} + +func (r *resourceVPCBlockPublicAccessExclusion) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + + conn := r.Meta().EC2Client(ctx) + + var state resourceVPCBlockPublicAccessExclusionModel + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + if err := state.InitFromID(); err != nil { + resp.Diagnostics.AddError("parsing resource ID", err.Error()) + + return + } + + out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, state.ID.ValueString()) + if tfresource.NotFound(err) { + resp.State.RemoveResource(ctx) + return + } + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), + err.Error(), + ) + return + } + + resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) + if resp.Diagnostics.HasError() { + return + } + + // Extract VPC Id and Subnet Id to support import + resource_arn := state.ResourceARN.ValueString() + + arn, err := arn.Parse(resource_arn) + if err != nil { + resp.Diagnostics.AddError("Parsing Resource ARN", err.Error()) + return + } + + if strings.HasPrefix(arn.Resource, "vpc/") { + vpc_id := strings.TrimPrefix(arn.Resource, "vpc/") + state.VPCID = types.StringValue(vpc_id) + } else if strings.HasPrefix(arn.Resource, "subnet/") { + subnet_id := strings.TrimPrefix(arn.Resource, "subnet/") + state.SubnetID = types.StringValue(subnet_id) + } else { + resp.Diagnostics.AddError("Parsing Resource_ARN", fmt.Sprintf("Unknown resource type: %s", arn.Resource)) + return + } + + setTagsOut(ctx, out.Tags) + + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +func (r *resourceVPCBlockPublicAccessExclusion) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + + conn := r.Meta().EC2Client(ctx) + + var plan, state resourceVPCBlockPublicAccessExclusionModel + + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + if !plan.InternetGatewayExclusionMode.Equal(state.InternetGatewayExclusionMode) { + input := ec2.ModifyVpcBlockPublicAccessExclusionInput{ + ExclusionId: state.ID.ValueStringPointer(), + InternetGatewayExclusionMode: awstypes.InternetGatewayExclusionMode(plan.InternetGatewayExclusionMode.ValueString()), + } + + if resp.Diagnostics.HasError() { + return + } + + out, err := conn.ModifyVpcBlockPublicAccessExclusion(ctx, &input) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionUpdating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), err), + err.Error(), + ) + return + } + if out == nil || out.VpcBlockPublicAccessExclusion == nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionUpdating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), nil), + errors.New("empty output").Error(), + ) + return + } + + resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) + if resp.Diagnostics.HasError() { + return + } + } + + updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts) + _, err := waitVPCBlockPublicAccessExclusionUpdated(ctx, conn, plan.ID.ValueString(), updateTimeout) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForUpdate, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), err), + err.Error(), + ) + return + } + + out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, state.ID.ValueString()) + if tfresource.NotFound(err) { + resp.State.RemoveResource(ctx) + return + } + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), + err.Error(), + ) + return + } + resp.Diagnostics.Append(fwflex.Flatten(ctx, out, &plan)...) + + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +func (r *resourceVPCBlockPublicAccessExclusion) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + + conn := r.Meta().EC2Client(ctx) + + var state resourceVPCBlockPublicAccessExclusionModel + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + input := ec2.DeleteVpcBlockPublicAccessExclusionInput{ + ExclusionId: state.ExclusionID.ValueStringPointer(), + } + + _, err := conn.DeleteVpcBlockPublicAccessExclusion(ctx, &input) + if err != nil { + if !tfawserr.ErrMessageContains(err, errCodeInvalidParameterValue, "is in delete-complete state and cannot be deleted") { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionDeleting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), + err.Error(), + ) + } + return + } + + deleteTimeout := r.DeleteTimeout(ctx, state.Timeouts) + _, err = waitVPCBlockPublicAccessExclusionDeleted(ctx, conn, state.ID.ValueString(), deleteTimeout) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForDeletion, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), + err.Error(), + ) + return + } +} + +func (r *resourceVPCBlockPublicAccessExclusion) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root(names.AttrID), req, resp) +} + +func waitVPCBlockPublicAccessExclusionCreated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateInProgress), + Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateComplete), + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + NotFoundChecks: 2, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { + return &out, err + } + + return nil, err +} + +func waitVPCBlockPublicAccessExclusionUpdated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateInProgress), + Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete, + awstypes.VpcBlockPublicAccessExclusionStateCreateComplete), + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { + return &out, err + } + + return nil, err +} + +func waitVPCBlockPublicAccessExclusionDeleted(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + // There might API inconsistencies where even after invoking delete, the Describe might come back with a CreateComplete or UpdateComplete status (the status before delete was invoked). To account for that, we are also adding those two statuses as valid statues to retry. + Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete, + awstypes.VpcBlockPublicAccessExclusionStateCreateComplete, + awstypes.VpcBlockPublicAccessExclusionStateDeleteInProgress), + Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateDeleteComplete), + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + NotFoundChecks: 1, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { + return &out, err + } + + return nil, err +} + +func statusVPCBlockPublicAccessExclusion(ctx context.Context, conn *ec2.Client, id string) retry.StateRefreshFunc { + return func() (interface{}, string, error) { + out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) + + if tfresource.NotFound(err) { + return nil, "", nil + } + + if err != nil { + return nil, "", err + } + + return &out, string(out.State), nil + } +} + +func FindVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client, id string) (*awstypes.VpcBlockPublicAccessExclusion, error) { + + in := &ec2.DescribeVpcBlockPublicAccessExclusionsInput{ + ExclusionIds: []string{id}, + } + + out, err := conn.DescribeVpcBlockPublicAccessExclusions(ctx, in) + + if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionId) { + return nil, &retry.NotFoundError{ + Message: "Exclusion Id:" + id + " Not Found", + LastRequest: in, + } + } + + if err != nil { + return nil, err + } + + if out == nil || out.VpcBlockPublicAccessExclusions == nil { + return nil, tfresource.NewEmptyResultError(in) + } + + return &(out.VpcBlockPublicAccessExclusions[0]), nil +} + +type resourceVPCBlockPublicAccessExclusionModel struct { + CreationTimestamp timetypes.RFC3339 `tfsdk:"creation_timestamp"` + ExclusionID types.String `tfsdk:"exclusion_id"` + ID types.String `tfsdk:"id"` + InternetGatewayExclusionMode types.String `tfsdk:"internet_gateway_exclusion_mode"` + LastUpdateTimestamp timetypes.RFC3339 `tfsdk:"last_update_timestamp"` + Reason types.String `tfsdk:"reason"` + ResourceARN types.String `tfsdk:"resource_arn"` + SubnetID types.String `tfsdk:"subnet_id"` + Timeouts timeouts.Value `tfsdk:"timeouts"` + Tags tftags.Map `tfsdk:"tags"` + TagsAll tftags.Map `tfsdk:"tags_all"` + VPCID types.String `tfsdk:"vpc_id"` +} + +func (data *resourceVPCBlockPublicAccessExclusionModel) InitFromID() error { + data.ExclusionID = data.ID + return nil +} + +func (data *resourceVPCBlockPublicAccessExclusionModel) setID() { + data.ID = data.ExclusionID +} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go new file mode 100644 index 00000000000..84eccb6b791 --- /dev/null +++ b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go @@ -0,0 +1,2237 @@ +// Code generated by internal/generate/tagstests/main.go; DO NOT EDIT. + +package ec2_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/config" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: nil, + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.Null(), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.Null(), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: nil, + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" + }, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{})), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{})), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" + }, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + acctest.CtKey2: config.StringVariable(""), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + acctest.CtKey2: knownvalue.StringExact(""), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + acctest.CtKey2: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + acctest.CtKey2: knownvalue.StringExact(""), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + acctest.CtKey2: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + acctest.CtKey2: config.StringVariable(""), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1Updated), + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey2: knownvalue.StringExact(acctest.CtValue2), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey2: config.StringVariable(acctest.CtValue2), + }), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1Updated), + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1Updated), + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{})), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + acctest.CtOverlapKey2: config.StringVariable("providervalue2"), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue1), + acctest.CtOverlapKey2: config.StringVariable(acctest.CtResourceValue2), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtOverlapKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtOverlapKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtOverlapKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtOverlapKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + acctest.CtOverlapKey2: config.StringVariable("providervalue2"), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue1), + acctest.CtOverlapKey2: config.StringVariable(acctest.CtResourceValue2), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue2), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtOverlapKey1: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtOverlapKey1: config.StringVariable(acctest.CtResourceValue2), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + acctest.CtResourceTags: nil, + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(""), + }), + acctest.CtResourceTags: nil, + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: nil, + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.Null(), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.Null(), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(""), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: nil, + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" + }, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: nil, + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.Null(), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(""), + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.Null(), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(""), + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: nil, + }), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "tags.resourcekey1", // The canonical value returned by the AWS API is "" + }, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapSizeExact(1)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapSizeExact(1)), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTagsAll)), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable(acctest.CtKey1), + "knownTagValue": config.StringVariable(acctest.CtValue1), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapSizeExact(2)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapPartial(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapSizeExact(2)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapPartial(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTagsAll)), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable(acctest.CtKey1), + "knownTagValue": config.StringVariable(acctest.CtValue1), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtKey1: config.StringVariable(acctest.CtValue1), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtKey1: knownvalue.StringExact(acctest.CtValue1), + })), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable(acctest.CtKey1), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestCheckResourceAttrPair(resourceName, acctest.CtTagsKey1, "null_resource.test", names.AttrID), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapSizeExact(1)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapSizeExact(1)), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey(acctest.CtKey1)), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTagsAll)), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + "unknownTagKey": config.StringVariable(acctest.CtKey1), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + // 1: Create + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtProviderKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), // TODO: Should not be set + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, + }, + // 2: Update ignored tag only + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtProviderKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), // TODO: Should not be set + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, + }, + // 3: Update both tags + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ + acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Again), + }), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtProviderKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtProviderKey1: knownvalue.StringExact(acctest.CtProviderValue1), // TODO: Should not be set + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + // 1: Create + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), + acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtResourceKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), // TODO: Should not be set + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), // TODO: Should be NoOp + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + }, + ExpectNonEmptyPlan: true, + }, + // 2: Update ignored tag + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtResourceKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), // TODO: Should not be set + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), // TODO: Should be NoOp + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Updated), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2), + })), + }, + }, + ExpectNonEmptyPlan: true, + }, + // 3: Update both tags + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigVariables: config.Variables{ + acctest.CtRName: config.StringVariable(rName), + acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ + acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Again), + acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2Updated), + }), + "ignore_tag_keys": config.SetVariable( + config.StringVariable(acctest.CtResourceKey1), + ), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Again), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + expectFullResourceTags(resourceName, knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1), // TODO: Should not be set + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + }, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Again), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), // TODO: Should be NoOp + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey1: knownvalue.StringExact(acctest.CtResourceValue1Again), + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), knownvalue.MapExact(map[string]knownvalue.Check{ + acctest.CtResourceKey2: knownvalue.StringExact(acctest.CtResourceValue2Updated), + })), + }, + }, + ExpectNonEmptyPlan: true, + }, + }, + }) +} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go new file mode 100644 index 00000000000..6b1922ce41d --- /dev/null +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -0,0 +1,272 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package ec2_test + +import ( + "context" + "errors" + "fmt" + "testing" + + "github.com/YakDriver/regexache" + awstypes "github.com/aws/aws-sdk-go-v2/service/ec2/types" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/create" + tfec2 "github.com/hashicorp/terraform-provider-aws/internal/service/ec2" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" +) + +// Acceptance test access AWS and cost money to run. +func TestAccVPCBlockPublicAccessExclusion_basic_vpc(t *testing.T) { + ctx := acctest.Context(t) + + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) + exclusionModeBidrectional := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) + internetGatewayExclusionModeAllowEgress := string(awstypes.InternetGatewayExclusionModeAllowEgress) + + resourceName := "aws_vpc_block_public_access_exclusion.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.EC2) + testAccPreCheckVPCBlockPublicAccess(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, exclusionModeBidrectional), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), + resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", exclusionModeBidrectional), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), + resource.TestCheckResourceAttrSet(resourceName, names.AttrVPCID), + acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`vpc/+.`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, internetGatewayExclusionModeAllowEgress), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"), + resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), + resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", internetGatewayExclusionModeAllowEgress), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), + resource.TestCheckResourceAttrSet(resourceName, names.AttrVPCID), + resource.TestCheckResourceAttrSet(resourceName, "reason"), + acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`vpc/+.`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_basic_subnet(t *testing.T) { + ctx := acctest.Context(t) + + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) + exclusionModeBidrectional := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) + internetGatewayExclusionModeAllowEgress := string(awstypes.InternetGatewayExclusionModeAllowEgress) + + resourceName := "aws_vpc_block_public_access_exclusion.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.EC2) + testAccPreCheckVPCBlockPublicAccess(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(blockMode, exclusionModeBidrectional), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), + resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", exclusionModeBidrectional), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), + resource.TestCheckResourceAttrSet(resourceName, names.AttrSubnetID), + acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`subnet/+.`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(blockMode, internetGatewayExclusionModeAllowEgress), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), + resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"), + resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), + resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", internetGatewayExclusionModeAllowEgress), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), + resource.TestCheckResourceAttrSet(resourceName, names.AttrSubnetID), + resource.TestCheckResourceAttrSet(resourceName, "reason"), + acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`subnet/+.`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccVPCBlockPublicAccessExclusion_disappears(t *testing.T) { + ctx := acctest.Context(t) + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) + exclusionMode := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) + resourceName := "aws_vpc_block_public_access_exclusion.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.EC2) + testAccPreCheckVPCBlockPublicAccess(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, exclusionMode), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfec2.ResourceVPCBlockPublicAccessExclusion, resourceName), + ), + }, + }, + }) +} + +func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_vpc_block_public_access_exclusion" { + continue + } + + id := rs.Primary.Attributes[names.AttrID] + + out, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) + + if tfresource.NotFound(err) { + return nil + } + if err != nil { + return create.Error(names.EC2, create.ErrActionCheckingDestroyed, tfec2.ResNameVPCBlockPublicAccessExclusion, id, err) + } + + //If the status is Delete Complete, that indicates the resource has been destroyed + if out.State == awstypes.VpcBlockPublicAccessExclusionStateDeleteComplete { + return nil + } + + return create.Error(names.EC2, create.ErrActionCheckingDestroyed, tfec2.ResNameVPCBlockPublicAccessExclusion, id, errors.New("not destroyed")) + } + + return nil + } +} + +func testAccCheckBlockPublicAccessExclusionExists(ctx context.Context, name string) resource.TestCheckFunc { + return func(s *terraform.State) error { + + rs, ok := s.RootModule().Resources[name] + if !ok { + return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, name, errors.New("not found")) + } + + id := rs.Primary.Attributes[names.AttrID] + + if id == "" { + return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, name, errors.New("not set")) + } + + conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) + _, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) + + if err != nil { + return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, rs.Primary.Attributes[names.AttrID], err) + } + + return nil + } +} + +const testAccVPCBlockPublicAccessExclusionConfig_base = ` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} +` + +func testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(rBlockMode, rExclusionMode string) string { + return acctest.ConfigCompose(fmt.Sprintf(testAccVPCBlockPublicAccessExclusionConfig_base), fmt.Sprintf(` + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = %[2]q + vpc_id = aws_vpc.test.id +} +`, rBlockMode, rExclusionMode)) +} + +func testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(rBlockMode, rExclusionMode string) string { + return acctest.ConfigCompose(fmt.Sprintf(testAccVPCBlockPublicAccessExclusionConfig_base), fmt.Sprintf(` + +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + internet_gateway_exclusion_mode = %[2]q + subnet_id = aws_subnet.test.id +} +`, rBlockMode, rExclusionMode)) +} diff --git a/website/docs/r/vpc_block_public_access_exclusion.html.markdown b/website/docs/r/vpc_block_public_access_exclusion.html.markdown new file mode 100644 index 00000000000..eefd79257ec --- /dev/null +++ b/website/docs/r/vpc_block_public_access_exclusion.html.markdown @@ -0,0 +1,93 @@ +--- +subcategory: "VPC (Virtual Private Cloud)" +layout: "aws" +page_title: "AWS: aws_vpc_block_public_access_exclusion" +description: |- + Terraform resource for managing an exception to the AWS VPC (Virtual Private Cloud) Block Public Access Exclusion. +--- + +# Resource: aws_vpc_block_public_access_exclusion + +Terraform resource for managing an AWS EC2 (Elastic Compute Cloud) VPC Block Public Access Exclusion. + +## Example Usage + +### Basic Usage + +```terraform +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + vpc_id = aws_vpc.test.id + internet_gateway_exclusion_mode = "allow-bidirectional" +} +``` + +### Usage with subnet id + +```terraform +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" +} + +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id +} + +resource "aws_vpc_block_public_access_exclusion" "test" { + subnet_id = aws_subnet.test.id + internet_gateway_exclusion_mode = "allow-egress" +} +``` + +## Argument Reference + +The following arguments are required: + +* `internet_gateway_exclusion_mode` - (Required) Mode of exclusion from Block Public Access. The allowed values are `allow-egress` and `allow-bidirectional`. + +The following arguments are optional: + +* `vpc_id` - (Optional) Id of the VPC to which this exclusion applies. Either this or the subnet_id needs to be provided. +* `subnet_id` - (Optional) Id of the subnet to which this exclusion applies. Either this or the vpc_id needs to be provided. +* `tags` - (Optional) A map of tags to assign to the exclusion. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `id` - The ID of the VPC Block Public Access Exclusion. +* `exclusion_id` - The ID of the VPC Block Public Access Exclusion. +* `resource_arn` - The Amazon Resource Name (ARN) the Exclusion. +* `creation_timestamp` - Creation Timestamp. +* `last_update_timestamp` - Last update Timestamp. +* `reason` - The reason for the update. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `30m`) +* `update` - (Default `30m`) +* `delete` - (Default `30m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import VPC Block Public Access Exclusion using the `example_id_arg`. For example: + +```terraform +import { + to = aws_vpc_block_public_access_exclusion.example + id = "vpcbpa-exclude-1234abcd" +} +``` + +Using `terraform import`, import EC2 (Elastic Compute Cloud) VPC Block Public Access Exclusion using the `example_id_arg`. For example: + +```console +% terraform import aws_vpc_block_public_access_exclusion.example vpcbpa-exclude-1234abcd +``` From 52e411a4283a5bc32412e2195d908ac875d3758a Mon Sep 17 00:00:00 2001 From: Madhav Vishnubhatta Date: Thu, 21 Nov 2024 14:46:30 +0000 Subject: [PATCH 02/14] Fixed lint findings --- internal/service/ec2/errors.go | 2 +- .../service/ec2/vpc_block_public_access_exclusion.go | 10 +++------- .../ec2/vpc_block_public_access_exclusion_test.go | 8 ++++---- .../r/vpc_block_public_access_exclusion.html.markdown | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/internal/service/ec2/errors.go b/internal/service/ec2/errors.go index 8747006586f..42f67759114 100644 --- a/internal/service/ec2/errors.go +++ b/internal/service/ec2/errors.go @@ -138,7 +138,7 @@ const ( errCodeVPNConnectionLimitExceeded = "VpnConnectionLimitExceeded" errCodeVPNGatewayLimitExceeded = "VpnGatewayLimitExceeded" errCodeVolumeInUse = "VolumeInUse" - errCodeInvalidVpcBlockPublicAccessExclusionId = "InvalidVpcBlockPublicAccessExclusionId.NotFound" + errCodeInvalidVpcBlockPublicAccessExclusionID = "InvalidVpcBlockPublicAccessExclusionId.NotFound" ) func cancelSpotFleetRequestError(apiObject *awstypes.CancelSpotFleetRequestsError) error { diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index 2739d21d9c0..b855af163ff 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -28,7 +28,6 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/framework" "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" - fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/names" @@ -111,7 +110,6 @@ func (r *resourceVPCBlockPublicAccessExclusion) Schema(ctx context.Context, req } func (r *resourceVPCBlockPublicAccessExclusion) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - conn := r.Meta().EC2Client(ctx) var plan resourceVPCBlockPublicAccessExclusionModel @@ -176,7 +174,7 @@ func (r *resourceVPCBlockPublicAccessExclusion) Create(ctx context.Context, req ) return } - resp.Diagnostics.Append(fwflex.Flatten(ctx, desc_out, &plan)...) + resp.Diagnostics.Append(flex.Flatten(ctx, desc_out, &plan)...) resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) } @@ -186,7 +184,6 @@ func (r *resourceVPCBlockPublicAccessExclusion) ModifyPlan(ctx context.Context, } func (r *resourceVPCBlockPublicAccessExclusion) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - conn := r.Meta().EC2Client(ctx) var state resourceVPCBlockPublicAccessExclusionModel @@ -245,7 +242,6 @@ func (r *resourceVPCBlockPublicAccessExclusion) Read(ctx context.Context, req re } func (r *resourceVPCBlockPublicAccessExclusion) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - conn := r.Meta().EC2Client(ctx) var plan, state resourceVPCBlockPublicAccessExclusionModel @@ -314,7 +310,7 @@ func (r *resourceVPCBlockPublicAccessExclusion) Update(ctx context.Context, req ) return } - resp.Diagnostics.Append(fwflex.Flatten(ctx, out, &plan)...) + resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } @@ -440,7 +436,7 @@ func FindVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client out, err := conn.DescribeVpcBlockPublicAccessExclusions(ctx, in) - if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionId) { + if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionID) { return nil, &retry.NotFoundError{ Message: "Exclusion Id:" + id + " Not Found", LastRequest: in, diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index 6b1922ce41d..01e4c5c5887 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -247,17 +247,17 @@ resource "aws_vpc" "test" { ` func testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(rBlockMode, rExclusionMode string) string { - return acctest.ConfigCompose(fmt.Sprintf(testAccVPCBlockPublicAccessExclusionConfig_base), fmt.Sprintf(` + return acctest.ConfigCompose(testAccVPCBlockPublicAccessExclusionConfig_base, fmt.Sprintf(` resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = %[2]q - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id } `, rBlockMode, rExclusionMode)) } func testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(rBlockMode, rExclusionMode string) string { - return acctest.ConfigCompose(fmt.Sprintf(testAccVPCBlockPublicAccessExclusionConfig_base), fmt.Sprintf(` + return acctest.ConfigCompose(testAccVPCBlockPublicAccessExclusionConfig_base, fmt.Sprintf(` resource "aws_subnet" "test" { cidr_block = "10.1.1.0/24" @@ -266,7 +266,7 @@ resource "aws_subnet" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = %[2]q - subnet_id = aws_subnet.test.id + subnet_id = aws_subnet.test.id } `, rBlockMode, rExclusionMode)) } diff --git a/website/docs/r/vpc_block_public_access_exclusion.html.markdown b/website/docs/r/vpc_block_public_access_exclusion.html.markdown index eefd79257ec..533994375f5 100644 --- a/website/docs/r/vpc_block_public_access_exclusion.html.markdown +++ b/website/docs/r/vpc_block_public_access_exclusion.html.markdown @@ -20,7 +20,7 @@ resource "aws_vpc" "test" { } resource "aws_vpc_block_public_access_exclusion" "test" { - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id internet_gateway_exclusion_mode = "allow-bidirectional" } ``` @@ -38,7 +38,7 @@ resource "aws_subnet" "test" { } resource "aws_vpc_block_public_access_exclusion" "test" { - subnet_id = aws_subnet.test.id + subnet_id = aws_subnet.test.id internet_gateway_exclusion_mode = "allow-egress" } ``` From d70c142380e690ae2b2880684b5b1c4b263d648a Mon Sep 17 00:00:00 2001 From: Madhav Vishnubhatta Date: Thu, 21 Nov 2024 15:17:22 +0000 Subject: [PATCH 03/14] Fixing lint finding for error constant name. --- internal/service/ec2/errors.go | 2 +- internal/service/ec2/vpc_block_public_access_exclusion.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/errors.go b/internal/service/ec2/errors.go index 42f67759114..0b80c186204 100644 --- a/internal/service/ec2/errors.go +++ b/internal/service/ec2/errors.go @@ -138,7 +138,7 @@ const ( errCodeVPNConnectionLimitExceeded = "VpnConnectionLimitExceeded" errCodeVPNGatewayLimitExceeded = "VpnGatewayLimitExceeded" errCodeVolumeInUse = "VolumeInUse" - errCodeInvalidVpcBlockPublicAccessExclusionID = "InvalidVpcBlockPublicAccessExclusionId.NotFound" + errCodeInvalidVPCBlockPublicAccessExclusionID = "InvalidVpcBlockPublicAccessExclusionId.NotFound" ) func cancelSpotFleetRequestError(apiObject *awstypes.CancelSpotFleetRequestsError) error { diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index b855af163ff..b131b76388b 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -436,7 +436,7 @@ func FindVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client out, err := conn.DescribeVpcBlockPublicAccessExclusions(ctx, in) - if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionID) { + if tfawserr.ErrCodeEquals(err, errCodeInvalidVPCBlockPublicAccessExclusionID) { return nil, &retry.NotFoundError{ Message: "Exclusion Id:" + id + " Not Found", LastRequest: in, From d28c5f3b3126ebb290511b7fde9a67fc31bc0dc1 Mon Sep 17 00:00:00 2001 From: Madhav Vishnubhatta Date: Thu, 21 Nov 2024 15:40:41 +0000 Subject: [PATCH 04/14] Fixed Terraform test format findings --- .../ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf | 2 +- .../BlockPublicAccessExclusion/tagsComputed1/main_gen.tf | 2 +- .../BlockPublicAccessExclusion/tagsComputed2/main_gen.tf | 2 +- .../BlockPublicAccessExclusion/tags_defaults/main_gen.tf | 2 +- .../testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf | 2 +- .../testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl | 2 +- internal/service/ec2/vpc_block_public_access_exclusion.go | 2 -- internal/service/ec2/vpc_block_public_access_exclusion_test.go | 1 - 8 files changed, 6 insertions(+), 9 deletions(-) diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf index cbff7e9a4f2..5b83d82aec9 100644 --- a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf @@ -7,7 +7,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id tags = var.resource_tags } diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf index 9b211550e2f..9d12d2ce2ac 100644 --- a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf @@ -9,7 +9,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id tags = { (var.unknownTagKey) = null_resource.test.id diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf index 9d65806c0cb..edc8144b9fc 100644 --- a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf @@ -9,7 +9,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id tags = { (var.unknownTagKey) = null_resource.test.id diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf index 52fba41c371..191590dba31 100644 --- a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf @@ -13,7 +13,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id tags = var.resource_tags } diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf index e850e01c1f6..2c4336f4f99 100644 --- a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf +++ b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf @@ -16,7 +16,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id tags = var.resource_tags } diff --git a/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl b/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl index 9a505dc2543..bfc5437cd38 100644 --- a/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl +++ b/internal/service/ec2/testdata/tmpl/vpc_block_public_access_exclusion_tags.gtpl @@ -4,7 +4,7 @@ resource "aws_vpc" "test" { resource "aws_vpc_block_public_access_exclusion" "test" { internet_gateway_exclusion_mode = "allow-bidirectional" - vpc_id = aws_vpc.test.id + vpc_id = aws_vpc.test.id {{- template "tags" . }} } diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index b131b76388b..b17ca9762e4 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -316,7 +316,6 @@ func (r *resourceVPCBlockPublicAccessExclusion) Update(ctx context.Context, req } func (r *resourceVPCBlockPublicAccessExclusion) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - conn := r.Meta().EC2Client(ctx) var state resourceVPCBlockPublicAccessExclusionModel @@ -429,7 +428,6 @@ func statusVPCBlockPublicAccessExclusion(ctx context.Context, conn *ec2.Client, } func FindVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client, id string) (*awstypes.VpcBlockPublicAccessExclusion, error) { - in := &ec2.DescribeVpcBlockPublicAccessExclusionsInput{ ExclusionIds: []string{id}, } diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index 01e4c5c5887..9b09681bf33 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -217,7 +217,6 @@ func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource func testAccCheckBlockPublicAccessExclusionExists(ctx context.Context, name string) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] if !ok { return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, name, errors.New("not found")) From 4dbea55e417c7cb3c3b35f2ff28674b3dd5ff90d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 26 Nov 2024 13:56:33 -0500 Subject: [PATCH 05/14] Add CHANGELOG entry. --- .changelog/40235.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/40235.txt diff --git a/.changelog/40235.txt b/.changelog/40235.txt new file mode 100644 index 00000000000..cba9c0a3ed3 --- /dev/null +++ b/.changelog/40235.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +aws_vpc_block_public_access_exclusion +``` \ No newline at end of file From 7a5747c70bc03308f8825cb3d9909d3188885993 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 26 Nov 2024 16:10:56 -0500 Subject: [PATCH 06/14] r/aws_vpc_block_public_access_options: Tidy. --- .../ec2/vpc_block_public_access_options.go | 16 +++++------ .../vpc_block_public_access_options_test.go | 28 +++++++++---------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/internal/service/ec2/vpc_block_public_access_options.go b/internal/service/ec2/vpc_block_public_access_options.go index 529de85cc07..48398eb3fa4 100644 --- a/internal/service/ec2/vpc_block_public_access_options.go +++ b/internal/service/ec2/vpc_block_public_access_options.go @@ -98,20 +98,18 @@ func (r *vpcBlockPublicAccessOptionsResource) Create(ctx context.Context, reques return } - options, err := waitVPCBlockPublicAccessOptionsUpdated(ctx, conn, r.CreateTimeout(ctx, data.Timeouts)) + // Set values for unknowns. + data.AWSAccountID = fwflex.StringToFramework(ctx, output.VpcBlockPublicAccessOptions.AwsAccountId) + data.AWSRegion = fwflex.StringToFramework(ctx, output.VpcBlockPublicAccessOptions.AwsRegion) + data.ID = data.AWSRegion - if err != nil { - response.State.SetAttribute(ctx, path.Root(names.AttrID), fwflex.StringToFramework(ctx, output.VpcBlockPublicAccessOptions.AwsRegion)) // Set 'id' so as to taint the resource. - response.Diagnostics.AddError("waiting for VPC Block Public Access Options create", err.Error()) + if _, err := waitVPCBlockPublicAccessOptionsUpdated(ctx, conn, r.CreateTimeout(ctx, data.Timeouts)); err != nil { + response.State.SetAttribute(ctx, path.Root(names.AttrID), data.ID) // Set 'id' so as to taint the resource. + response.Diagnostics.AddError(fmt.Sprintf("waiting for VPC Block Public Access Options (%s) create", data.ID.ValueString()), err.Error()) return } - // Set values for unknowns. - data.AWSAccountID = fwflex.StringToFramework(ctx, options.AwsAccountId) - data.AWSRegion = fwflex.StringToFramework(ctx, options.AwsRegion) - data.ID = data.AWSRegion - response.Diagnostics.Append(response.State.Set(ctx, &data)...) } diff --git a/internal/service/ec2/vpc_block_public_access_options_test.go b/internal/service/ec2/vpc_block_public_access_options_test.go index 2f119210514..80f1e205bc0 100644 --- a/internal/service/ec2/vpc_block_public_access_options_test.go +++ b/internal/service/ec2/vpc_block_public_access_options_test.go @@ -33,7 +33,7 @@ func TestAccVPCBlockPublicAccessOptions_serial(t *testing.T) { func testAccVPCBlockPublicAccessOptions_basic(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_options.test" - rMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) + internetGatewayBlockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -45,11 +45,11 @@ func testAccVPCBlockPublicAccessOptions_basic(t *testing.T) { CheckDestroy: acctest.CheckDestroyNoop, Steps: []resource.TestStep{ { - Config: testAccVPCBlockPublicAccessOptionsConfig_basic(rMode), + Config: testAccVPCBlockPublicAccessOptionsConfig_basic(internetGatewayBlockMode), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrAWSAccountID), knownvalue.NotNull()), statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("aws_region"), knownvalue.NotNull()), - statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(rMode)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(internetGatewayBlockMode)), }, }, { @@ -64,9 +64,9 @@ func testAccVPCBlockPublicAccessOptions_basic(t *testing.T) { func testAccVPCBlockPublicAccessOptions_update(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_options.test" - rMode1 := string(awstypes.InternetGatewayBlockModeBlockBidirectional) - rMode2 := string(awstypes.InternetGatewayBlockModeBlockIngress) - rMode3 := string(awstypes.InternetGatewayBlockModeOff) + internetGatewayBlockMode1 := string(awstypes.InternetGatewayBlockModeBlockBidirectional) + internetGatewayBlockMode2 := string(awstypes.InternetGatewayBlockModeBlockIngress) + internetGatewayBlockMode3 := string(awstypes.InternetGatewayBlockModeOff) resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -79,9 +79,9 @@ func testAccVPCBlockPublicAccessOptions_update(t *testing.T) { CheckDestroy: acctest.CheckDestroyNoop, Steps: []resource.TestStep{ { - Config: testAccVPCBlockPublicAccessOptionsConfig_basic(rMode1), + Config: testAccVPCBlockPublicAccessOptionsConfig_basic(internetGatewayBlockMode1), ConfigStateChecks: []statecheck.StateCheck{ - statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(rMode1)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(internetGatewayBlockMode1)), }, }, { @@ -90,15 +90,15 @@ func testAccVPCBlockPublicAccessOptions_update(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccVPCBlockPublicAccessOptionsConfig_basic(rMode2), + Config: testAccVPCBlockPublicAccessOptionsConfig_basic(internetGatewayBlockMode2), ConfigStateChecks: []statecheck.StateCheck{ - statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(rMode2)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(internetGatewayBlockMode2)), }, }, { - Config: testAccVPCBlockPublicAccessOptionsConfig_basic(rMode3), + Config: testAccVPCBlockPublicAccessOptionsConfig_basic(internetGatewayBlockMode3), ConfigStateChecks: []statecheck.StateCheck{ - statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(rMode3)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_block_mode"), knownvalue.StringExact(internetGatewayBlockMode3)), }, }, }, @@ -119,10 +119,10 @@ func testAccPreCheckVPCBlockPublicAccess(ctx context.Context, t *testing.T) { } } -func testAccVPCBlockPublicAccessOptionsConfig_basic(rMode string) string { +func testAccVPCBlockPublicAccessOptionsConfig_basic(internetGatewayBlockMode string) string { return fmt.Sprintf(` resource "aws_vpc_block_public_access_options" "test" { internet_gateway_block_mode = %[1]q } -`, rMode) +`, internetGatewayBlockMode) } From fb7850c0957b5e9979d1e9a4234cb0959b5a5fbd Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 26 Nov 2024 16:12:02 -0500 Subject: [PATCH 07/14] r/aws_vpc_block_public_access_exclusion: Tidy up. --- internal/service/ec2/errors.go | 2 +- internal/service/ec2/exports_test.go | 4 +- internal/service/ec2/find.go | 85 +++- internal/service/ec2/generate.go | 2 +- internal/service/ec2/list_pages_gen.go | 18 +- internal/service/ec2/service_package_gen.go | 14 +- internal/service/ec2/status.go | 16 + .../ec2/vpc_block_public_access_exclusion.go | 432 +++++------------- .../vpc_block_public_access_exclusion_test.go | 184 ++------ internal/service/ec2/wait.go | 65 +++ ...lock_public_access_exclusion.html.markdown | 10 +- 11 files changed, 352 insertions(+), 480 deletions(-) diff --git a/internal/service/ec2/errors.go b/internal/service/ec2/errors.go index 0b80c186204..9e59ed6283c 100644 --- a/internal/service/ec2/errors.go +++ b/internal/service/ec2/errors.go @@ -124,6 +124,7 @@ const ( errCodeInvalidVerifiedAccessInstanceIdNotFound = "InvalidVerifiedAccessInstanceId.NotFound" errCodeInvalidVerifiedAccessTrustProviderIdNotFound = "InvalidVerifiedAccessTrustProviderId.NotFound" errCodeInvalidVolumeNotFound = "InvalidVolume.NotFound" + errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound = "InvalidVpcBlockPublicAccessExclusionId.NotFound" errCodeNatGatewayNotFound = "NatGatewayNotFound" errCodeNetworkACLEntryAlreadyExists = "NetworkAclEntryAlreadyExists" errCodeOperationNotPermitted = "OperationNotPermitted" @@ -138,7 +139,6 @@ const ( errCodeVPNConnectionLimitExceeded = "VpnConnectionLimitExceeded" errCodeVPNGatewayLimitExceeded = "VpnGatewayLimitExceeded" errCodeVolumeInUse = "VolumeInUse" - errCodeInvalidVPCBlockPublicAccessExclusionID = "InvalidVpcBlockPublicAccessExclusionId.NotFound" ) func cancelSpotFleetRequestError(apiObject *awstypes.CancelSpotFleetRequestsError) error { diff --git a/internal/service/ec2/exports_test.go b/internal/service/ec2/exports_test.go index 7393b84973c..095e09167a4 100644 --- a/internal/service/ec2/exports_test.go +++ b/internal/service/ec2/exports_test.go @@ -100,6 +100,8 @@ var ( ResourceTransitGatewayRouteTablePropagation = resourceTransitGatewayRouteTablePropagation ResourceTransitGatewayVPCAttachment = resourceTransitGatewayVPCAttachment ResourceTransitGatewayVPCAttachmentAccepter = resourceTransitGatewayVPCAttachmentAccepter + ResourceVPCBlockPublicAccessExclusion = newVPCBlockPublicAccessExclusionResource + ResourceVPCBlockPublicAccessOptions = newVPCBlockPublicAccessOptionsResource ResourceVPCDHCPOptions = resourceVPCDHCPOptions ResourceVPCDHCPOptionsAssociation = resourceVPCDHCPOptionsAssociation ResourceVPCEndpoint = resourceVPCEndpoint @@ -123,7 +125,6 @@ var ( ResourceVerifiedAccessInstanceTrustProviderAttachment = resourceVerifiedAccessInstanceTrustProviderAttachment ResourceVerifiedAccessTrustProvider = resourceVerifiedAccessTrustProvider ResourceVolumeAttachment = resourceVolumeAttachment - ResourceVPCBlockPublicAccessExclusion = newResourceVPCBlockPublicAccessExclusion CheckMostRecentAndMissingFilters = checkMostRecentAndMissingFilters CustomFiltersSchema = customFiltersSchema @@ -220,6 +221,7 @@ var ( FindTransitGatewayRouteTablePropagationByTwoPartKey = findTransitGatewayRouteTablePropagationByTwoPartKey FindTransitGatewayStaticRoute = findTransitGatewayStaticRoute FindTransitGatewayVPCAttachmentByID = findTransitGatewayVPCAttachmentByID + FindVPCBlockPublicAccessExclusionByID = findVPCBlockPublicAccessExclusionByID FindVPCCIDRBlockAssociationByID = findVPCCIDRBlockAssociationByID FindVPCDHCPOptionsAssociation = findVPCDHCPOptionsAssociation FindVPCEndpointConnectionByServiceIDAndVPCEndpointID = findVPCEndpointConnectionByServiceIDAndVPCEndpointID diff --git a/internal/service/ec2/find.go b/internal/service/ec2/find.go index 5d75a01493f..7d7f4dc7bef 100644 --- a/internal/service/ec2/find.go +++ b/internal/service/ec2/find.go @@ -6434,16 +6434,6 @@ func findTrafficMirrorTargetByID(ctx context.Context, conn *ec2.Client, id strin return output, nil } -func findNetworkInsightsPath(ctx context.Context, conn *ec2.Client, input *ec2.DescribeNetworkInsightsPathsInput) (*awstypes.NetworkInsightsPath, error) { - output, err := findNetworkInsightsPaths(ctx, conn, input) - - if err != nil { - return nil, err - } - - return tfresource.AssertSingleValueResult(output) -} - func findNetworkInsightsAnalysis(ctx context.Context, conn *ec2.Client, input *ec2.DescribeNetworkInsightsAnalysesInput) (*awstypes.NetworkInsightsAnalysis, error) { output, err := findNetworkInsightsAnalyses(ctx, conn, input) @@ -6499,6 +6489,16 @@ func findNetworkInsightsAnalysisByID(ctx context.Context, conn *ec2.Client, id s return output, nil } +func findNetworkInsightsPath(ctx context.Context, conn *ec2.Client, input *ec2.DescribeNetworkInsightsPathsInput) (*awstypes.NetworkInsightsPath, error) { + output, err := findNetworkInsightsPaths(ctx, conn, input) + + if err != nil { + return nil, err + } + + return tfresource.AssertSingleValueResult(output) +} + func findNetworkInsightsPaths(ctx context.Context, conn *ec2.Client, input *ec2.DescribeNetworkInsightsPathsInput) ([]awstypes.NetworkInsightsPath, error) { var output []awstypes.NetworkInsightsPath @@ -6593,3 +6593,68 @@ func findVPCBlockPublicAccessOptions(ctx context.Context, conn *ec2.Client) (*aw return output.VpcBlockPublicAccessOptions, nil } + +func findVPCBlockPublicAccessExclusion(ctx context.Context, conn *ec2.Client, input *ec2.DescribeVpcBlockPublicAccessExclusionsInput) (*awstypes.VpcBlockPublicAccessExclusion, error) { + output, err := findVPCBlockPublicAccessExclusions(ctx, conn, input) + + if err != nil { + return nil, err + } + + return tfresource.AssertSingleValueResult(output) +} + +func findVPCBlockPublicAccessExclusions(ctx context.Context, conn *ec2.Client, input *ec2.DescribeVpcBlockPublicAccessExclusionsInput) ([]awstypes.VpcBlockPublicAccessExclusion, error) { + var output []awstypes.VpcBlockPublicAccessExclusion + + err := describeVPCBlockPublicAccessExclusionsPages(ctx, conn, input, func(page *ec2.DescribeVpcBlockPublicAccessExclusionsOutput, lastPage bool) bool { + if page == nil { + return !lastPage + } + + output = append(output, page.VpcBlockPublicAccessExclusions...) + + return !lastPage + }) + + if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + return output, nil +} + +func findVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client, id string) (*awstypes.VpcBlockPublicAccessExclusion, error) { + input := &ec2.DescribeVpcBlockPublicAccessExclusionsInput{ + ExclusionIds: []string{id}, + } + + output, err := findVPCBlockPublicAccessExclusion(ctx, conn, input) + + if err != nil { + return nil, err + } + + if state := output.State; state == awstypes.VpcBlockPublicAccessExclusionStateDeleteComplete { + return nil, &retry.NotFoundError{ + Message: string(state), + LastRequest: input, + } + } + + // Eventual consistency check. + if aws.ToString(output.ExclusionId) != id { + return nil, &retry.NotFoundError{ + LastRequest: input, + } + } + + return output, nil +} diff --git a/internal/service/ec2/generate.go b/internal/service/ec2/generate.go index f051ea12c7e..4d96f96b878 100644 --- a/internal/service/ec2/generate.go +++ b/internal/service/ec2/generate.go @@ -3,7 +3,7 @@ //go:generate go run ../../generate/tagresource/main.go -IDAttribName=resource_id //go:generate go run ../../generate/tags/main.go -GetTag -ListTags -ListTagsOp=DescribeTags -ListTagsOpPaginated -ListTagsInFiltIDName=resource-id -ServiceTagsSlice -KeyValueTagsFunc=keyValueTags -TagOp=CreateTags -TagInIDElem=Resources -TagInIDNeedValueSlice -TagType2=TagDescription -UntagOp=DeleteTags -UntagInNeedTagType -UntagInTagsElem=Tags -UpdateTags -//go:generate go run ../../generate/listpages/main.go -ListOps=DescribeSpotFleetInstances,DescribeSpotFleetRequestHistory,DescribeVpcEndpointServices +//go:generate go run ../../generate/listpages/main.go -ListOps=DescribeSpotFleetInstances,DescribeSpotFleetRequestHistory,DescribeVpcBlockPublicAccessExclusions,DescribeVpcEndpointServices //go:generate go run ../../generate/servicepackage/main.go //go:generate go run ../../generate/tagstests/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. diff --git a/internal/service/ec2/list_pages_gen.go b/internal/service/ec2/list_pages_gen.go index 18fe55935be..2a4017030c2 100644 --- a/internal/service/ec2/list_pages_gen.go +++ b/internal/service/ec2/list_pages_gen.go @@ -1,4 +1,4 @@ -// Code generated by "internal/generate/listpages/main.go -ListOps=DescribeSpotFleetInstances,DescribeSpotFleetRequestHistory,DescribeVpcEndpointServices"; DO NOT EDIT. +// Code generated by "internal/generate/listpages/main.go -ListOps=DescribeSpotFleetInstances,DescribeSpotFleetRequestHistory,DescribeVpcBlockPublicAccessExclusions,DescribeVpcEndpointServices"; DO NOT EDIT. package ec2 @@ -41,6 +41,22 @@ func describeSpotFleetRequestHistoryPages(ctx context.Context, conn *ec2.Client, } return nil } +func describeVPCBlockPublicAccessExclusionsPages(ctx context.Context, conn *ec2.Client, input *ec2.DescribeVpcBlockPublicAccessExclusionsInput, fn func(*ec2.DescribeVpcBlockPublicAccessExclusionsOutput, bool) bool) error { + for { + output, err := conn.DescribeVpcBlockPublicAccessExclusions(ctx, input) + if err != nil { + return err + } + + lastPage := aws.ToString(output.NextToken) == "" + if !fn(output, lastPage) || lastPage { + break + } + + input.NextToken = output.NextToken + } + return nil +} func describeVPCEndpointServicesPages(ctx context.Context, conn *ec2.Client, input *ec2.DescribeVpcEndpointServicesInput, fn func(*ec2.DescribeVpcEndpointServicesOutput, bool) bool) error { for { output, err := conn.DescribeVpcEndpointServices(ctx, input) diff --git a/internal/service/ec2/service_package_gen.go b/internal/service/ec2/service_package_gen.go index 5274177fcc9..cf63f4fc27a 100644 --- a/internal/service/ec2/service_package_gen.go +++ b/internal/service/ec2/service_package_gen.go @@ -65,13 +65,6 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic Factory: newResourceSecurityGroupVPCAssociation, Name: "Security Group VPC Association", }, - { - Factory: newResourceVPCBlockPublicAccessExclusion, - Name: "Block Public Access Exclusion", - Tags: &types.ServicePackageResourceTags{ - IdentifierAttribute: names.AttrID, - }, - }, { Factory: newSecurityGroupEgressRuleResource, Name: "Security Group Egress Rule", @@ -94,6 +87,13 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic Factory: newTransitGatewayDefaultRouteTablePropagationResource, Name: "Transit Gateway Default Route Table Propagation", }, + { + Factory: newVPCBlockPublicAccessExclusionResource, + Name: "Block Public Access Exclusion", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: names.AttrID, + }, + }, { Factory: newVPCBlockPublicAccessOptionsResource, Name: "VPC Block Public Access Options", diff --git a/internal/service/ec2/status.go b/internal/service/ec2/status.go index bd367ffac56..3049612268a 100644 --- a/internal/service/ec2/status.go +++ b/internal/service/ec2/status.go @@ -1588,3 +1588,19 @@ func statusVPCBlockPublicAccessOptions(ctx context.Context, conn *ec2.Client) re return output, string(output.State), nil } } + +func statusVPCBlockPublicAccessExclusion(ctx context.Context, conn *ec2.Client, id string) retry.StateRefreshFunc { + return func() (interface{}, string, error) { + output, err := findVPCBlockPublicAccessExclusionByID(ctx, conn, id) + + if tfresource.NotFound(err) { + return nil, "", nil + } + + if err != nil { + return nil, "", err + } + + return output, string(output.State), nil + } +} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index b17ca9762e4..40cb11f8d49 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -5,7 +5,6 @@ package ec2 import ( "context" - "errors" "fmt" "strings" "time" @@ -15,29 +14,27 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/service/ec2/types" "github.com/hashicorp/aws-sdk-go-base/v2/tfawserr" "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" - "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" + "github.com/hashicorp/terraform-plugin-framework-validators/resourcevalidator" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" - "github.com/hashicorp/terraform-provider-aws/internal/create" - "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag" "github.com/hashicorp/terraform-provider-aws/internal/framework" - "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/names" ) -// @FrameworkResource("aws_vpc_block_public_access_exclusion", name="Block Public Access Exclusion") +// @FrameworkResource("aws_vpc_block_public_access_exclusion", name="VPC Block Public Access Exclusion") // @Tags(identifierAttribute="id") // @Testing(tagsTest=true) -func newResourceVPCBlockPublicAccessExclusion(_ context.Context) (resource.ResourceWithConfigure, error) { - r := &resourceVPCBlockPublicAccessExclusion{} +func newVPCBlockPublicAccessExclusionResource(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &vpcBlockPublicAccessExclusionResource{} r.SetDefaultCreateTimeout(30 * time.Minute) r.SetDefaultUpdateTimeout(30 * time.Minute) @@ -46,48 +43,29 @@ func newResourceVPCBlockPublicAccessExclusion(_ context.Context) (resource.Resou return r, nil } -const ( - ResNameVPCBlockPublicAccessExclusion = "VPC Block Public Access Exclusion" -) - -type resourceVPCBlockPublicAccessExclusion struct { +type vpcBlockPublicAccessExclusionResource struct { framework.ResourceWithConfigure framework.WithTimeouts + framework.WithImportByID } -func (r *resourceVPCBlockPublicAccessExclusion) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = "aws_vpc_block_public_access_exclusion" +func (*vpcBlockPublicAccessExclusionResource) Metadata(_ context.Context, request resource.MetadataRequest, response *resource.MetadataResponse) { + response.TypeName = "aws_vpc_block_public_access_exclusion" } -func (r *resourceVPCBlockPublicAccessExclusion) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ +func (r *vpcBlockPublicAccessExclusionResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { + response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "creation_timestamp": schema.StringAttribute{ - CustomType: timetypes.RFC3339Type{}, - Computed: true, - }, - "exclusion_id": schema.StringAttribute{ - Computed: true, - }, - "internet_gateway_exclusion_mode": schema.StringAttribute{ - Required: true, - Validators: []validator.String{ - enum.FrameworkValidate[awstypes.InternetGatewayExclusionMode](), - }, - }, names.AttrID: framework.IDAttribute(), - "last_update_timestamp": schema.StringAttribute{ - CustomType: timetypes.RFC3339Type{}, - Computed: true, - }, - "reason": schema.StringAttribute{ - Computed: true, + "internet_gateway_exclusion_mode": schema.StringAttribute{ + CustomType: fwtypes.StringEnumType[awstypes.InternetGatewayExclusionMode](), + Required: true, }, names.AttrResourceARN: framework.ARNAttributeComputedOnly(), names.AttrSubnetID: schema.StringAttribute{ Optional: true, PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), }, }, names.AttrTags: tftags.TagsAttribute(), @@ -95,7 +73,7 @@ func (r *resourceVPCBlockPublicAccessExclusion) Schema(ctx context.Context, req names.AttrVPCID: schema.StringAttribute{ Optional: true, PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), }, }, }, @@ -109,369 +87,193 @@ func (r *resourceVPCBlockPublicAccessExclusion) Schema(ctx context.Context, req } } -func (r *resourceVPCBlockPublicAccessExclusion) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - conn := r.Meta().EC2Client(ctx) - - var plan resourceVPCBlockPublicAccessExclusionModel - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { +func (r *vpcBlockPublicAccessExclusionResource) Create(ctx context.Context, request resource.CreateRequest, response *resource.CreateResponse) { + var data resourceVPCBlockPublicAccessExclusionModel + response.Diagnostics.Append(request.Plan.Get(ctx, &data)...) + if response.Diagnostics.HasError() { return } - input := &ec2.CreateVpcBlockPublicAccessExclusionInput{ - TagSpecifications: getTagSpecificationsIn(ctx, awstypes.ResourceTypeVpcBlockPublicAccessExclusion), - } - - resp.Diagnostics.Append(flex.Expand(ctx, plan, input)...) + conn := r.Meta().EC2Client(ctx) - if resp.Diagnostics.HasError() { + input := &ec2.CreateVpcBlockPublicAccessExclusionInput{} + response.Diagnostics.Append(fwflex.Expand(ctx, data, input)...) + if response.Diagnostics.HasError() { return } - out, err := conn.CreateVpcBlockPublicAccessExclusion(ctx, input) + // Additional fields. + input.TagSpecifications = getTagSpecificationsIn(ctx, awstypes.ResourceTypeVpcBlockPublicAccessExclusion) + + output, err := conn.CreateVpcBlockPublicAccessExclusion(ctx, input) + if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionCreating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), err), - err.Error(), - ) - return - } - if out == nil || out.VpcBlockPublicAccessExclusion == nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionCreating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), nil), - errors.New("empty output").Error(), - ) - return - } + response.Diagnostics.AddError("creating VPC Block Public Access Exclusion", err.Error()) - resp.Diagnostics.Append(flex.Flatten(ctx, out.VpcBlockPublicAccessExclusion, &plan)...) - if resp.Diagnostics.HasError() { return } - plan.setID() + // Set values for unknowns. + data.ExclusionID = fwflex.StringToFramework(ctx, output.VpcBlockPublicAccessExclusion.ExclusionId) + data.ResourceARN = fwflex.StringToFramework(ctx, output.VpcBlockPublicAccessExclusion.ResourceArn) - createTimeout := r.CreateTimeout(ctx, plan.Timeouts) - _, err = waitVPCBlockPublicAccessExclusionCreated(ctx, conn, plan.ID.ValueString(), createTimeout) - if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForCreation, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), err), - err.Error(), - ) - return - } + if _, err := waitVPCBlockPublicAccessExclusionCreated(ctx, conn, data.ExclusionID.ValueString(), r.CreateTimeout(ctx, data.Timeouts)); err != nil { + response.State.SetAttribute(ctx, path.Root(names.AttrID), data.ExclusionID) // Set 'id' so as to taint the resource. + response.Diagnostics.AddError(fmt.Sprintf("waiting for VPC Block Public Access Exclusion (%s) create", data.ExclusionID.ValueString()), err.Error()) - // TODO: Read again because the LastUpdateTimeStamp is not provided in the output of the Create Call. At the time of release, if this is changed, then remove this part and uncomment the part above where the output of create is used to update the plan. - desc_out, desc_err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, plan.ID.ValueString()) - if tfresource.NotFound(desc_err) { - resp.State.RemoveResource(ctx) return } - if desc_err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), desc_err), - err.Error(), - ) - return - } - resp.Diagnostics.Append(flex.Flatten(ctx, desc_out, &plan)...) - resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) + response.Diagnostics.Append(response.State.Set(ctx, data)...) } -func (r *resourceVPCBlockPublicAccessExclusion) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { - r.SetTagsAll(ctx, req, resp) -} - -func (r *resourceVPCBlockPublicAccessExclusion) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - conn := r.Meta().EC2Client(ctx) - - var state resourceVPCBlockPublicAccessExclusionModel - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { +func (r *vpcBlockPublicAccessExclusionResource) Read(ctx context.Context, request resource.ReadRequest, response *resource.ReadResponse) { + var data resourceVPCBlockPublicAccessExclusionModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { return } - if err := state.InitFromID(); err != nil { - resp.Diagnostics.AddError("parsing resource ID", err.Error()) + conn := r.Meta().EC2Client(ctx) - return - } + output, err := findVPCBlockPublicAccessExclusionByID(ctx, conn, data.ExclusionID.ValueString()) - out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, state.ID.ValueString()) if tfresource.NotFound(err) { - resp.State.RemoveResource(ctx) + response.Diagnostics.Append(fwdiag.NewResourceNotFoundWarningDiagnostic(err)) + response.State.RemoveResource(ctx) + return } + if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), - err.Error(), - ) + response.Diagnostics.AddError(fmt.Sprintf("reading VPC Block Public Access Exclusion (%s)", data.ExclusionID.ValueString()), err.Error()) + return } - resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) - if resp.Diagnostics.HasError() { + // Set attributes for import. + response.Diagnostics.Append(fwflex.Flatten(ctx, output, &data)...) + if response.Diagnostics.HasError() { return } - // Extract VPC Id and Subnet Id to support import - resource_arn := state.ResourceARN.ValueString() + // Extract VPC ID and Subnet ID. + resourceARN, err := arn.Parse(data.ResourceARN.ValueString()) - arn, err := arn.Parse(resource_arn) if err != nil { - resp.Diagnostics.AddError("Parsing Resource ARN", err.Error()) + response.Diagnostics.AddError("parsing Resource ARN", err.Error()) + return } - if strings.HasPrefix(arn.Resource, "vpc/") { - vpc_id := strings.TrimPrefix(arn.Resource, "vpc/") - state.VPCID = types.StringValue(vpc_id) - } else if strings.HasPrefix(arn.Resource, "subnet/") { - subnet_id := strings.TrimPrefix(arn.Resource, "subnet/") - state.SubnetID = types.StringValue(subnet_id) + if resource := resourceARN.Resource; strings.HasPrefix(resource, "vpc/") { + data.VPCID = types.StringValue(strings.TrimPrefix(resource, "vpc/")) + } else if strings.HasPrefix(resource, "subnet/") { + data.SubnetID = types.StringValue(strings.TrimPrefix(resource, "subnet/")) } else { - resp.Diagnostics.AddError("Parsing Resource_ARN", fmt.Sprintf("Unknown resource type: %s", arn.Resource)) + response.Diagnostics.AddError("parsing Resource_ARN", fmt.Sprintf("unknown resource type: %s", resource)) + return } - setTagsOut(ctx, out.Tags) + setTagsOut(ctx, output.Tags) - resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) + response.Diagnostics.Append(response.State.Set(ctx, &data)...) } -func (r *resourceVPCBlockPublicAccessExclusion) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - conn := r.Meta().EC2Client(ctx) - - var plan, state resourceVPCBlockPublicAccessExclusionModel - - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { +func (r *vpcBlockPublicAccessExclusionResource) Update(ctx context.Context, request resource.UpdateRequest, response *resource.UpdateResponse) { + var new, old resourceVPCBlockPublicAccessExclusionModel + response.Diagnostics.Append(request.Plan.Get(ctx, &new)...) + if response.Diagnostics.HasError() { return } - - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { + response.Diagnostics.Append(request.State.Get(ctx, &old)...) + if response.Diagnostics.HasError() { return } - if !plan.InternetGatewayExclusionMode.Equal(state.InternetGatewayExclusionMode) { - input := ec2.ModifyVpcBlockPublicAccessExclusionInput{ - ExclusionId: state.ID.ValueStringPointer(), - InternetGatewayExclusionMode: awstypes.InternetGatewayExclusionMode(plan.InternetGatewayExclusionMode.ValueString()), - } + conn := r.Meta().EC2Client(ctx) - if resp.Diagnostics.HasError() { - return + if !new.InternetGatewayExclusionMode.Equal(old.InternetGatewayExclusionMode) { + input := &ec2.ModifyVpcBlockPublicAccessExclusionInput{ + ExclusionId: fwflex.StringFromFramework(ctx, new.ExclusionID), + InternetGatewayExclusionMode: new.InternetGatewayExclusionMode.ValueEnum(), } - out, err := conn.ModifyVpcBlockPublicAccessExclusion(ctx, &input) + _, err := conn.ModifyVpcBlockPublicAccessExclusion(ctx, input) + if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionUpdating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), err), - err.Error(), - ) - return - } - if out == nil || out.VpcBlockPublicAccessExclusion == nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionUpdating, ResNameVPCBlockPublicAccessExclusion, plan.ExclusionID.String(), nil), - errors.New("empty output").Error(), - ) + response.Diagnostics.AddError(fmt.Sprintf("updating VPC Block Public Access Exclusion (%s)", new.ExclusionID.ValueString()), err.Error()) + return } - resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) - if resp.Diagnostics.HasError() { + if _, err := waitVPCBlockPublicAccessExclusionUpdated(ctx, conn, new.ExclusionID.ValueString(), r.UpdateTimeout(ctx, new.Timeouts)); err != nil { + response.Diagnostics.AddError(fmt.Sprintf("waiting for VPC Block Public Access Exclusion (%s) update", new.ExclusionID.ValueString()), err.Error()) + return } } - updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts) - _, err := waitVPCBlockPublicAccessExclusionUpdated(ctx, conn, plan.ID.ValueString(), updateTimeout) - if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForUpdate, ResNameVPCBlockPublicAccessExclusion, plan.ID.String(), err), - err.Error(), - ) - return - } + response.Diagnostics.Append(response.State.Set(ctx, &new)...) +} - out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, state.ID.ValueString()) - if tfresource.NotFound(err) { - resp.State.RemoveResource(ctx) +func (r *vpcBlockPublicAccessExclusionResource) Delete(ctx context.Context, request resource.DeleteRequest, response *resource.DeleteResponse) { + var data resourceVPCBlockPublicAccessExclusionModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { return } - if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionSetting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), - err.Error(), - ) - return - } - resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) - resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) -} - -func (r *resourceVPCBlockPublicAccessExclusion) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { conn := r.Meta().EC2Client(ctx) - var state resourceVPCBlockPublicAccessExclusionModel - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { - return + input := &ec2.DeleteVpcBlockPublicAccessExclusionInput{ + ExclusionId: fwflex.StringFromFramework(ctx, data.ExclusionID), } - input := ec2.DeleteVpcBlockPublicAccessExclusionInput{ - ExclusionId: state.ExclusionID.ValueStringPointer(), - } + _, err := conn.DeleteVpcBlockPublicAccessExclusion(ctx, input) - _, err := conn.DeleteVpcBlockPublicAccessExclusion(ctx, &input) - if err != nil { - if !tfawserr.ErrMessageContains(err, errCodeInvalidParameterValue, "is in delete-complete state and cannot be deleted") { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionDeleting, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), - err.Error(), - ) - } + if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound) { return } - deleteTimeout := r.DeleteTimeout(ctx, state.Timeouts) - _, err = waitVPCBlockPublicAccessExclusionDeleted(ctx, conn, state.ID.ValueString(), deleteTimeout) - if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.EC2, create.ErrActionWaitingForDeletion, ResNameVPCBlockPublicAccessExclusion, state.ID.String(), err), - err.Error(), - ) + if tfawserr.ErrMessageContains(err, errCodeInvalidParameterValue, "is in delete-complete state and cannot be deleted") { return } -} - -func (r *resourceVPCBlockPublicAccessExclusion) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resource.ImportStatePassthroughID(ctx, path.Root(names.AttrID), req, resp) -} - -func waitVPCBlockPublicAccessExclusionCreated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { - stateConf := &retry.StateChangeConf{ - Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateInProgress), - Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateComplete), - Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), - Timeout: timeout, - NotFoundChecks: 2, - ContinuousTargetOccurence: 2, - } - - outputRaw, err := stateConf.WaitForStateContext(ctx) - if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { - return &out, err - } - return nil, err -} - -func waitVPCBlockPublicAccessExclusionUpdated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { - stateConf := &retry.StateChangeConf{ - Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateInProgress), - Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete, - awstypes.VpcBlockPublicAccessExclusionStateCreateComplete), - Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), - Timeout: timeout, - ContinuousTargetOccurence: 2, - } + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("deleting VPC Block Public Access Exclusion (%s)", data.ExclusionID.ValueString()), err.Error()) - outputRaw, err := stateConf.WaitForStateContext(ctx) - if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { - return &out, err + return } - return nil, err -} + if _, err := waitVPCBlockPublicAccessExclusionDeleted(ctx, conn, data.ExclusionID.ValueString(), r.DeleteTimeout(ctx, data.Timeouts)); err != nil { + response.Diagnostics.AddError(fmt.Sprintf("waiting for VPC Block Public Access Exclusion (%s) delete", data.ExclusionID.ValueString()), err.Error()) -func waitVPCBlockPublicAccessExclusionDeleted(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { - stateConf := &retry.StateChangeConf{ - // There might API inconsistencies where even after invoking delete, the Describe might come back with a CreateComplete or UpdateComplete status (the status before delete was invoked). To account for that, we are also adding those two statuses as valid statues to retry. - Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete, - awstypes.VpcBlockPublicAccessExclusionStateCreateComplete, - awstypes.VpcBlockPublicAccessExclusionStateDeleteInProgress), - Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateDeleteComplete), - Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), - Timeout: timeout, - NotFoundChecks: 1, - ContinuousTargetOccurence: 2, - } - - outputRaw, err := stateConf.WaitForStateContext(ctx) - if out, ok := outputRaw.(awstypes.VpcBlockPublicAccessExclusion); ok { - return &out, err + return } - - return nil, err } -func statusVPCBlockPublicAccessExclusion(ctx context.Context, conn *ec2.Client, id string) retry.StateRefreshFunc { - return func() (interface{}, string, error) { - out, err := FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) - - if tfresource.NotFound(err) { - return nil, "", nil - } - - if err != nil { - return nil, "", err - } - - return &out, string(out.State), nil - } +func (r *vpcBlockPublicAccessExclusionResource) ModifyPlan(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { + r.SetTagsAll(ctx, request, response) } -func FindVPCBlockPublicAccessExclusionByID(ctx context.Context, conn *ec2.Client, id string) (*awstypes.VpcBlockPublicAccessExclusion, error) { - in := &ec2.DescribeVpcBlockPublicAccessExclusionsInput{ - ExclusionIds: []string{id}, +func (r *vpcBlockPublicAccessExclusionResource) ConfigValidators(context.Context) []resource.ConfigValidator { + return []resource.ConfigValidator{ + resourcevalidator.ExactlyOneOf( + path.MatchRoot(names.AttrSubnetID), + path.MatchRoot(names.AttrVPCID), + ), } - - out, err := conn.DescribeVpcBlockPublicAccessExclusions(ctx, in) - - if tfawserr.ErrCodeEquals(err, errCodeInvalidVPCBlockPublicAccessExclusionID) { - return nil, &retry.NotFoundError{ - Message: "Exclusion Id:" + id + " Not Found", - LastRequest: in, - } - } - - if err != nil { - return nil, err - } - - if out == nil || out.VpcBlockPublicAccessExclusions == nil { - return nil, tfresource.NewEmptyResultError(in) - } - - return &(out.VpcBlockPublicAccessExclusions[0]), nil } type resourceVPCBlockPublicAccessExclusionModel struct { - CreationTimestamp timetypes.RFC3339 `tfsdk:"creation_timestamp"` - ExclusionID types.String `tfsdk:"exclusion_id"` - ID types.String `tfsdk:"id"` - InternetGatewayExclusionMode types.String `tfsdk:"internet_gateway_exclusion_mode"` - LastUpdateTimestamp timetypes.RFC3339 `tfsdk:"last_update_timestamp"` - Reason types.String `tfsdk:"reason"` - ResourceARN types.String `tfsdk:"resource_arn"` - SubnetID types.String `tfsdk:"subnet_id"` - Timeouts timeouts.Value `tfsdk:"timeouts"` - Tags tftags.Map `tfsdk:"tags"` - TagsAll tftags.Map `tfsdk:"tags_all"` - VPCID types.String `tfsdk:"vpc_id"` -} - -func (data *resourceVPCBlockPublicAccessExclusionModel) InitFromID() error { - data.ExclusionID = data.ID - return nil -} - -func (data *resourceVPCBlockPublicAccessExclusionModel) setID() { - data.ID = data.ExclusionID + ExclusionID types.String `tfsdk:"id"` + InternetGatewayExclusionMode fwtypes.StringEnum[awstypes.InternetGatewayExclusionMode] `tfsdk:"internet_gateway_exclusion_mode"` + ResourceARN types.String `tfsdk:"resource_arn"` + SubnetID types.String `tfsdk:"subnet_id"` + Tags tftags.Map `tfsdk:"tags"` + TagsAll tftags.Map `tfsdk:"tags_all"` + Timeouts timeouts.Value `tfsdk:"timeouts"` + VPCID types.String `tfsdk:"vpc_id"` } diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index 9b09681bf33..9d8b8993785 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -5,40 +5,32 @@ package ec2_test import ( "context" - "errors" "fmt" "testing" - "github.com/YakDriver/regexache" awstypes "github.com/aws/aws-sdk-go-v2/service/ec2/types" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" - "github.com/hashicorp/terraform-provider-aws/internal/create" tfec2 "github.com/hashicorp/terraform-provider-aws/internal/service/ec2" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/names" ) -// Acceptance test access AWS and cost money to run. -func TestAccVPCBlockPublicAccessExclusion_basic_vpc(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_basicVPC(t *testing.T) { ctx := acctest.Context(t) - - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) - exclusionModeBidrectional := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) - internetGatewayExclusionModeAllowEgress := string(awstypes.InternetGatewayExclusionModeAllowEgress) - resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + internetGatewayExclusionMode := string(awstypes.InternetGatewayExclusionModeAllowEgress) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.EC2) testAccPreCheckVPCBlockPublicAccess(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), @@ -46,37 +38,16 @@ func TestAccVPCBlockPublicAccessExclusion_basic_vpc(t *testing.T) { CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, exclusionModeBidrectional), + Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), - resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), - resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", exclusionModeBidrectional), - resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), - resource.TestCheckResourceAttrSet(resourceName, names.AttrVPCID), - acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`vpc/+.`)), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, internetGatewayExclusionModeAllowEgress), - Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), - resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"), - resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), - resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", internetGatewayExclusionModeAllowEgress), - resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), - resource.TestCheckResourceAttrSet(resourceName, names.AttrVPCID), - resource.TestCheckResourceAttrSet(resourceName, "reason"), - acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`vpc/+.`)), ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrResourceARN), knownvalue.NotNull()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrSubnetID), knownvalue.Null()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrVPCID), knownvalue.NotNull()), + }, }, { ResourceName: resourceName, @@ -87,23 +58,15 @@ func TestAccVPCBlockPublicAccessExclusion_basic_vpc(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_basic_subnet(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_basicSubnet(t *testing.T) { ctx := acctest.Context(t) - - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) - exclusionModeBidrectional := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) - internetGatewayExclusionModeAllowEgress := string(awstypes.InternetGatewayExclusionModeAllowEgress) - resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + internetGatewayExclusionMode := string(awstypes.InternetGatewayExclusionModeAllowEgress) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.EC2) testAccPreCheckVPCBlockPublicAccess(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), @@ -111,37 +74,16 @@ func TestAccVPCBlockPublicAccessExclusion_basic_subnet(t *testing.T) { CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(blockMode, exclusionModeBidrectional), - Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), - resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), - resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", exclusionModeBidrectional), - resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), - resource.TestCheckResourceAttrSet(resourceName, names.AttrSubnetID), - acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`subnet/+.`)), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(blockMode, internetGatewayExclusionModeAllowEgress), + Config: testAccVPCBlockPublicAccessExclusionConfig_basicSubnet(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), - resource.TestMatchResourceAttr(resourceName, names.AttrID, regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestMatchResourceAttr(resourceName, "exclusion_id", regexache.MustCompile(`vpcbpa-exclude-([0-9a-fA-F]+)$`)), - resource.TestCheckResourceAttrSet(resourceName, "last_update_timestamp"), - resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"), - resource.TestCheckResourceAttr(resourceName, "internet_gateway_exclusion_mode", internetGatewayExclusionModeAllowEgress), - resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), - resource.TestCheckResourceAttrSet(resourceName, names.AttrSubnetID), - resource.TestCheckResourceAttrSet(resourceName, "reason"), - acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrResourceARN, "ec2", regexache.MustCompile(`subnet/+.`)), ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrResourceARN), knownvalue.NotNull()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrSubnetID), knownvalue.NotNull()), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrVPCID), knownvalue.Null()), + }, }, { ResourceName: resourceName, @@ -154,18 +96,13 @@ func TestAccVPCBlockPublicAccessExclusion_basic_subnet(t *testing.T) { func TestAccVPCBlockPublicAccessExclusion_disappears(t *testing.T) { ctx := acctest.Context(t) - if testing.Short() { - t.Skip("skipping long-running test in short mode") - } - - blockMode := string(awstypes.InternetGatewayBlockModeBlockBidirectional) - exclusionMode := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + internetGatewayExclusionMode := string(awstypes.InternetGatewayExclusionModeAllowEgress) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.EC2) testAccPreCheckVPCBlockPublicAccess(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), @@ -173,11 +110,12 @@ func TestAccVPCBlockPublicAccessExclusion_disappears(t *testing.T) { CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(blockMode, exclusionMode), + Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfec2.ResourceVPCBlockPublicAccessExclusion, resourceName), ), + ExpectNonEmptyPlan: true, }, }, }) @@ -192,80 +130,52 @@ func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource continue } - id := rs.Primary.Attributes[names.AttrID] - - out, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) + _, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, rs.Primary.ID) if tfresource.NotFound(err) { - return nil - } - if err != nil { - return create.Error(names.EC2, create.ErrActionCheckingDestroyed, tfec2.ResNameVPCBlockPublicAccessExclusion, id, err) + continue } - //If the status is Delete Complete, that indicates the resource has been destroyed - if out.State == awstypes.VpcBlockPublicAccessExclusionStateDeleteComplete { - return nil + if err != nil { + return err } - return create.Error(names.EC2, create.ErrActionCheckingDestroyed, tfec2.ResNameVPCBlockPublicAccessExclusion, id, errors.New("not destroyed")) + return fmt.Errorf("VPC Block Public Access Exclusion %s still exists", rs.Primary.ID) } return nil } } -func testAccCheckBlockPublicAccessExclusionExists(ctx context.Context, name string) resource.TestCheckFunc { +func testAccCheckBlockPublicAccessExclusionExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[name] + rs, ok := s.RootModule().Resources[n] if !ok { - return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, name, errors.New("not found")) - } - - id := rs.Primary.Attributes[names.AttrID] - - if id == "" { - return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, name, errors.New("not set")) + return fmt.Errorf("Not found: %s", n) } conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) - _, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, id) - if err != nil { - return create.Error(names.EC2, create.ErrActionCheckingExistence, tfec2.ResNameVPCBlockPublicAccessExclusion, rs.Primary.Attributes[names.AttrID], err) - } + _, err := tfec2.FindVPCBlockPublicAccessExclusionByID(ctx, conn, rs.Primary.ID) - return nil + return err } } -const testAccVPCBlockPublicAccessExclusionConfig_base = ` -resource "aws_vpc" "test" { - cidr_block = "10.1.0.0/16" -} -` - -func testAccVPCBlockPublicAccessExclusionConfig_basic_vpc(rBlockMode, rExclusionMode string) string { - return acctest.ConfigCompose(testAccVPCBlockPublicAccessExclusionConfig_base, fmt.Sprintf(` - +func testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode string) string { + return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 1), fmt.Sprintf(` resource "aws_vpc_block_public_access_exclusion" "test" { - internet_gateway_exclusion_mode = %[2]q + internet_gateway_exclusion_mode = %[1]q vpc_id = aws_vpc.test.id } -`, rBlockMode, rExclusionMode)) -} - -func testAccVPCBlockPublicAccessExclusionConfig_basic_subnet(rBlockMode, rExclusionMode string) string { - return acctest.ConfigCompose(testAccVPCBlockPublicAccessExclusionConfig_base, fmt.Sprintf(` - -resource "aws_subnet" "test" { - cidr_block = "10.1.1.0/24" - vpc_id = aws_vpc.test.id +`, internetGatewayExclusionMode)) } +func testAccVPCBlockPublicAccessExclusionConfig_basicSubnet(rName, internetGatewayExclusionMode string) string { + return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 1), fmt.Sprintf(` resource "aws_vpc_block_public_access_exclusion" "test" { - internet_gateway_exclusion_mode = %[2]q - subnet_id = aws_subnet.test.id + internet_gateway_exclusion_mode = %[1]q + subnet_id = aws_subnet.test[0].id } -`, rBlockMode, rExclusionMode)) +`, internetGatewayExclusionMode)) } diff --git a/internal/service/ec2/wait.go b/internal/service/ec2/wait.go index eb1320658c2..6273c20d453 100644 --- a/internal/service/ec2/wait.go +++ b/internal/service/ec2/wait.go @@ -3215,3 +3215,68 @@ func waitVPCBlockPublicAccessOptionsUpdated(ctx context.Context, conn *ec2.Clien return nil, err } + +func waitVPCBlockPublicAccessExclusionCreated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateInProgress), + Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateCreateComplete), + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + + if output, ok := outputRaw.(*awstypes.VpcBlockPublicAccessExclusion); ok { + tfresource.SetLastError(err, errors.New(aws.ToString(output.Reason))) + + return output, err + } + + return nil, err +} + +func waitVPCBlockPublicAccessExclusionUpdated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + Pending: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateInProgress), + Target: enum.Slice(awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete), + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + + if output, ok := outputRaw.(*awstypes.VpcBlockPublicAccessExclusion); ok { + tfresource.SetLastError(err, errors.New(aws.ToString(output.Reason))) + + return output, err + } + + return nil, err +} + +func waitVPCBlockPublicAccessExclusionDeleted(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.VpcBlockPublicAccessExclusion, error) { + stateConf := &retry.StateChangeConf{ + Pending: enum.Slice( + awstypes.VpcBlockPublicAccessExclusionStateDeleteInProgress, + // There might API inconsistencies where even after invoking delete, the Describe might come back with a CreateComplete or UpdateComplete status (the status before delete was invoked). + // To account for that, we are also adding those two statuses as valid statues to retry. + awstypes.VpcBlockPublicAccessExclusionStateCreateComplete, + awstypes.VpcBlockPublicAccessExclusionStateUpdateComplete, + ), + Target: []string{}, + Refresh: statusVPCBlockPublicAccessExclusion(ctx, conn, id), + Timeout: timeout, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + + if output, ok := outputRaw.(*awstypes.VpcBlockPublicAccessExclusion); ok { + tfresource.SetLastError(err, errors.New(aws.ToString(output.Reason))) + + return output, err + } + + return nil, err +} diff --git a/website/docs/r/vpc_block_public_access_exclusion.html.markdown b/website/docs/r/vpc_block_public_access_exclusion.html.markdown index 533994375f5..ba9947525f8 100644 --- a/website/docs/r/vpc_block_public_access_exclusion.html.markdown +++ b/website/docs/r/vpc_block_public_access_exclusion.html.markdown @@ -60,11 +60,7 @@ The following arguments are optional: This resource exports the following attributes in addition to the arguments above: * `id` - The ID of the VPC Block Public Access Exclusion. -* `exclusion_id` - The ID of the VPC Block Public Access Exclusion. -* `resource_arn` - The Amazon Resource Name (ARN) the Exclusion. -* `creation_timestamp` - Creation Timestamp. -* `last_update_timestamp` - Last update Timestamp. -* `reason` - The reason for the update. +* `resource_arn` - The Amazon Resource Name (ARN) the excluded resource. * `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ## Timeouts @@ -77,7 +73,7 @@ This resource exports the following attributes in addition to the arguments abov ## Import -In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import VPC Block Public Access Exclusion using the `example_id_arg`. For example: +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import VPC Block Public Access Exclusion using the `id`. For example: ```terraform import { @@ -86,7 +82,7 @@ import { } ``` -Using `terraform import`, import EC2 (Elastic Compute Cloud) VPC Block Public Access Exclusion using the `example_id_arg`. For example: +Using `terraform import`, import EC2 (Elastic Compute Cloud) VPC Block Public Access Exclusion using the `id`. For example: ```console % terraform import aws_vpc_block_public_access_exclusion.example vpcbpa-exclude-1234abcd From cd75422ee2aa7df564d07c29a01f197f54b61ef2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 26 Nov 2024 16:34:15 -0500 Subject: [PATCH 08/14] Add 'TestAccVPCBlockPublicAccessExclusion_update'. --- .../vpc_block_public_access_exclusion_test.go | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index 9d8b8993785..abb59a28737 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -121,6 +121,49 @@ func TestAccVPCBlockPublicAccessExclusion_disappears(t *testing.T) { }) } +func TestAccVPCBlockPublicAccessExclusion_update(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_vpc_block_public_access_exclusion.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + internetGatewayExclusionMode1 := string(awstypes.InternetGatewayExclusionModeAllowBidirectional) + internetGatewayExclusionMode2 := string(awstypes.InternetGatewayExclusionModeAllowEgress) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + testAccPreCheckVPCBlockPublicAccess(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode1), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode1)), + }, + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode2), + Check: resource.ComposeTestCheckFunc( + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode2)), + }, + }, + }, + }) +} + func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) From 6449ce0f45e56511894176e6bf03be58e742eba4 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 08:29:03 -0500 Subject: [PATCH 09/14] Fix semgrep 'ci.caps5-in-const-name/ci.caps5-in-var-name'. --- internal/service/ec2/errors.go | 2 +- internal/service/ec2/find.go | 2 +- internal/service/ec2/vpc_block_public_access_exclusion.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ec2/errors.go b/internal/service/ec2/errors.go index 9e59ed6283c..f6329491ad4 100644 --- a/internal/service/ec2/errors.go +++ b/internal/service/ec2/errors.go @@ -109,6 +109,7 @@ const ( errCodeInvalidTransitGatewayMulticastDomainIdNotFound = "InvalidTransitGatewayMulticastDomainId.NotFound" errCodeInvalidTransitGatewayPolicyTableAssociationNotFound = "InvalidTransitGatewayPolicyTableAssociation.NotFound" errCodeInvalidTransitGatewayPolicyTableIdNotFound = "InvalidTransitGatewayPolicyTableId.NotFound" + errCodeInvalidVPCBlockPublicAccessExclusionIdNotFound = "InvalidVpcBlockPublicAccessExclusionId.NotFound" errCodeInvalidVPCCIDRBlockAssociationIDNotFound = "InvalidVpcCidrBlockAssociationID.NotFound" errCodeInvalidVPCEndpointIdNotFound = "InvalidVpcEndpointId.NotFound" errCodeInvalidVPCEndpointNotFound = "InvalidVpcEndpoint.NotFound" @@ -124,7 +125,6 @@ const ( errCodeInvalidVerifiedAccessInstanceIdNotFound = "InvalidVerifiedAccessInstanceId.NotFound" errCodeInvalidVerifiedAccessTrustProviderIdNotFound = "InvalidVerifiedAccessTrustProviderId.NotFound" errCodeInvalidVolumeNotFound = "InvalidVolume.NotFound" - errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound = "InvalidVpcBlockPublicAccessExclusionId.NotFound" errCodeNatGatewayNotFound = "NatGatewayNotFound" errCodeNetworkACLEntryAlreadyExists = "NetworkAclEntryAlreadyExists" errCodeOperationNotPermitted = "OperationNotPermitted" diff --git a/internal/service/ec2/find.go b/internal/service/ec2/find.go index 7d7f4dc7bef..67229325aa6 100644 --- a/internal/service/ec2/find.go +++ b/internal/service/ec2/find.go @@ -6617,7 +6617,7 @@ func findVPCBlockPublicAccessExclusions(ctx context.Context, conn *ec2.Client, i return !lastPage }) - if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound) { + if tfawserr.ErrCodeEquals(err, errCodeInvalidVPCBlockPublicAccessExclusionIdNotFound) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index 40cb11f8d49..e5e2c9cb624 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -233,7 +233,7 @@ func (r *vpcBlockPublicAccessExclusionResource) Delete(ctx context.Context, requ _, err := conn.DeleteVpcBlockPublicAccessExclusion(ctx, input) - if tfawserr.ErrCodeEquals(err, errCodeInvalidVpcBlockPublicAccessExclusionIdNotFound) { + if tfawserr.ErrCodeEquals(err, errCodeInvalidVPCBlockPublicAccessExclusionIdNotFound) { return } From 84c6854cfc62557d6c9c251c2492b13951ce56e3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 08:31:37 -0500 Subject: [PATCH 10/14] Run 'make gen'. --- internal/service/ec2/service_package_gen.go | 2 +- .../tags/main_gen.tf | 0 .../tagsComputed1/main_gen.tf | 0 .../tagsComputed2/main_gen.tf | 0 .../tags_defaults/main_gen.tf | 0 .../tags_ignore/main_gen.tf | 0 ...k_public_access_exclusion_tags_gen_test.go | 322 +++++++++--------- 7 files changed, 162 insertions(+), 162 deletions(-) rename internal/service/ec2/testdata/{BlockPublicAccessExclusion => VPCBlockPublicAccessExclusion}/tags/main_gen.tf (100%) rename internal/service/ec2/testdata/{BlockPublicAccessExclusion => VPCBlockPublicAccessExclusion}/tagsComputed1/main_gen.tf (100%) rename internal/service/ec2/testdata/{BlockPublicAccessExclusion => VPCBlockPublicAccessExclusion}/tagsComputed2/main_gen.tf (100%) rename internal/service/ec2/testdata/{BlockPublicAccessExclusion => VPCBlockPublicAccessExclusion}/tags_defaults/main_gen.tf (100%) rename internal/service/ec2/testdata/{BlockPublicAccessExclusion => VPCBlockPublicAccessExclusion}/tags_ignore/main_gen.tf (100%) diff --git a/internal/service/ec2/service_package_gen.go b/internal/service/ec2/service_package_gen.go index cf63f4fc27a..a6ef17ba3d9 100644 --- a/internal/service/ec2/service_package_gen.go +++ b/internal/service/ec2/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic }, { Factory: newVPCBlockPublicAccessExclusionResource, - Name: "Block Public Access Exclusion", + Name: "VPC Block Public Access Exclusion", Tags: &types.ServicePackageResourceTags{ IdentifierAttribute: names.AttrID, }, diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf rename to internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf rename to internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf rename to internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf rename to internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf diff --git a/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf rename to internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go index 84eccb6b791..12922e6df97 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -24,11 +24,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -36,7 +36,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -59,7 +59,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -71,7 +71,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -80,7 +80,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -107,7 +107,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -120,7 +120,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -128,7 +128,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -151,7 +151,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -163,13 +163,13 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -184,7 +184,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, @@ -197,7 +197,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -205,11 +205,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -217,7 +217,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -240,7 +240,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -258,7 +258,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -266,17 +266,17 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{})), @@ -291,7 +291,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), @@ -307,7 +307,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -315,17 +315,17 @@ func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -340,7 +340,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -348,7 +348,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -371,7 +371,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -386,7 +386,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -394,11 +394,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -406,7 +406,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -429,7 +429,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -441,13 +441,13 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -462,7 +462,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, @@ -475,7 +475,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { }) } -func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -483,11 +483,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -495,7 +495,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -518,7 +518,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -527,7 +527,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -554,7 +554,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -567,7 +567,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -575,7 +575,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -598,7 +598,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -613,7 +613,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing. }) } -func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -621,11 +621,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -633,7 +633,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -656,7 +656,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -664,7 +664,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -687,7 +687,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test }, }, { - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -702,7 +702,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *test }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -710,11 +710,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -723,7 +723,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -743,7 +743,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -757,7 +757,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -767,7 +767,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -789,7 +789,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -804,7 +804,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -813,7 +813,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -833,7 +833,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -847,13 +847,13 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -869,7 +869,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, @@ -882,7 +882,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testi }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -890,11 +890,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -905,7 +905,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -931,7 +931,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -947,7 +947,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -959,7 +959,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -989,7 +989,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1006,13 +1006,13 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1028,7 +1028,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, @@ -1041,7 +1041,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *tes }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1049,11 +1049,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1064,7 +1064,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1088,7 +1088,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1104,7 +1104,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1117,7 +1117,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1145,7 +1145,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1163,7 +1163,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1174,7 +1174,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1198,7 +1198,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1216,7 +1216,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testin }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1224,11 +1224,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -1236,7 +1236,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1260,7 +1260,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1269,7 +1269,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1289,7 +1289,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1305,7 +1305,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly( }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1313,11 +1313,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1326,7 +1326,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1346,7 +1346,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -1354,7 +1354,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1378,7 +1378,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -1393,7 +1393,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly( }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1401,11 +1401,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1416,7 +1416,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *t }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1440,7 +1440,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1458,7 +1458,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *t }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1466,11 +1466,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1479,7 +1479,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag( acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1499,7 +1499,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag( }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1515,7 +1515,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag( }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1523,11 +1523,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResour resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1538,7 +1538,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResour }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1562,7 +1562,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResour }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1583,7 +1583,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResour }) } -func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1591,11 +1591,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingRes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1606,7 +1606,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingRes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1632,7 +1632,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingRes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1653,7 +1653,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingRes }) } -func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1661,17 +1661,17 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1694,7 +1694,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), @@ -1707,7 +1707,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T }) } -func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1715,11 +1715,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -1727,7 +1727,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1751,7 +1751,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), @@ -1759,7 +1759,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi "knownTagValue": config.StringVariable(acctest.CtValue1), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1788,7 +1788,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), @@ -1803,7 +1803,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testi }) } -func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1811,11 +1811,11 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -1823,7 +1823,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *t }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1847,13 +1847,13 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable(acctest.CtKey1), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, acctest.CtTagsKey1, "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1876,7 +1876,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable(acctest.CtKey1), @@ -1889,7 +1889,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *t }) } -func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1897,12 +1897,12 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ // 1: Create { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1916,7 +1916,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1951,7 +1951,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * // 2: Update ignored tag only { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -1965,7 +1965,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2000,7 +2000,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * // 3: Update both tags { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ @@ -2014,7 +2014,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2050,7 +2050,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t * }) } -func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { +func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -2058,12 +2058,12 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ // 1: Create { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -2075,7 +2075,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2121,7 +2121,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t // 2: Update ignored tag { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -2133,7 +2133,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2178,7 +2178,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t // 3: Update both tags { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ @@ -2190,7 +2190,7 @@ func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ From 943261f54948451b3a3436c1eeb2015a543f3b13 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 08:32:52 -0500 Subject: [PATCH 11/14] Fix golangci-lint 'unparam'. --- internal/service/ec2/wait.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ec2/wait.go b/internal/service/ec2/wait.go index 6273c20d453..757628c8697 100644 --- a/internal/service/ec2/wait.go +++ b/internal/service/ec2/wait.go @@ -3196,7 +3196,7 @@ func waitVPNGatewayVPCAttachmentDetached(ctx context.Context, conn *ec2.Client, return nil, err } -func waitVPCBlockPublicAccessOptionsUpdated(ctx context.Context, conn *ec2.Client, timeout time.Duration) (*awstypes.VpcBlockPublicAccessOptions, error) { +func waitVPCBlockPublicAccessOptionsUpdated(ctx context.Context, conn *ec2.Client, timeout time.Duration) (*awstypes.VpcBlockPublicAccessOptions, error) { //nolint:unparam stateConf := &retry.StateChangeConf{ Pending: enum.Slice(awstypes.VpcBlockPublicAccessStateUpdateInProgress), Target: enum.Slice(awstypes.VpcBlockPublicAccessStateUpdateComplete), From 19b376dc45836df69ea106bd431ffe5c3284b01a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 08:35:10 -0500 Subject: [PATCH 12/14] Fix test compilation errors. --- .../vpc_block_public_access_exclusion_test.go | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index abb59a28737..1df350c7749 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -35,12 +35,12 @@ func TestAccVPCBlockPublicAccessExclusion_basicVPC(t *testing.T) { }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode)), @@ -71,12 +71,12 @@ func TestAccVPCBlockPublicAccessExclusion_basicSubnet(t *testing.T) { }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccVPCBlockPublicAccessExclusionConfig_basicSubnet(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode)), @@ -107,12 +107,12 @@ func TestAccVPCBlockPublicAccessExclusion_disappears(t *testing.T) { }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode), Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfec2.ResourceVPCBlockPublicAccessExclusion, resourceName), ), ExpectNonEmptyPlan: true, @@ -135,12 +135,12 @@ func TestAccVPCBlockPublicAccessExclusion_update(t *testing.T) { }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode1), Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode1)), @@ -154,7 +154,7 @@ func TestAccVPCBlockPublicAccessExclusion_update(t *testing.T) { { Config: testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode2), Check: resource.ComposeTestCheckFunc( - testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("internet_gateway_exclusion_mode"), knownvalue.StringExact(internetGatewayExclusionMode2)), @@ -164,7 +164,7 @@ func TestAccVPCBlockPublicAccessExclusion_update(t *testing.T) { }) } -func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource.TestCheckFunc { +func testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) @@ -190,7 +190,7 @@ func testAccCheckBlockPublicAccessExclusionDestroy(ctx context.Context) resource } } -func testAccCheckBlockPublicAccessExclusionExists(ctx context.Context, n string) resource.TestCheckFunc { +func testAccCheckVPCBlockPublicAccessExclusionExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { From cee58a8b9cf925e69f011ac16b527f1a115be68d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 08:40:08 -0500 Subject: [PATCH 13/14] Fix tflint 'Warning: [Fixable] variable rName is declared but not used (terraform_unused_declarations)'. --- .../tags/main_gen.tf | 6 -- .../tagsComputed1/main_gen.tf | 6 -- .../tagsComputed2/main_gen.tf | 6 -- .../tags_defaults/main_gen.tf | 6 -- .../tags_ignore/main_gen.tf | 6 -- .../ec2/vpc_block_public_access_exclusion.go | 1 + ...k_public_access_exclusion_tags_gen_test.go | 97 ------------------- 7 files changed, 1 insertion(+), 127 deletions(-) diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf index 5b83d82aec9..e6b10715fff 100644 --- a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf +++ b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf @@ -12,12 +12,6 @@ resource "aws_vpc_block_public_access_exclusion" "test" { tags = var.resource_tags } -variable "rName" { - description = "Name for resource" - type = string - nullable = false -} - variable "resource_tags" { description = "Tags to set on resource. To specify no tags, set to `null`" # Not setting a default, so that this must explicitly be set to `null` to specify no tags diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf index 9d12d2ce2ac..176099e2054 100644 --- a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf +++ b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf @@ -18,12 +18,6 @@ resource "aws_vpc_block_public_access_exclusion" "test" { resource "null_resource" "test" {} -variable "rName" { - description = "Name for resource" - type = string - nullable = false -} - variable "unknownTagKey" { type = string nullable = false diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf index edc8144b9fc..cfa15e67320 100644 --- a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf +++ b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf @@ -19,12 +19,6 @@ resource "aws_vpc_block_public_access_exclusion" "test" { resource "null_resource" "test" {} -variable "rName" { - description = "Name for resource" - type = string - nullable = false -} - variable "unknownTagKey" { type = string nullable = false diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf index 191590dba31..64f602f8bd3 100644 --- a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf +++ b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf @@ -18,12 +18,6 @@ resource "aws_vpc_block_public_access_exclusion" "test" { tags = var.resource_tags } -variable "rName" { - description = "Name for resource" - type = string - nullable = false -} - variable "resource_tags" { description = "Tags to set on resource. To specify no tags, set to `null`" # Not setting a default, so that this must explicitly be set to `null` to specify no tags diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf index 2c4336f4f99..1bab55160b2 100644 --- a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf +++ b/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf @@ -21,12 +21,6 @@ resource "aws_vpc_block_public_access_exclusion" "test" { tags = var.resource_tags } -variable "rName" { - description = "Name for resource" - type = string - nullable = false -} - variable "resource_tags" { description = "Tags to set on resource. To specify no tags, set to `null`" # Not setting a default, so that this must explicitly be set to `null` to specify no tags diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index e5e2c9cb624..f1ba15c5bba 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -33,6 +33,7 @@ import ( // @FrameworkResource("aws_vpc_block_public_access_exclusion", name="VPC Block Public Access Exclusion") // @Tags(identifierAttribute="id") // @Testing(tagsTest=true) +// @Testing(generator=false) func newVPCBlockPublicAccessExclusionResource(_ context.Context) (resource.ResourceWithConfigure, error) { r := &vpcBlockPublicAccessExclusionResource{} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go index 12922e6df97..e86afa24de7 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-testing/config" - sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/knownvalue" "github.com/hashicorp/terraform-plugin-testing/plancheck" @@ -19,7 +18,6 @@ import ( func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -30,7 +28,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -61,7 +58,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -73,7 +69,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -109,7 +104,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -122,7 +116,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), }), @@ -153,7 +146,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), }), @@ -165,7 +157,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( @@ -186,7 +177,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, ResourceName: resourceName, @@ -200,7 +190,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -211,7 +200,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: nil, }), @@ -242,7 +230,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: nil, }), @@ -261,7 +248,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -272,7 +258,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), }, Check: resource.ComposeAggregateTestCheckFunc( @@ -293,7 +278,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), }, ResourceName: resourceName, @@ -310,7 +294,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -321,7 +304,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( @@ -342,7 +324,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -373,7 +354,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -389,7 +369,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -400,7 +379,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -431,7 +409,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -443,7 +420,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( @@ -464,7 +440,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, ResourceName: resourceName, @@ -478,7 +453,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -489,7 +463,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -520,7 +493,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), acctest.CtKey2: config.StringVariable(""), @@ -556,7 +528,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), acctest.CtKey2: config.StringVariable(""), @@ -569,7 +540,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -600,7 +570,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -616,7 +585,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -627,7 +595,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -658,7 +625,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -689,7 +655,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t { ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -705,7 +670,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -716,7 +680,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -745,7 +708,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -759,7 +721,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -791,7 +752,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -806,7 +766,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), }), @@ -835,7 +794,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), }), @@ -849,7 +807,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( @@ -871,7 +828,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, ResourceName: resourceName, @@ -885,7 +841,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -896,7 +851,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -933,7 +887,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -949,7 +902,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), }), @@ -991,7 +943,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), }), @@ -1008,7 +959,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( @@ -1030,7 +980,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, ResourceName: resourceName, @@ -1044,7 +993,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1055,7 +1003,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1090,7 +1037,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1106,7 +1052,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), acctest.CtOverlapKey2: config.StringVariable("providervalue2"), @@ -1147,7 +1092,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), acctest.CtOverlapKey2: config.StringVariable("providervalue2"), @@ -1165,7 +1109,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1200,7 +1143,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1219,7 +1161,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1230,7 +1171,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1262,7 +1202,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1291,7 +1230,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1308,7 +1246,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1319,7 +1256,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1348,7 +1284,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1380,7 +1315,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1396,7 +1330,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1407,7 +1340,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1442,7 +1374,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1461,7 +1392,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1472,7 +1402,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -1501,7 +1430,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), @@ -1518,7 +1446,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1529,7 +1456,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1564,7 +1490,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1586,7 +1511,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1597,7 +1521,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1634,7 +1557,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1656,7 +1578,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1667,7 +1588,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testin ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), }, Check: resource.ComposeAggregateTestCheckFunc( @@ -1696,7 +1616,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testin ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), }, ResourceName: resourceName, @@ -1710,7 +1629,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testin func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1721,7 +1639,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1753,7 +1670,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), "knownTagKey": config.StringVariable(acctest.CtKey1), "knownTagValue": config.StringVariable(acctest.CtValue1), @@ -1790,7 +1706,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable("computedkey1"), "knownTagKey": config.StringVariable(acctest.CtKey1), "knownTagValue": config.StringVariable(acctest.CtValue1), @@ -1806,7 +1721,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1817,7 +1731,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), @@ -1849,7 +1762,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable(acctest.CtKey1), }, Check: resource.ComposeAggregateTestCheckFunc( @@ -1878,7 +1790,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), "unknownTagKey": config.StringVariable(acctest.CtKey1), }, ResourceName: resourceName, @@ -1892,7 +1803,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -1904,7 +1814,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), }), @@ -1953,7 +1862,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), }), @@ -2002,7 +1910,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Again), }), @@ -2053,7 +1960,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -2065,7 +1971,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), @@ -2123,7 +2028,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2), @@ -2180,7 +2084,6 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ - acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Again), acctest.CtResourceKey2: config.StringVariable(acctest.CtResourceValue2Updated), From 888d996bbf2184aee0c0960d7b131ced6c041229 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 27 Nov 2024 09:00:50 -0500 Subject: [PATCH 14/14] Fix acceptance test name functions. --- .../tags/main_gen.tf | 0 .../tagsComputed1/main_gen.tf | 0 .../tagsComputed2/main_gen.tf | 0 .../tags_defaults/main_gen.tf | 0 .../tags_ignore/main_gen.tf | 0 .../ec2/vpc_block_public_access_exclusion.go | 1 + ...k_public_access_exclusion_tags_gen_test.go | 322 +++++++++--------- .../vpc_block_public_access_exclusion_test.go | 6 + 8 files changed, 168 insertions(+), 161 deletions(-) rename internal/service/ec2/testdata/{VPCBlockPublicAccessExclusion => BlockPublicAccessExclusion}/tags/main_gen.tf (100%) rename internal/service/ec2/testdata/{VPCBlockPublicAccessExclusion => BlockPublicAccessExclusion}/tagsComputed1/main_gen.tf (100%) rename internal/service/ec2/testdata/{VPCBlockPublicAccessExclusion => BlockPublicAccessExclusion}/tagsComputed2/main_gen.tf (100%) rename internal/service/ec2/testdata/{VPCBlockPublicAccessExclusion => BlockPublicAccessExclusion}/tags_defaults/main_gen.tf (100%) rename internal/service/ec2/testdata/{VPCBlockPublicAccessExclusion => BlockPublicAccessExclusion}/tags_ignore/main_gen.tf (100%) diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags/main_gen.tf rename to internal/service/ec2/testdata/BlockPublicAccessExclusion/tags/main_gen.tf diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed1/main_gen.tf rename to internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed1/main_gen.tf diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tagsComputed2/main_gen.tf rename to internal/service/ec2/testdata/BlockPublicAccessExclusion/tagsComputed2/main_gen.tf diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_defaults/main_gen.tf rename to internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_defaults/main_gen.tf diff --git a/internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf b/internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf similarity index 100% rename from internal/service/ec2/testdata/VPCBlockPublicAccessExclusion/tags_ignore/main_gen.tf rename to internal/service/ec2/testdata/BlockPublicAccessExclusion/tags_ignore/main_gen.tf diff --git a/internal/service/ec2/vpc_block_public_access_exclusion.go b/internal/service/ec2/vpc_block_public_access_exclusion.go index f1ba15c5bba..cb828701ab5 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion.go @@ -34,6 +34,7 @@ import ( // @Tags(identifierAttribute="id") // @Testing(tagsTest=true) // @Testing(generator=false) +// @Testing(name="BlockPublicAccessExclusion") func newVPCBlockPublicAccessExclusionResource(_ context.Context) (resource.ResourceWithConfigure, error) { r := &vpcBlockPublicAccessExclusionResource{} diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go index e86afa24de7..225264d5a0b 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_tags_gen_test.go @@ -15,25 +15,25 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -56,7 +56,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -67,7 +67,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), @@ -75,7 +75,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -102,7 +102,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), @@ -114,14 +114,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -144,7 +144,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -155,12 +155,12 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -175,7 +175,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, @@ -187,25 +187,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags(t *testing.T) { }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: nil, }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -228,7 +228,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: nil, @@ -245,23 +245,23 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_null(t *testing.T) { }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{})), @@ -276,7 +276,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{}), }, @@ -291,23 +291,23 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyMap(t *testing.T) { }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -322,14 +322,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -352,7 +352,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -366,25 +366,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_AddOnUpdate(t *testing.T) { }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -407,7 +407,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), @@ -418,12 +418,12 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -438,7 +438,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, @@ -450,25 +450,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnCreate(t *testing.T }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -491,7 +491,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -499,7 +499,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -526,7 +526,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -538,14 +538,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi ImportStateVerify: true, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -568,7 +568,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -582,25 +582,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Add(t *testi }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -623,14 +623,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -653,7 +653,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t }, }, { - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), @@ -667,18 +667,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_EmptyTag_OnUpdate_Replace(t *t }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -686,7 +686,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -706,7 +706,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -719,7 +719,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), @@ -728,7 +728,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -750,7 +750,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1Updated), @@ -764,7 +764,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -772,7 +772,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -792,7 +792,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey2: config.StringVariable(acctest.CtValue2), @@ -805,12 +805,12 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -826,7 +826,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, @@ -838,18 +838,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_providerOnly(t *te }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), @@ -859,7 +859,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -885,7 +885,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), @@ -900,7 +900,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), @@ -911,7 +911,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -941,7 +941,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), @@ -957,12 +957,12 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -978,7 +978,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, @@ -990,18 +990,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nonOverlapping(t * }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1011,7 +1011,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1035,7 +1035,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1050,7 +1050,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1062,7 +1062,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1090,7 +1090,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1107,7 +1107,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1117,7 +1117,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1141,7 +1141,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtOverlapKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1158,25 +1158,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_overlapping(t *tes }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1200,7 +1200,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1208,7 +1208,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1228,7 +1228,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1243,18 +1243,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToProviderOn }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOnly(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1262,7 +1262,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1282,14 +1282,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1313,7 +1313,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1327,18 +1327,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_updateToResourceOn }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1348,7 +1348,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1372,7 +1372,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), @@ -1389,18 +1389,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyResourceTag(t }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), @@ -1408,7 +1408,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT acctest.CtResourceTags: nil, }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.Null()), @@ -1428,7 +1428,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(""), @@ -1443,18 +1443,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_emptyProviderOnlyT }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1464,7 +1464,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1488,7 +1488,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1508,18 +1508,18 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullOverlappingRes }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1529,7 +1529,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1555,7 +1555,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_defaults/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_defaults/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1575,23 +1575,23 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_DefaultTags_nullNonOverlapping }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable("computedkey1"), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1614,7 +1614,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testin }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable("computedkey1"), }, @@ -1626,25 +1626,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnCreate(t *testin }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1668,14 +1668,14 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable("computedkey1"), "knownTagKey": config.StringVariable(acctest.CtKey1), "knownTagValue": config.StringVariable(acctest.CtValue1), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1704,7 +1704,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed2/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed2/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable("computedkey1"), "knownTagKey": config.StringVariable(acctest.CtKey1), @@ -1718,25 +1718,25 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Add(t *te }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtKey1: config.StringVariable(acctest.CtValue1), }), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1760,12 +1760,12 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable(acctest.CtKey1), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, acctest.CtTagsKey1, "null_resource.test", names.AttrID), ), ConfigStateChecks: []statecheck.StateCheck{ @@ -1788,7 +1788,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tagsComputed1/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tagsComputed1/"), ConfigVariables: config.Variables{ "unknownTagKey": config.StringVariable(acctest.CtKey1), }, @@ -1800,19 +1800,19 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_ComputedTag_OnUpdate_Replace(t }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ // 1: Create { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1), @@ -1825,7 +1825,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1860,7 +1860,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( // 2: Update ignored tag only { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Updated), @@ -1873,7 +1873,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1908,7 +1908,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( // 3: Update both tags { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtProviderTags: config.MapVariable(map[string]config.Variable{ acctest.CtProviderKey1: config.StringVariable(acctest.CtProviderValue1Again), @@ -1921,7 +1921,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -1957,19 +1957,19 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_DefaultTag( }) } -func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { +func TestAccVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_vpc_block_public_access_exclusion.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.EC2ServiceID), - CheckDestroy: testAccCheckVPCBlockPublicAccessExclusionDestroy(ctx), + CheckDestroy: testAccCheckBlockPublicAccessExclusionDestroy(ctx), Steps: []resource.TestStep{ // 1: Create { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1), @@ -1980,7 +1980,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2026,7 +2026,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag // 2: Update ignored tag { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Updated), @@ -2037,7 +2037,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ @@ -2082,7 +2082,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag // 3: Update both tags { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - ConfigDirectory: config.StaticDirectory("testdata/VPCBlockPublicAccessExclusion/tags_ignore/"), + ConfigDirectory: config.StaticDirectory("testdata/BlockPublicAccessExclusion/tags_ignore/"), ConfigVariables: config.Variables{ acctest.CtResourceTags: config.MapVariable(map[string]config.Variable{ acctest.CtResourceKey1: config.StringVariable(acctest.CtResourceValue1Again), @@ -2093,7 +2093,7 @@ func TestAccVPCVPCBlockPublicAccessExclusion_tags_IgnoreTags_Overlap_ResourceTag ), }, Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckVPCBlockPublicAccessExclusionExists(ctx, resourceName), + testAccCheckBlockPublicAccessExclusionExists(ctx, resourceName), ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTags), knownvalue.MapExact(map[string]knownvalue.Check{ diff --git a/internal/service/ec2/vpc_block_public_access_exclusion_test.go b/internal/service/ec2/vpc_block_public_access_exclusion_test.go index 1df350c7749..893ffec911f 100644 --- a/internal/service/ec2/vpc_block_public_access_exclusion_test.go +++ b/internal/service/ec2/vpc_block_public_access_exclusion_test.go @@ -205,6 +205,12 @@ func testAccCheckVPCBlockPublicAccessExclusionExists(ctx context.Context, n stri } } +// For generated tests. +var ( + testAccCheckBlockPublicAccessExclusionDestroy = testAccCheckVPCBlockPublicAccessExclusionDestroy + testAccCheckBlockPublicAccessExclusionExists = testAccCheckVPCBlockPublicAccessExclusionExists +) + func testAccVPCBlockPublicAccessExclusionConfig_basicVPC(rName, internetGatewayExclusionMode string) string { return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 1), fmt.Sprintf(` resource "aws_vpc_block_public_access_exclusion" "test" {