From b10ba5e2a38db49c24abc0aafcc543c1b4d87403 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Mon, 26 Feb 2024 11:46:09 -0500 Subject: [PATCH 001/137] cross account attachment resource --- .../cross_account_attachment.go | 534 ++++++++++++++++++ .../cross_account_attachment_test.go | 476 ++++++++++++++++ .../service/globalaccelerator/exports_test.go | 13 + .../globalaccelerator/service_package_gen.go | 7 +- ...tor_cross_account_attachment.html.markdown | 80 +++ 5 files changed, 1109 insertions(+), 1 deletion(-) create mode 100644 internal/service/globalaccelerator/cross_account_attachment.go create mode 100644 internal/service/globalaccelerator/cross_account_attachment_test.go create mode 100644 internal/service/globalaccelerator/exports_test.go create mode 100644 website/docs/r/globalaccelerator_cross_account_attachment.html.markdown diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go new file mode 100644 index 000000000000..6f25ac678bfa --- /dev/null +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -0,0 +1,534 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package globalaccelerator + +import ( + "context" + "errors" + "fmt" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" + "github.com/hashicorp/terraform-provider-aws/internal/create" + "github.com/hashicorp/terraform-provider-aws/internal/framework" + "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + "github.com/hashicorp/terraform-provider-aws/names" +) + +// @FrameworkResource(name="Cross Account Attachment") +func newResourceCrossAccountAttachment(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &resourceCrossAccountAttachment{} + + r.SetDefaultCreateTimeout(30 * time.Minute) + r.SetDefaultUpdateTimeout(30 * time.Minute) + r.SetDefaultDeleteTimeout(30 * time.Minute) + + return r, nil +} + +const ( + ResNameCrossAccountAttachment = "Cross Account Attachment" +) + +type resourceCrossAccountAttachment struct { + framework.ResourceWithConfigure + framework.WithTimeouts +} + +func (r *resourceCrossAccountAttachment) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = "aws_globalaccelerator_cross_account_attachment" +} + +func (r *resourceCrossAccountAttachment) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "attachment_arn": framework.ARNAttributeComputedOnly(), + "id": framework.IDAttribute(), + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "principals": schema.ListAttribute{ + Optional: true, + ElementType: types.StringType, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + "resources": schema.ListAttribute{ + Optional: true, + ElementType: ResourceDataElementType, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + "created_time": schema.StringAttribute{ + Computed: true, + }, + "last_modified_time": schema.StringAttribute{ + Computed: true, + }, + }, + } +} + +func (r *resourceCrossAccountAttachment) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + conn := r.Meta().GlobalAcceleratorConn(ctx) + + var plan resourceCrossAccountAttachmentData + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + input := &globalaccelerator.CreateCrossAccountAttachmentInput{ + IdempotencyToken: aws.String(id.UniqueId()), + Name: aws.String(plan.Name.ValueString()), + Tags: getTagsIn(ctx), + } + + if !plan.Principals.IsNull() { + input.Principals = flex.ExpandFrameworkStringList(ctx, plan.Principals) + } + + if !plan.Resources.IsNull() { + var tfResources []ResourceData + diags := plan.Resources.ElementsAs(ctx, &tfResources, false) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + input.Resources = expandResources(tfResources) + } + + out, err := conn.CreateCrossAccountAttachmentWithContext(ctx, input) + + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionCreating, ResNameCrossAccountAttachment, plan.Name.String(), err), + err.Error(), + ) + return + } + if out == nil || out.CrossAccountAttachment == nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionCreating, ResNameCrossAccountAttachment, plan.Name.String(), nil), + errors.New("empty output").Error(), + ) + return + } + + plan.ID = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) + state := plan + state.ARN = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) + + state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) + if out.CrossAccountAttachment.LastModifiedTime != nil { + state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) + } + + resp.Diagnostics.Append(resp.State.Set(ctx, state)...) +} + +func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + conn := r.Meta().GlobalAcceleratorConn(ctx) + + var state resourceCrossAccountAttachmentData + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + input := &globalaccelerator.DescribeCrossAccountAttachmentInput{ + AttachmentArn: aws.String(state.ARN.ValueString()), + } + out, err := conn.DescribeCrossAccountAttachment(input) + + var nfe *globalaccelerator.AttachmentNotFoundException + if errors.As(err, &nfe) { + resp.State.RemoveResource(ctx) + return + } + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionSetting, ResNameCrossAccountAttachment, state.ID.String(), err), + err.Error(), + ) + return + } + + state.ARN = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) + state.Name = flex.StringToFramework(ctx, out.CrossAccountAttachment.Name) + state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) + if out.CrossAccountAttachment.LastModifiedTime != nil { + state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) + } + + resources, errDiags := flattenResources(ctx, out.CrossAccountAttachment.Resources) + resp.Diagnostics.Append(errDiags...) + if resp.Diagnostics.HasError() { + return + } + state.Resources = resources + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +func (r *resourceCrossAccountAttachment) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + conn := r.Meta().GlobalAcceleratorConn(ctx) + + var plan, state resourceCrossAccountAttachmentData + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + input := &globalaccelerator.UpdateCrossAccountAttachmentInput{ + AttachmentArn: aws.String(state.ARN.ValueString()), + } + + var diags diag.Diagnostics + if !plan.Principals.Equal(state.Principals) { + input.AddPrincipals, input.RemovePrincipals, diags = DiffPrincipals(ctx, state.Principals, plan.Principals) + resp.Diagnostics.Append(diags...) + } + + if !plan.Resources.Equal(state.Resources) { + input.AddResources, input.RemoveResources, diags = DiffResources(ctx, state.Resources, plan.Resources) + resp.Diagnostics.Append(diags...) + } + + if !plan.Name.Equal(state.Name) { + input.Name = aws.String(plan.Name.ValueString()) + } + + if input.Name != nil || input.AddPrincipals != nil || input.RemovePrincipals != nil || input.AddResources != nil || input.RemoveResources != nil { + out, err := conn.UpdateCrossAccountAttachmentWithContext(ctx, input) + if err != nil { + resp.Diagnostics.AddError( + "Error updating CrossAccountAttachment", + fmt.Sprintf("Could not update CrossAccountAttachment %s: %s", state.ARN.ValueString(), err), + ) + return + } + + state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) + if out.CrossAccountAttachment.LastModifiedTime != nil { + state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) + } + } + + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +func (r *resourceCrossAccountAttachment) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + conn := r.Meta().GlobalAcceleratorConn(ctx) + + var state resourceCrossAccountAttachmentData + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + input := &globalaccelerator.DeleteCrossAccountAttachmentInput{ + AttachmentArn: aws.String(state.ARN.ValueString()), + } + + _, err := conn.DeleteCrossAccountAttachmentWithContext(ctx, input) + + if err != nil { + var nfe *globalaccelerator.AttachmentNotFoundException + if errors.As(err, &nfe) { + return + } + resp.Diagnostics.AddError( + "Error deleting Global Accelerator CrossAccountAttachment", + fmt.Sprintf("Could not delete CrossAccountAttachment %s: %s", state.ARN.ValueString(), err), + ) + return + } +} + +func (r *resourceCrossAccountAttachment) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + conn := r.Meta().GlobalAcceleratorConn(ctx) + attachmentArn := req.ID + + output, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + AttachmentArn: aws.String(attachmentArn), + }) + if err != nil { + resp.Diagnostics.AddError("Error describing CrossAccountAttachment", fmt.Sprintf("Could not describe CrossAccountAttachment with ARN %s: %s", attachmentArn, err)) + return + } + + if output == nil || output.CrossAccountAttachment == nil { + resp.Diagnostics.AddError("Error describing CrossAccountAttachment", fmt.Sprintf("CrossAccountAttachment with ARN %s not found", attachmentArn)) + return + } + + var plan resourceCrossAccountAttachmentData + plan.ARN = flex.StringToFramework(ctx, output.CrossAccountAttachment.AttachmentArn) + plan.ID = flex.StringToFramework(ctx, output.CrossAccountAttachment.AttachmentArn) + plan.Name = flex.StringToFramework(ctx, output.CrossAccountAttachment.Name) + + if output.CrossAccountAttachment.Principals != nil { + plan.Principals = flex.FlattenFrameworkStringList(ctx, output.CrossAccountAttachment.Principals) + } + if output.CrossAccountAttachment.Resources != nil { + resources, errDiags := flattenResources(ctx, output.CrossAccountAttachment.Resources) + if errDiags.HasError() { + resp.Diagnostics.Append(errDiags...) + return + } + plan.Resources = resources + } + + diags := resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) + if diags.HasError() { + return + } +} + +var ResourceDataElementType = types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "endpoint_id": types.StringType, + "region": types.StringType, + }, +} + +func expandResources(tfList []ResourceData) []*globalaccelerator.Resource { + if len(tfList) == 0 { + return nil + } + + apiResources := make([]*globalaccelerator.Resource, len(tfList)) + + for i, tfResource := range tfList { + apiResource := &globalaccelerator.Resource{ + EndpointId: aws.String(tfResource.EndpointID.ValueString()), + } + + if !tfResource.Region.IsNull() && tfResource.Region.ValueString() != "" { + apiResource.Region = aws.String(tfResource.Region.ValueString()) + } + + apiResources[i] = apiResource + } + + return apiResources +} + +func flattenResources(ctx context.Context, resources []*globalaccelerator.Resource) (types.List, diag.Diagnostics) { + var diags diag.Diagnostics + + if resources == nil || len(resources) == 0 { + return types.ListNull(ResourceDataElementType), diags + } + + elems := []attr.Value{} + for _, resource := range resources { + endpointID := aws.StringValue(resource.EndpointId) + region := "" + // Extract the region from the ARN if the endpoint ID is an ARN + if strings.HasPrefix(endpointID, "arn:") { + parts := strings.Split(endpointID, ":") + if len(parts) > 3 { + region = parts[3] + } + } + + obj := map[string]attr.Value{ + "endpoint_id": types.StringValue(endpointID), + "region": types.StringValue(region), + } + objVal, d := types.ObjectValue(ResourceDataElementType.AttrTypes, obj) + diags.Append(d...) + + elems = append(elems, objVal) + } + + listVal, d := types.ListValue(ResourceDataElementType, elems) + diags.Append(d...) + + return listVal, diags +} + +func diffResources(ctx context.Context, oldList, newList types.List) (toAdd, toRemove []*globalaccelerator.Resource, diags diag.Diagnostics) { + toAdd = []*globalaccelerator.Resource{} + toRemove = []*globalaccelerator.Resource{} + var oldSlice, newSlice []ResourceData + + oldSlice, diags = convertListToResourceDataSlice(ctx, oldList) + if diags.HasError() { + return toAdd, toRemove, diags + } + + newSlice, diags = convertListToResourceDataSlice(ctx, newList) + if diags.HasError() { + return toAdd, toRemove, diags + } + + addSet, removeSet := diffResourceDataSlices(oldSlice, newSlice) + + for _, r := range addSet { + toAdd = append(toAdd, &globalaccelerator.Resource{ + EndpointId: r.EndpointId, + Region: r.Region, + }) + } + for _, r := range removeSet { + toRemove = append(toRemove, &globalaccelerator.Resource{ + EndpointId: r.EndpointId, + Region: r.Region, + }) + } + + return toAdd, toRemove, diags +} + +func convertListToResourceDataSlice(ctx context.Context, resourceList types.List) ([]ResourceData, diag.Diagnostics) { + var diags diag.Diagnostics + var resourceDataSlice []ResourceData + + if !resourceList.IsNull() { + diags := resourceList.ElementsAs(ctx, &resourceDataSlice, false) + if diags.HasError() { + return nil, diags + } + } + + return resourceDataSlice, diags +} + +func diffResourceDataSlices(oldSlice, newSlice []ResourceData) (toAdd, toRemove []*globalaccelerator.Resource) { + toRemoveMap := make(map[string]*globalaccelerator.Resource) + toAddMap := make(map[string]*globalaccelerator.Resource) + + for _, oldResource := range oldSlice { + key := generateCompositeKey(oldResource.EndpointID.ValueString(), oldResource.Region.ValueString()) + apiResource := &globalaccelerator.Resource{ + EndpointId: aws.String(oldResource.EndpointID.ValueString()), + } + if !oldResource.Region.IsNull() && oldResource.Region.ValueString() != "" { + apiResource.Region = aws.String(oldResource.Region.ValueString()) + } + toRemoveMap[key] = apiResource + } + + for _, newResource := range newSlice { + key := generateCompositeKey(newResource.EndpointID.ValueString(), newResource.Region.ValueString()) + apiResource := &globalaccelerator.Resource{ + EndpointId: aws.String(newResource.EndpointID.ValueString()), + } + if !newResource.Region.IsNull() && newResource.Region.ValueString() != "" { + apiResource.Region = aws.String(newResource.Region.ValueString()) + } + if _, found := toRemoveMap[key]; found { + delete(toRemoveMap, key) + } else { + toAddMap[key] = apiResource + } + } + + for _, resource := range toRemoveMap { + toRemove = append(toRemove, resource) + } + for _, resource := range toAddMap { + toAdd = append(toAdd, resource) + } + + return toAdd, toRemove +} + +func generateCompositeKey(endpointID, region string) string { + if region == "" { + region = "NO_REGION" // Special placeholder for resources without region + } + return endpointID + ":" + region +} + +func diffPrincipals(ctx context.Context, oldList, newList types.List) (toAdd, toRemove []*string, diags diag.Diagnostics) { + toAdd = []*string{} + toRemove = []*string{} + var oldSlice, newSlice []string + + if !oldList.IsNull() { + var oldElements []types.String + d := oldList.ElementsAs(ctx, &oldElements, false) + diags = append(diags, d...) + for _, element := range oldElements { + oldSlice = append(oldSlice, element.ValueString()) + } + } + + if !newList.IsNull() { + var newElements []types.String + d := newList.ElementsAs(ctx, &newElements, false) + diags = append(diags, d...) + for _, element := range newElements { + newSlice = append(newSlice, element.ValueString()) + } + } + + addSet, removeSet := diffSlices(oldSlice, newSlice) + + for elem := range addSet { + toAdd = append(toAdd, aws.String(elem)) + } + + for elem := range removeSet { + toRemove = append(toRemove, aws.String(elem)) + } + + return toAdd, toRemove, diags +} + +func diffSlices(oldSlice, newSlice []string) (toAdd, toRemove map[string]struct{}) { + toAdd = make(map[string]struct{}) + toRemove = make(map[string]struct{}) + + for _, s := range oldSlice { + toRemove[s] = struct{}{} + } + + for _, s := range newSlice { + if _, found := toRemove[s]; found { + delete(toRemove, s) + continue + } + toAdd[s] = struct{}{} + } + + return toAdd, toRemove +} + +type resourceCrossAccountAttachmentData struct { + ID types.String `tfsdk:"id"` + ARN types.String `tfsdk:"attachment_arn"` + Name types.String `tfsdk:"name"` + Principals types.List `tfsdk:"principals"` + Resources types.List `tfsdk:"resources"` + CreatedTime types.String `tfsdk:"created_time"` + LastModifiedTime types.String `tfsdk:"last_modified_time"` +} + +type ResourceData struct { + EndpointID types.String `tfsdk:"endpoint_id"` + Region types.String `tfsdk:"region"` +} diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go new file mode 100644 index 000000000000..55e591589bb6 --- /dev/null +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -0,0 +1,476 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package globalaccelerator_test + +import ( + "context" + "fmt" + "math/rand" + "reflect" + "strconv" + "strings" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/types" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "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" + globalaccelerator_test "github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator" +) + +func generateAccountID() string { + source := rand.NewSource(42) + rand := rand.New(source) + + accountID := "" + for i := 0; i < 12; i++ { + digit := rand.Intn(10) + accountID += strconv.Itoa(digit) + } + return accountID +} + +func TestExpandResources(t *testing.T) { + cases := []struct { + Input []globalaccelerator_test.ResourceData + ExpectedOutput []*globalaccelerator.Resource + }{ + { + Input: []globalaccelerator_test.ResourceData{}, + ExpectedOutput: nil, + }, + { + Input: []globalaccelerator_test.ResourceData{ + { + EndpointID: types.StringValue("endpoint-1"), + Region: types.StringValue("us-west-2"), + }, + { + EndpointID: types.StringValue("endpoint-2"), + Region: types.StringValue(""), + }, + }, + ExpectedOutput: []*globalaccelerator.Resource{ + { + EndpointId: aws.String("endpoint-1"), + Region: aws.String("us-west-2"), + }, + { + EndpointId: aws.String("endpoint-2"), + }, + }, + }, + } + + for _, tc := range cases { + output := globalaccelerator_test.ExpandResources(tc.Input) + if !reflect.DeepEqual(output, tc.ExpectedOutput) { + t.Fatalf("bad: expected %v, got %v", tc.ExpectedOutput, output) + } + } +} + +func TestFlattenResources(t *testing.T) { + elem := globalaccelerator_test.ResourceDataElementType + + endpoint1, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ + "endpoint_id": types.StringValue("arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0"), + "region": types.StringValue("us-west-2"), + }) + + expectedList, _ := types.ListValue(elem, []attr.Value{endpoint1}) + + testCases := []struct { + Name string + Input []*globalaccelerator.Resource + Expected types.List + }{ + { + Name: "empty input", + Input: []*globalaccelerator.Resource{}, + Expected: types.ListNull(elem), + }, + { + Name: "non-empty input", + Input: []*globalaccelerator.Resource{ + { + EndpointId: aws.String("arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0"), + Region: aws.String("us-west-2"), + }, + }, + Expected: expectedList, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + ctx := context.Background() + output, err := globalaccelerator_test.FlattenResources(ctx, tc.Input) + + if err != nil { + t.Fatalf("flattenResources() error = %v, wantErr %v", err, nil) + } + + if !reflect.DeepEqual(output, tc.Expected) { + t.Errorf("flattenResources() got = %v, want %v", output, tc.Expected) + } + }) + } +} + +func TestDiffResources(t *testing.T) { + ctx := context.Background() + elem := globalaccelerator_test.ResourceDataElementType + + endpoint1Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ + "endpoint_id": types.StringValue("endpoint-1"), + "region": types.StringValue("us-west-2"), + }) + endpoint2Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ + "endpoint_id": types.StringValue("endpoint-2"), + "region": types.StringValue("us-east-1"), + }) + + expectedResource1 := &globalaccelerator.Resource{ + EndpointId: aws.String("endpoint-1"), + Region: aws.String("us-west-2"), + } + expectedResource2 := &globalaccelerator.Resource{ + EndpointId: aws.String("endpoint-2"), + Region: aws.String("us-east-1"), + } + + cases := []struct { + Name string + OldList types.List + NewList types.List + ExpectedToAdd []*globalaccelerator.Resource + ExpectedToRemove []*globalaccelerator.Resource + }{ + { + Name: "EmptyLists", + OldList: types.ListNull(elem), + NewList: types.ListNull(elem), + ExpectedToAdd: []*globalaccelerator.Resource{}, + ExpectedToRemove: []*globalaccelerator.Resource{}, + }, + { + Name: "Resource to add", + OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), + NewList: types.ListValueMust(elem, []attr.Value{endpoint1Object, endpoint2Object}), + ExpectedToAdd: []*globalaccelerator.Resource{ + expectedResource2, + }, + ExpectedToRemove: []*globalaccelerator.Resource{}, + }, + { + Name: "Resource to remove", + OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object, endpoint2Object}), + NewList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), + ExpectedToAdd: []*globalaccelerator.Resource{}, + ExpectedToRemove: []*globalaccelerator.Resource{ + expectedResource2, + }, + }, + { + Name: "Resource to add and remove", + OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), + NewList: types.ListValueMust(elem, []attr.Value{endpoint2Object}), + ExpectedToAdd: []*globalaccelerator.Resource{ + expectedResource2, + }, + ExpectedToRemove: []*globalaccelerator.Resource{ + expectedResource1, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + toAdd, toRemove, _ := globalaccelerator_test.DiffResources(ctx, tc.OldList, tc.NewList) + + if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { + t.Errorf("expected to add: %#v, got: %#v", tc.ExpectedToAdd, toAdd) + } + + if !reflect.DeepEqual(toRemove, tc.ExpectedToRemove) { + t.Errorf("expected to remove: %#v, got: %#v", tc.ExpectedToRemove, toRemove) + } + }) + } +} + +func TestDiffPrincipals(t *testing.T) { + ctx := context.Background() + + elemType := types.StringType + + principal1 := types.StringValue("principal-1") + principal2 := types.StringValue("principal-2") + + oldList, _ := types.ListValue(elemType, []attr.Value{principal1}) + newList, _ := types.ListValue(elemType, []attr.Value{principal2}) + + cases := []struct { + Name string + OldList types.List + NewList types.List + ExpectedToAdd []*string + ExpectedToRemove []*string + }{ + { + Name: "EmptyLists", + OldList: types.ListNull(elemType), + NewList: types.ListNull(elemType), + ExpectedToAdd: []*string{}, + ExpectedToRemove: []*string{}, + }, + { + Name: "NonEmptyLists", + OldList: oldList, + NewList: newList, + ExpectedToAdd: []*string{aws.String("principal-2")}, + ExpectedToRemove: []*string{aws.String("principal-1")}, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + toAdd, toRemove, _ := globalaccelerator_test.DiffPrincipals(ctx, tc.OldList, tc.NewList) + + if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { + t.Errorf("expected to add: %#v, got: %#v", tc.ExpectedToAdd, toAdd) + } + + if !reflect.DeepEqual(toRemove, tc.ExpectedToRemove) { + t.Errorf("expected to remove: %#v, got: %#v", tc.ExpectedToRemove, toRemove) + } + }) + } +} + +func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_globalaccelerator_cross_account_attachment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + var v *globalaccelerator.DescribeCrossAccountAttachmentOutput + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + // acctest.PreCheckPartitionHasService(t, "aws_globalaccelerator_cross_account_attachment") + }, + ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccCrossAccountAttachmentConfig_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "name", rName), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} +func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_globalaccelerator_cross_account_attachment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + var v *globalaccelerator.DescribeCrossAccountAttachmentOutput + accountId := generateAccountID() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccCrossAccountAttachmentConfig_principals(rName, accountId), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", accountId), + resource.TestCheckResourceAttrSet(resourceName, "created_time"), + resource.TestCheckResourceAttrSet(resourceName, "last_modified_time"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_globalaccelerator_cross_account_attachment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + endpoint1 := "arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0" + endpoint2 := "arn:aws:ec2:us-east-1:171405876253:elastic-ip/eipalloc-1234567890abcdef1" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), + Steps: []resource.TestStep{ + { + + Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ + {EndpointID: types.StringValue(endpoint1), Region: types.StringValue(acctest.Region())}, + }), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ + "endpoint_id": endpoint1, + "region": acctest.Region(), + }), + ), + }, + { + Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ + {EndpointID: types.StringValue(endpoint1), Region: types.StringValue(acctest.Region())}, + {EndpointID: types.StringValue(endpoint2), Region: types.StringValue(acctest.AlternateRegion())}, + }), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ + "endpoint_id": endpoint1, + "region": acctest.Region(), + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ + "endpoint_id": endpoint2, + "region": acctest.AlternateRegion(), + }), + ), + }, + }, + }) +} + +func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_globalaccelerator_cross_account_attachment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + var v *globalaccelerator.DescribeCrossAccountAttachmentOutput + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + // acctest.PreCheckPartitionHasService(t, "aws_globalaccelerator_cross_account_attachment") + }, + ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccCrossAccountAttachmentConfig_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, globalaccelerator_test.ResourceCrossAccountAttachment, resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_globalaccelerator_cross_account_attachment" { + continue + } + + _, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + AttachmentArn: aws.String(rs.Primary.ID), + }) + if err != nil && strings.Contains(err.Error(), "AttachmentNotFoundException") { + return nil + } else if err != nil { + return fmt.Errorf("error checking if Global Accelerator Cross Account Attachment %s still exists: %s", rs.Primary.ID, err) + } + + return fmt.Errorf("Global Accelerator Cross Account Attachment %s still exists", rs.Primary.ID) + } + + return nil + } +} + +func testAccCheckCrossAccountAttachmentExists(ctx context.Context, resourceName string, v **globalaccelerator.DescribeCrossAccountAttachmentOutput) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + + output, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + AttachmentArn: aws.String(rs.Primary.ID), + }) + + if err != nil { + return err + } + + if output == nil || output.CrossAccountAttachment == nil { + return fmt.Errorf("Global Accelerator Cross Account Attachment %s does not exist", rs.Primary.ID) + } + + *v = output + + return nil + } +} + +func testAccCrossAccountAttachmentConfig_basic(rName string) string { + return fmt.Sprintf(` +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = %[1]q +} +`, rName) +} + +func testAccCrossAccountAttachmentConfig_principals(rName string, accountId string) string { + return fmt.Sprintf(` +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = %[1]q + principals = [%[2]q] +} +`, rName, accountId) +} + +func testAccCrossAccountAttachmentConfig_resources(rName string, resources []globalaccelerator_test.ResourceData) string { + var resourcesStr []string + for _, r := range resources { + resourcesStr = append(resourcesStr, fmt.Sprintf(`{ endpoint_id = "%s", region = "%s" }`, r.EndpointID.ValueString(), r.Region.ValueString())) + } + return fmt.Sprintf(` +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = "%s" + resources = [%s] +} +`, rName, strings.Join(resourcesStr, ", ")) +} diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go new file mode 100644 index 000000000000..e4f22b79e313 --- /dev/null +++ b/internal/service/globalaccelerator/exports_test.go @@ -0,0 +1,13 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package globalaccelerator + +// Exports for use in tests only. +var ( + ExpandResources = expandResources + FlattenResources = flattenResources + DiffResources = diffResources + DiffPrincipals = diffPrincipals + ResourceCrossAccountAttachment = newResourceCrossAccountAttachment +) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index ee841fd98c60..7acc6f4288af 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -21,7 +21,12 @@ func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.Serv } func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.ServicePackageFrameworkResource { - return []*types.ServicePackageFrameworkResource{} + return []*types.ServicePackageFrameworkResource{ + { + Factory: newResourceCrossAccountAttachment, + Name: "Cross Account Attachment", + }, + } } func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown new file mode 100644 index 000000000000..16228e8e6a49 --- /dev/null +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -0,0 +1,80 @@ +--- +subcategory: "Global Accelerator" +layout: "aws" +page_title: "AWS: aws_globalaccelerator_cross_account_attachment" +description: |- + Terraform resource for managing an AWS Global Accelerator Cross Account Attachment. +--- + +# Resource: aws_globalaccelerator_cross_account_attachment + +Terraform resource for managing an AWS Global Accelerator Cross Account Attachment. + +## Example Usage + +### Basic Usage + +```terraform +resource "aws_globalaccelerator_cross_account_attachment" "example" { + name = "example-cross-account-attachment" +} +``` + +### Usage with Optional Arguments + +```terraform +resource "aws_globalaccelerator_cross_account_attachment" "example" { + name = "example-cross-account-attachment" + principals = ["123456789012"] + resources = [ + { endpoint_id = "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", region = "us-west-2" }, + { endpoint_id = "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-other-load-balancer/50dc6c495c0c9189", region = "us-east-1" } + ] +} +``` + +## Argument Reference + +The following arguments are required: + +* `name` - (Required) Name of the Cross Account Attachment. + +The following arguments are optional: + +* `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator. +* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `arn` - ARN of the Cross Account Attachment. +* `id` - ID of the Cross Account Attachment. +* `created_time` - Creation Time when the Cross Account Attachment. +* `last_modified_time` - Last modified time of the Cross Account Attachment. +* + +## 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 Global Accelerator Cross Account Attachment using the `example_id_arg`. For example: + +```terraform +import { + to = aws_globalaccelerator_cross_account_attachment.example + id = "cross_account_attachment-id-12345678" +} +``` + +Using `terraform import`, import Global Accelerator Cross Account Attachment using the `example_id_arg`. For example: + +```console +% terraform import aws_globalaccelerator_cross_account_attachment.example cross_account_attachment-id-12345678 +``` From ec3ff8d5614697b85c2dff52145a2ee82ebe5b04 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Mon, 26 Feb 2024 15:21:00 -0500 Subject: [PATCH 002/137] address feedback --- .../cross_account_attachment.go | 26 ++++++++----------- ...tor_cross_account_attachment.html.markdown | 7 +++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index 6f25ac678bfa..b6ea32c34ac0 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -7,16 +7,15 @@ import ( "context" "errors" "fmt" - "strings" "time" + "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/globalaccelerator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/types" @@ -65,16 +64,10 @@ func (r *resourceCrossAccountAttachment) Schema(ctx context.Context, req resourc "principals": schema.ListAttribute{ Optional: true, ElementType: types.StringType, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplace(), - }, }, "resources": schema.ListAttribute{ Optional: true, ElementType: ResourceDataElementType, - PlanModifiers: []planmodifier.List{ - listplanmodifier.RequiresReplace(), - }, }, "created_time": schema.StringAttribute{ Computed: true, @@ -133,8 +126,8 @@ func (r *resourceCrossAccountAttachment) Create(ctx context.Context, req resourc return } - plan.ID = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) state := plan + state.ID = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) state.ARN = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) @@ -178,6 +171,7 @@ func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource. if out.CrossAccountAttachment.LastModifiedTime != nil { state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) } + state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) resources, errDiags := flattenResources(ctx, out.CrossAccountAttachment.Resources) resp.Diagnostics.Append(errDiags...) @@ -204,12 +198,12 @@ func (r *resourceCrossAccountAttachment) Update(ctx context.Context, req resourc var diags diag.Diagnostics if !plan.Principals.Equal(state.Principals) { - input.AddPrincipals, input.RemovePrincipals, diags = DiffPrincipals(ctx, state.Principals, plan.Principals) + input.AddPrincipals, input.RemovePrincipals, diags = diffPrincipals(ctx, state.Principals, plan.Principals) resp.Diagnostics.Append(diags...) } if !plan.Resources.Equal(state.Resources) { - input.AddResources, input.RemoveResources, diags = DiffResources(ctx, state.Resources, plan.Resources) + input.AddResources, input.RemoveResources, diags = diffResources(ctx, state.Resources, plan.Resources) resp.Diagnostics.Append(diags...) } @@ -346,11 +340,13 @@ func flattenResources(ctx context.Context, resources []*globalaccelerator.Resour endpointID := aws.StringValue(resource.EndpointId) region := "" // Extract the region from the ARN if the endpoint ID is an ARN - if strings.HasPrefix(endpointID, "arn:") { - parts := strings.Split(endpointID, ":") - if len(parts) > 3 { - region = parts[3] + if arn.IsARN(endpointID) { + parsedARN, err := arn.Parse(endpointID) + if err != nil { + diags.AddError("Error parsing ARN", err.Error()) + continue } + region = parsedARN.Region } obj := map[string]attr.Value{ diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown index 16228e8e6a49..ea7fea93126f 100644 --- a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -42,7 +42,7 @@ The following arguments are required: The following arguments are optional: * `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator. -* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region. +* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region`. The `region` field is optional. ## Attribute Reference @@ -52,7 +52,6 @@ This resource exports the following attributes in addition to the arguments abov * `id` - ID of the Cross Account Attachment. * `created_time` - Creation Time when the Cross Account Attachment. * `last_modified_time` - Last modified time of the Cross Account Attachment. -* ## Timeouts @@ -69,12 +68,12 @@ In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashico ```terraform import { to = aws_globalaccelerator_cross_account_attachment.example - id = "cross_account_attachment-id-12345678" + id = "arn:aws:globalaccelerator::012345678910:attachment/01234567-abcd-8910-efgh-123456789012" } ``` Using `terraform import`, import Global Accelerator Cross Account Attachment using the `example_id_arg`. For example: ```console -% terraform import aws_globalaccelerator_cross_account_attachment.example cross_account_attachment-id-12345678 +% terraform import arn:aws:globalaccelerator::012345678910:attachment/01234567-abcd-8910-efgh-123456789012 ``` From 74f7d3cfcef344d047f80a3d83d06b057e290fea Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Tue, 27 Feb 2024 15:28:33 -0500 Subject: [PATCH 003/137] linter fixes --- .../cross_account_attachment.go | 4 +- .../cross_account_attachment_test.go | 73 ++++++++++++------- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index b6ea32c34ac0..ba27de8f6efd 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -171,7 +171,7 @@ func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource. if out.CrossAccountAttachment.LastModifiedTime != nil { state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) } - state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) + // state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) resources, errDiags := flattenResources(ctx, out.CrossAccountAttachment.Resources) resp.Diagnostics.Append(errDiags...) @@ -331,7 +331,7 @@ func expandResources(tfList []ResourceData) []*globalaccelerator.Resource { func flattenResources(ctx context.Context, resources []*globalaccelerator.Resource) (types.List, diag.Diagnostics) { var diags diag.Diagnostics - if resources == nil || len(resources) == 0 { + if len(resources) == 0 { return types.ListNull(ResourceDataElementType), diags } diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index 55e591589bb6..dced5cedbccb 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -37,6 +37,7 @@ func generateAccountID() string { } func TestExpandResources(t *testing.T) { + t.Parallel() cases := []struct { Input []globalaccelerator_test.ResourceData ExpectedOutput []*globalaccelerator.Resource @@ -49,7 +50,7 @@ func TestExpandResources(t *testing.T) { Input: []globalaccelerator_test.ResourceData{ { EndpointID: types.StringValue("endpoint-1"), - Region: types.StringValue("us-west-2"), + Region: types.StringValue(acctest.Region()), }, { EndpointID: types.StringValue("endpoint-2"), @@ -59,7 +60,7 @@ func TestExpandResources(t *testing.T) { ExpectedOutput: []*globalaccelerator.Resource{ { EndpointId: aws.String("endpoint-1"), - Region: aws.String("us-west-2"), + Region: aws.String(acctest.Region()), }, { EndpointId: aws.String("endpoint-2"), @@ -77,11 +78,15 @@ func TestExpandResources(t *testing.T) { } func TestFlattenResources(t *testing.T) { + t.Parallel() elem := globalaccelerator_test.ResourceDataElementType + partition := acctest.Partition() + region := acctest.Region() + endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) endpoint1, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue("arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0"), - "region": types.StringValue("us-west-2"), + "endpoint_id": types.StringValue(endpointID), + "region": types.StringValue(region), }) expectedList, _ := types.ListValue(elem, []attr.Value{endpoint1}) @@ -100,8 +105,8 @@ func TestFlattenResources(t *testing.T) { Name: "non-empty input", Input: []*globalaccelerator.Resource{ { - EndpointId: aws.String("arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0"), - Region: aws.String("us-west-2"), + EndpointId: aws.String(endpointID), + Region: aws.String(region), }, }, Expected: expectedList, @@ -109,7 +114,9 @@ func TestFlattenResources(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.Name, func(t *testing.T) { + t.Parallel() ctx := context.Background() output, err := globalaccelerator_test.FlattenResources(ctx, tc.Input) @@ -125,25 +132,32 @@ func TestFlattenResources(t *testing.T) { } func TestDiffResources(t *testing.T) { + t.Parallel() ctx := context.Background() elem := globalaccelerator_test.ResourceDataElementType + partition := acctest.Partition() + region := acctest.Region() + alternateRegion := acctest.AlternateRegion() + endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) + endpointID2 := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef1", partition, alternateRegion) + endpoint1Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue("endpoint-1"), - "region": types.StringValue("us-west-2"), + "endpoint_id": types.StringValue(endpointID), + "region": types.StringValue(region), }) endpoint2Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue("endpoint-2"), - "region": types.StringValue("us-east-1"), + "endpoint_id": types.StringValue(endpointID2), + "region": types.StringValue(alternateRegion), }) expectedResource1 := &globalaccelerator.Resource{ - EndpointId: aws.String("endpoint-1"), - Region: aws.String("us-west-2"), + EndpointId: aws.String(endpointID), + Region: aws.String(region), } expectedResource2 := &globalaccelerator.Resource{ - EndpointId: aws.String("endpoint-2"), - Region: aws.String("us-east-1"), + EndpointId: aws.String(endpointID2), + Region: aws.String(alternateRegion), } cases := []struct { @@ -192,7 +206,9 @@ func TestDiffResources(t *testing.T) { } for _, tc := range cases { + tc := tc t.Run(tc.Name, func(t *testing.T) { + t.Parallel() toAdd, toRemove, _ := globalaccelerator_test.DiffResources(ctx, tc.OldList, tc.NewList) if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { @@ -207,6 +223,7 @@ func TestDiffResources(t *testing.T) { } func TestDiffPrincipals(t *testing.T) { + t.Parallel() ctx := context.Background() elemType := types.StringType @@ -241,7 +258,9 @@ func TestDiffPrincipals(t *testing.T) { } for _, tc := range cases { + tc := tc t.Run(tc.Name, func(t *testing.T) { + t.Parallel() toAdd, toRemove, _ := globalaccelerator_test.DiffPrincipals(ctx, tc.OldList, tc.NewList) if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { @@ -323,8 +342,12 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - endpoint1 := "arn:aws:ec2:us-west-2:171405876253:elastic-ip/eipalloc-1234567890abcdef0" - endpoint2 := "arn:aws:ec2:us-east-1:171405876253:elastic-ip/eipalloc-1234567890abcdef1" + + partition := acctest.Partition() + region := acctest.Region() + alternateRegion := acctest.AlternateRegion() + endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) + endpointID2 := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef1", partition, alternateRegion) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -337,28 +360,28 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { { Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ - {EndpointID: types.StringValue(endpoint1), Region: types.StringValue(acctest.Region())}, + {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, }), Check: resource.ComposeTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpoint1, - "region": acctest.Region(), + "endpoint_id": endpointID, + "region": region, }), ), }, { Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ - {EndpointID: types.StringValue(endpoint1), Region: types.StringValue(acctest.Region())}, - {EndpointID: types.StringValue(endpoint2), Region: types.StringValue(acctest.AlternateRegion())}, + {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, + {EndpointID: types.StringValue(endpointID2), Region: types.StringValue(alternateRegion)}, }), Check: resource.ComposeTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpoint1, - "region": acctest.Region(), + "endpoint_id": endpointID, + "region": region, }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpoint2, - "region": acctest.AlternateRegion(), + "endpoint_id": endpointID2, + "region": alternateRegion, }), ), }, From dc8b9c765eb575cc7c0aa99ea5c277da1dd1ccad Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Tue, 27 Feb 2024 15:44:14 -0500 Subject: [PATCH 004/137] comments, changelog --- .changelog/35991.text | 3 +++ .../globalaccelerator/cross_account_attachment.go | 3 ++- .../cross_account_attachment_test.go | 14 -------------- 3 files changed, 5 insertions(+), 15 deletions(-) create mode 100644 .changelog/35991.text diff --git a/.changelog/35991.text b/.changelog/35991.text new file mode 100644 index 000000000000..ceefbdd83500 --- /dev/null +++ b/.changelog/35991.text @@ -0,0 +1,3 @@ +```release-note:new-resource +aws_globalaccelerator_cross_account_attachment +``` \ No newline at end of file diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index ba27de8f6efd..429debae92ba 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -171,7 +171,8 @@ func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource. if out.CrossAccountAttachment.LastModifiedTime != nil { state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) } - // state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) + + state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) resources, errDiags := flattenResources(ctx, out.CrossAccountAttachment.Resources) resp.Diagnostics.Append(errDiags...) diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index dced5cedbccb..e20acfab718b 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -283,7 +283,6 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - // acctest.PreCheckPartitionHasService(t, "aws_globalaccelerator_cross_account_attachment") }, ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -357,18 +356,6 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ - { - - Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ - {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, - }), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpointID, - "region": region, - }), - ), - }, { Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, @@ -398,7 +385,6 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - // acctest.PreCheckPartitionHasService(t, "aws_globalaccelerator_cross_account_attachment") }, ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, From ac73345a87b6a1f9138abbad0e7b0690b6c5c806 Mon Sep 17 00:00:00 2001 From: Matt Burgess <549318+mattburgess@users.noreply.github.com> Date: Sat, 23 Mar 2024 22:19:15 +0000 Subject: [PATCH 005/137] appintegrations: Migrate to AWS SDK v2 --- go.mod | 1 + go.sum | 2 + internal/conns/awsclient_gen.go | 6 +-- .../appintegrations/data_integration.go | 41 ++++++++++--------- .../appintegrations/data_integration_test.go | 28 ++++++------- .../appintegrations/event_integration.go | 37 +++++++++-------- .../event_integration_data_source.go | 10 ++--- .../event_integration_data_source_test.go | 3 +- .../appintegrations/event_integration_test.go | 32 +++++++-------- internal/service/appintegrations/generate.go | 2 +- .../service_endpoints_gen_test.go | 40 +++++++++++------- .../appintegrations/service_package_gen.go | 17 ++++---- internal/service/appintegrations/tags_gen.go | 31 +++++++------- names/data/names_data.csv | 2 +- names/names.go | 1 + 15 files changed, 135 insertions(+), 118 deletions(-) diff --git a/go.mod b/go.mod index 3bb257a7df5a..5b4d94d0f303 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/appconfig v1.29.1 github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.3 github.com/aws/aws-sdk-go-v2/service/appflow v1.41.3 + github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.3 github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.3 github.com/aws/aws-sdk-go-v2/service/athena v1.40.3 github.com/aws/aws-sdk-go-v2/service/auditmanager v1.32.3 diff --git a/go.sum b/go.sum index ff3da3101339..abff8acd489e 100644 --- a/go.sum +++ b/go.sum @@ -58,6 +58,8 @@ github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.3 h1:1eZup6prjncUlZrUcLhRxhM github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.3/go.mod h1:rez9BC+738QMML4jQ7spSMQDF2MmIvyZmfeOSdiUvTE= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.3 h1:tK9duUSGFRz/8nshXYyddbw2S7xkVSO0S7nOoUbRW/4= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.3/go.mod h1:D08dEVi5M9I0qAIl1IyMydjFQPcjQqCp2Mw3WqhCDbQ= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.3 h1:rri9+f2A76jTOKtutUNMW8ykCR9/krxzUL/pV6fCnT8= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.3/go.mod h1:DQh97NocTwdqG8YCRfEr8WzDNfzvTbtByPV9qKLePHc= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.3 h1:nby4wV20qfVF2yswXCFKL7lTkddNvYUj2P9+k/UbYQc= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.3/go.mod h1:ECUaiPa9O5LwqgVNeBduNwayctvWkc5nb8NdBLmLJ00= github.com/aws/aws-sdk-go-v2/service/athena v1.40.3 h1:Q54tyTwpoEyJNmP4WqwT9hdPHpbpNahvcW9so6lItQw= diff --git a/internal/conns/awsclient_gen.go b/internal/conns/awsclient_gen.go index 9ee9450d11ff..2c6005b603f4 100644 --- a/internal/conns/awsclient_gen.go +++ b/internal/conns/awsclient_gen.go @@ -11,6 +11,7 @@ import ( appconfig_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appconfig" appfabric_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appfabric" appflow_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appflow" + appintegrations_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appintegrations" apprunner_sdkv2 "github.com/aws/aws-sdk-go-v2/service/apprunner" athena_sdkv2 "github.com/aws/aws-sdk-go-v2/service/athena" auditmanager_sdkv2 "github.com/aws/aws-sdk-go-v2/service/auditmanager" @@ -148,7 +149,6 @@ import ( apigateway_sdkv1 "github.com/aws/aws-sdk-go/service/apigateway" apigatewayv2_sdkv1 "github.com/aws/aws-sdk-go/service/apigatewayv2" appconfig_sdkv1 "github.com/aws/aws-sdk-go/service/appconfig" - appintegrationsservice_sdkv1 "github.com/aws/aws-sdk-go/service/appintegrationsservice" applicationautoscaling_sdkv1 "github.com/aws/aws-sdk-go/service/applicationautoscaling" applicationinsights_sdkv1 "github.com/aws/aws-sdk-go/service/applicationinsights" appmesh_sdkv1 "github.com/aws/aws-sdk-go/service/appmesh" @@ -304,8 +304,8 @@ func (c *AWSClient) AppFlowClient(ctx context.Context) *appflow_sdkv2.Client { return errs.Must(client[*appflow_sdkv2.Client](ctx, c, names.AppFlow, make(map[string]any))) } -func (c *AWSClient) AppIntegrationsConn(ctx context.Context) *appintegrationsservice_sdkv1.AppIntegrationsService { - return errs.Must(conn[*appintegrationsservice_sdkv1.AppIntegrationsService](ctx, c, names.AppIntegrations, make(map[string]any))) +func (c *AWSClient) AppIntegrationsClient(ctx context.Context) *appintegrations_sdkv2.Client { + return errs.Must(client[*appintegrations_sdkv2.Client](ctx, c, names.AppIntegrations, make(map[string]any))) } func (c *AWSClient) AppMeshConn(ctx context.Context) *appmesh_sdkv1.AppMesh { diff --git a/internal/service/appintegrations/data_integration.go b/internal/service/appintegrations/data_integration.go index f9f2b4a1b16f..71d1087d1a6c 100644 --- a/internal/service/appintegrations/data_integration.go +++ b/internal/service/appintegrations/data_integration.go @@ -8,14 +8,15 @@ import ( "log" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" + awstypes "github.com/aws/aws-sdk-go-v2/service/appintegrations/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/verify" @@ -110,10 +111,10 @@ func ResourceDataIntegration() *schema.Resource { func resourceDataIntegrationCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) name := d.Get("name").(string) - input := &appintegrationsservice.CreateDataIntegrationInput{ + input := &appintegrations.CreateDataIntegrationInput{ ClientToken: aws.String(id.UniqueId()), KmsKey: aws.String(d.Get("kms_key").(string)), Name: aws.String(name), @@ -126,13 +127,13 @@ func resourceDataIntegrationCreate(ctx context.Context, d *schema.ResourceData, input.Description = aws.String(v.(string)) } - output, err := conn.CreateDataIntegrationWithContext(ctx, input) + output, err := conn.CreateDataIntegration(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating AppIntegrations Data Integration (%s): %s", name, err) } - d.SetId(aws.StringValue(output.Id)) + d.SetId(aws.ToString(output.Id)) return append(diags, resourceDataIntegrationRead(ctx, d, meta)...) } @@ -140,13 +141,13 @@ func resourceDataIntegrationCreate(ctx context.Context, d *schema.ResourceData, func resourceDataIntegrationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) - output, err := conn.GetDataIntegrationWithContext(ctx, &appintegrationsservice.GetDataIntegrationInput{ + output, err := conn.GetDataIntegration(ctx, &appintegrations.GetDataIntegrationInput{ Identifier: aws.String(d.Id()), }) - if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, appintegrationsservice.ErrCodeResourceNotFoundException) { + if !d.IsNewResource() && errs.IsA[*awstypes.ResourceNotFoundException](err) { log.Printf("[WARN] AppIntegrations Data Integration (%s) not found, removing from state", d.Id()) d.SetId("") return diags @@ -173,10 +174,10 @@ func resourceDataIntegrationRead(ctx context.Context, d *schema.ResourceData, me func resourceDataIntegrationUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) if d.HasChanges("description", "name") { - _, err := conn.UpdateDataIntegrationWithContext(ctx, &appintegrationsservice.UpdateDataIntegrationInput{ + _, err := conn.UpdateDataIntegration(ctx, &appintegrations.UpdateDataIntegrationInput{ Description: aws.String(d.Get("description").(string)), Identifier: aws.String(d.Id()), Name: aws.String(d.Get("name").(string)), @@ -193,9 +194,9 @@ func resourceDataIntegrationUpdate(ctx context.Context, d *schema.ResourceData, func resourceDataIntegrationDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) - _, err := conn.DeleteDataIntegrationWithContext(ctx, &appintegrationsservice.DeleteDataIntegrationInput{ + _, err := conn.DeleteDataIntegration(ctx, &appintegrations.DeleteDataIntegrationInput{ DataIntegrationIdentifier: aws.String(d.Id()), }) @@ -206,7 +207,7 @@ func resourceDataIntegrationDelete(ctx context.Context, d *schema.ResourceData, return diags } -func expandScheduleConfig(scheduleConfig []interface{}) *appintegrationsservice.ScheduleConfiguration { +func expandScheduleConfig(scheduleConfig []interface{}) *awstypes.ScheduleConfiguration { if len(scheduleConfig) == 0 || scheduleConfig[0] == nil { return nil } @@ -216,7 +217,7 @@ func expandScheduleConfig(scheduleConfig []interface{}) *appintegrationsservice. return nil } - result := &appintegrationsservice.ScheduleConfiguration{ + result := &awstypes.ScheduleConfiguration{ FirstExecutionFrom: aws.String(tfMap["first_execution_from"].(string)), Object: aws.String(tfMap["object"].(string)), ScheduleExpression: aws.String(tfMap["schedule_expression"].(string)), @@ -225,15 +226,15 @@ func expandScheduleConfig(scheduleConfig []interface{}) *appintegrationsservice. return result } -func flattenScheduleConfig(scheduleConfig *appintegrationsservice.ScheduleConfiguration) []interface{} { +func flattenScheduleConfig(scheduleConfig *awstypes.ScheduleConfiguration) []interface{} { if scheduleConfig == nil { return []interface{}{} } values := map[string]interface{}{ - "first_execution_from": aws.StringValue(scheduleConfig.FirstExecutionFrom), - "object": aws.StringValue(scheduleConfig.Object), - "schedule_expression": aws.StringValue(scheduleConfig.ScheduleExpression), + "first_execution_from": aws.ToString(scheduleConfig.FirstExecutionFrom), + "object": aws.ToString(scheduleConfig.Object), + "schedule_expression": aws.ToString(scheduleConfig.ScheduleExpression), } return []interface{}{values} diff --git a/internal/service/appintegrations/data_integration_test.go b/internal/service/appintegrations/data_integration_test.go index 4a3f54b87e0f..a2e9ea4e7159 100644 --- a/internal/service/appintegrations/data_integration_test.go +++ b/internal/service/appintegrations/data_integration_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -21,7 +21,7 @@ import ( func TestAccAppIntegrationsDataIntegration_basic(t *testing.T) { ctx := acctest.Context(t) - var dataIntegration appintegrationsservice.GetDataIntegrationOutput + var dataIntegration appintegrations.GetDataIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") description := "example description" @@ -71,7 +71,7 @@ func TestAccAppIntegrationsDataIntegration_basic(t *testing.T) { func TestAccAppIntegrationsDataIntegration_updateDescription(t *testing.T) { ctx := acctest.Context(t) - var dataIntegration appintegrationsservice.GetDataIntegrationOutput + var dataIntegration appintegrations.GetDataIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") originalDescription := "original description" @@ -119,7 +119,7 @@ func TestAccAppIntegrationsDataIntegration_updateDescription(t *testing.T) { func TestAccAppIntegrationsDataIntegration_updateName(t *testing.T) { ctx := acctest.Context(t) - var dataIntegration appintegrationsservice.GetDataIntegrationOutput + var dataIntegration appintegrations.GetDataIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") rName2 := sdkacctest.RandomWithPrefix("resource-test-terraform") @@ -167,7 +167,7 @@ func TestAccAppIntegrationsDataIntegration_updateName(t *testing.T) { func TestAccAppIntegrationsDataIntegration_updateTags(t *testing.T) { ctx := acctest.Context(t) - var dataIntegration appintegrationsservice.GetDataIntegrationOutput + var dataIntegration appintegrations.GetDataIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") description := "example description" @@ -227,21 +227,21 @@ func TestAccAppIntegrationsDataIntegration_updateTags(t *testing.T) { func testAccCheckDataIntegrationDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appintegrations_data_integration" { continue } - input := &appintegrationsservice.GetDataIntegrationInput{ + input := &appintegrations.GetDataIntegrationInput{ Identifier: aws.String(rs.Primary.ID), } - resp, err := conn.GetDataIntegrationWithContext(ctx, input) + resp, err := conn.GetDataIntegration(ctx, input) if err == nil { - if aws.StringValue(resp.Id) == rs.Primary.ID { + if aws.ToString(resp.Id) == rs.Primary.ID { return fmt.Errorf("Data Integration '%s' was not deleted properly", rs.Primary.ID) } } @@ -251,7 +251,7 @@ func testAccCheckDataIntegrationDestroy(ctx context.Context) resource.TestCheckF } } -func testAccCheckDataIntegrationExists(ctx context.Context, name string, dataIntegration *appintegrationsservice.GetDataIntegrationOutput) resource.TestCheckFunc { +func testAccCheckDataIntegrationExists(ctx context.Context, name string, dataIntegration *appintegrations.GetDataIntegrationOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -259,11 +259,11 @@ func testAccCheckDataIntegrationExists(ctx context.Context, name string, dataInt return fmt.Errorf("Not found: %s", name) } - conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn(ctx) - input := &appintegrationsservice.GetDataIntegrationInput{ + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsClient(ctx) + input := &appintegrations.GetDataIntegrationInput{ Identifier: aws.String(rs.Primary.ID), } - resp, err := conn.GetDataIntegrationWithContext(ctx, input) + resp, err := conn.GetDataIntegration(ctx, input) if err != nil { return err diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index 6defb8cdad0b..ccf92b93568e 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -8,14 +8,15 @@ import ( "log" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" + awstypes "github.com/aws/aws-sdk-go-v2/service/appintegrations/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/verify" @@ -81,10 +82,10 @@ func ResourceEventIntegration() *schema.Resource { func resourceEventIntegrationCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) name := d.Get("name").(string) - input := &appintegrationsservice.CreateEventIntegrationInput{ + input := &appintegrations.CreateEventIntegrationInput{ ClientToken: aws.String(id.UniqueId()), EventBridgeBus: aws.String(d.Get("eventbridge_bus").(string)), EventFilter: expandEventFilter(d.Get("event_filter").([]interface{})), @@ -96,8 +97,8 @@ func resourceEventIntegrationCreate(ctx context.Context, d *schema.ResourceData, input.Description = aws.String(v.(string)) } - log.Printf("[DEBUG] Creating AppIntegrations Event Integration %s", input) - output, err := conn.CreateEventIntegrationWithContext(ctx, input) + log.Printf("[DEBUG] Creating AppIntegrations Event Integration %+v", input) + output, err := conn.CreateEventIntegration(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating AppIntegrations Event Integration (%s): %s", name, err) @@ -116,15 +117,15 @@ func resourceEventIntegrationCreate(ctx context.Context, d *schema.ResourceData, func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) name := d.Id() - resp, err := conn.GetEventIntegrationWithContext(ctx, &appintegrationsservice.GetEventIntegrationInput{ + resp, err := conn.GetEventIntegration(ctx, &appintegrations.GetEventIntegrationInput{ Name: aws.String(name), }) - if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, appintegrationsservice.ErrCodeResourceNotFoundException) { + if !d.IsNewResource() && errs.IsA[*awstypes.ResourceNotFoundException](err) { log.Printf("[WARN] AppIntegrations Event Integration (%s) not found, removing from state", d.Id()) d.SetId("") return diags @@ -155,12 +156,12 @@ func resourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, m func resourceEventIntegrationUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) name := d.Id() if d.HasChange("description") { - _, err := conn.UpdateEventIntegrationWithContext(ctx, &appintegrationsservice.UpdateEventIntegrationInput{ + _, err := conn.UpdateEventIntegration(ctx, &appintegrations.UpdateEventIntegrationInput{ Name: aws.String(name), Description: aws.String(d.Get("description").(string)), }) @@ -176,11 +177,11 @@ func resourceEventIntegrationUpdate(ctx context.Context, d *schema.ResourceData, func resourceEventIntegrationDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) name := d.Id() - _, err := conn.DeleteEventIntegrationWithContext(ctx, &appintegrationsservice.DeleteEventIntegrationInput{ + _, err := conn.DeleteEventIntegration(ctx, &appintegrations.DeleteEventIntegrationInput{ Name: aws.String(name), }) @@ -191,7 +192,7 @@ func resourceEventIntegrationDelete(ctx context.Context, d *schema.ResourceData, return diags } -func expandEventFilter(eventFilter []interface{}) *appintegrationsservice.EventFilter { +func expandEventFilter(eventFilter []interface{}) *awstypes.EventFilter { if len(eventFilter) == 0 || eventFilter[0] == nil { return nil } @@ -201,20 +202,20 @@ func expandEventFilter(eventFilter []interface{}) *appintegrationsservice.EventF return nil } - result := &appintegrationsservice.EventFilter{ + result := &awstypes.EventFilter{ Source: aws.String(tfMap["source"].(string)), } return result } -func flattenEventFilter(eventFilter *appintegrationsservice.EventFilter) []interface{} { +func flattenEventFilter(eventFilter *awstypes.EventFilter) []interface{} { if eventFilter == nil { return []interface{}{} } values := map[string]interface{}{ - "source": aws.StringValue(eventFilter.Source), + "source": aws.ToString(eventFilter.Source), } return []interface{}{values} diff --git a/internal/service/appintegrations/event_integration_data_source.go b/internal/service/appintegrations/event_integration_data_source.go index 1dfbed3f7e9d..ccc97c3f4107 100644 --- a/internal/service/appintegrations/event_integration_data_source.go +++ b/internal/service/appintegrations/event_integration_data_source.go @@ -6,8 +6,8 @@ package appintegrations import ( "context" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -57,11 +57,11 @@ func DataSourceEventIntegration() *schema.Resource { func dataSourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := meta.(*conns.AWSClient).AppIntegrationsClient(ctx) ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig name := d.Get("name").(string) - output, err := conn.GetEventIntegrationWithContext(ctx, &appintegrationsservice.GetEventIntegrationInput{ + output, err := conn.GetEventIntegration(ctx, &appintegrations.GetEventIntegrationInput{ Name: aws.String(name), }) @@ -69,7 +69,7 @@ func dataSourceEventIntegrationRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "reading AppIntegrations Event Integration (%s): %s", name, err) } - d.SetId(aws.StringValue(output.Name)) + d.SetId(aws.ToString(output.Name)) d.Set("arn", output.EventIntegrationArn) d.Set("description", output.Description) if err := d.Set("event_filter", flattenEventFilter(output.EventFilter)); err != nil { diff --git a/internal/service/appintegrations/event_integration_data_source_test.go b/internal/service/appintegrations/event_integration_data_source_test.go index 261bcbc0c3bd..7c6b5579d81c 100644 --- a/internal/service/appintegrations/event_integration_data_source_test.go +++ b/internal/service/appintegrations/event_integration_data_source_test.go @@ -8,7 +8,6 @@ import ( "os" "testing" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/acctest" @@ -30,7 +29,7 @@ func TestAccAppIntegrationsEventIntegrationDataSource_name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, appintegrationsservice.EndpointsID) + acctest.PreCheckPartitionHasService(t, names.AppIntegrationsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.AppIntegrationsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, diff --git a/internal/service/appintegrations/event_integration_test.go b/internal/service/appintegrations/event_integration_test.go index 33cae771990c..9dfcae93769d 100644 --- a/internal/service/appintegrations/event_integration_test.go +++ b/internal/service/appintegrations/event_integration_test.go @@ -9,8 +9,8 @@ import ( "os" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -22,7 +22,7 @@ import ( func TestAccAppIntegrationsEventIntegration_basic(t *testing.T) { ctx := acctest.Context(t) - var eventIntegration appintegrationsservice.GetEventIntegrationOutput + var eventIntegration appintegrations.GetEventIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") originalDescription := "original description" @@ -39,7 +39,7 @@ func TestAccAppIntegrationsEventIntegration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, appintegrationsservice.EndpointsID) + acctest.PreCheckPartitionHasService(t, names.AppIntegrationsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.AppIntegrationsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -82,7 +82,7 @@ func TestAccAppIntegrationsEventIntegration_basic(t *testing.T) { func TestAccAppIntegrationsEventIntegration_updateTags(t *testing.T) { ctx := acctest.Context(t) - var eventIntegration appintegrationsservice.GetEventIntegrationOutput + var eventIntegration appintegrations.GetEventIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") description := "example description" @@ -98,7 +98,7 @@ func TestAccAppIntegrationsEventIntegration_updateTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, appintegrationsservice.EndpointsID) + acctest.PreCheckPartitionHasService(t, names.AppIntegrationsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.AppIntegrationsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -162,7 +162,7 @@ func TestAccAppIntegrationsEventIntegration_updateTags(t *testing.T) { func TestAccAppIntegrationsEventIntegration_disappears(t *testing.T) { ctx := acctest.Context(t) - var eventIntegration appintegrationsservice.GetEventIntegrationOutput + var eventIntegration appintegrations.GetEventIntegrationOutput rName := sdkacctest.RandomWithPrefix("resource-test-terraform") description := "disappears" @@ -178,7 +178,7 @@ func TestAccAppIntegrationsEventIntegration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, appintegrationsservice.EndpointsID) + acctest.PreCheckPartitionHasService(t, names.AppIntegrationsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.AppIntegrationsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -198,20 +198,20 @@ func TestAccAppIntegrationsEventIntegration_disappears(t *testing.T) { func testAccCheckEventIntegrationDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appintegrations_event_integration" { continue } - input := &appintegrationsservice.GetEventIntegrationInput{ + input := &appintegrations.GetEventIntegrationInput{ Name: aws.String(rs.Primary.ID), } - resp, err := conn.GetEventIntegrationWithContext(ctx, input) + resp, err := conn.GetEventIntegration(ctx, input) if err == nil { - if aws.StringValue(resp.Name) == rs.Primary.ID { + if aws.ToString(resp.Name) == rs.Primary.ID { return fmt.Errorf("Event Integration '%s' was not deleted properly", rs.Primary.ID) } } @@ -221,7 +221,7 @@ func testAccCheckEventIntegrationDestroy(ctx context.Context) resource.TestCheck } } -func testAccCheckEventIntegrationExists(ctx context.Context, name string, eventIntegration *appintegrationsservice.GetEventIntegrationOutput) resource.TestCheckFunc { +func testAccCheckEventIntegrationExists(ctx context.Context, name string, eventIntegration *appintegrations.GetEventIntegrationOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] @@ -229,11 +229,11 @@ func testAccCheckEventIntegrationExists(ctx context.Context, name string, eventI return fmt.Errorf("Not found: %s", name) } - conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsConn(ctx) - input := &appintegrationsservice.GetEventIntegrationInput{ + conn := acctest.Provider.Meta().(*conns.AWSClient).AppIntegrationsClient(ctx) + input := &appintegrations.GetEventIntegrationInput{ Name: aws.String(rs.Primary.ID), } - resp, err := conn.GetEventIntegrationWithContext(ctx, input) + resp, err := conn.GetEventIntegration(ctx, input) if err != nil { return err diff --git a/internal/service/appintegrations/generate.go b/internal/service/appintegrations/generate.go index 6fd29e6c3805..45800ee8cc30 100644 --- a/internal/service/appintegrations/generate.go +++ b/internal/service/appintegrations/generate.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run ../../generate/tags/main.go -ServiceTagsMap -UpdateTags +//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -ServiceTagsMap -UpdateTags -KVTValues -SkipTypesImp //go:generate go run ../../generate/servicepackage/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. diff --git a/internal/service/appintegrations/service_endpoints_gen_test.go b/internal/service/appintegrations/service_endpoints_gen_test.go index a1c6ef5fad86..e1403de0d01f 100644 --- a/internal/service/appintegrations/service_endpoints_gen_test.go +++ b/internal/service/appintegrations/service_endpoints_gen_test.go @@ -4,17 +4,17 @@ package appintegrations_test import ( "context" + "errors" "fmt" "maps" - "net/url" "os" "path/filepath" "reflect" "strings" "testing" - "github.com/aws/aws-sdk-go/aws/endpoints" - appintegrationsservice_sdkv1 "github.com/aws/aws-sdk-go/service/appintegrationsservice" + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + appintegrations_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appintegrations" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "github.com/google/go-cmp/cmp" @@ -266,32 +266,42 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S } func defaultEndpoint(region string) string { - r := endpoints.DefaultResolver() + r := appintegrations_sdkv2.NewDefaultEndpointResolverV2() - ep, err := r.EndpointFor(appintegrationsservice_sdkv1.EndpointsID, region) + ep, err := r.ResolveEndpoint(context.Background(), appintegrations_sdkv2.EndpointParameters{ + Region: aws_sdkv2.String(region), + }) if err != nil { return err.Error() } - url, _ := url.Parse(ep.URL) - - if url.Path == "" { - url.Path = "/" + if ep.URI.Path == "" { + ep.URI.Path = "/" } - return url.String() + return ep.URI.String() } func callService(ctx context.Context, t *testing.T, meta *conns.AWSClient) string { t.Helper() - client := meta.AppIntegrationsConn(ctx) - - req, _ := client.ListApplicationsRequest(&appintegrationsservice_sdkv1.ListApplicationsInput{}) + var endpoint string - req.HTTPRequest.URL.Path = "/" + client := meta.AppIntegrationsClient(ctx) - endpoint := req.HTTPRequest.URL.String() + _, err := client.ListApplications(ctx, &appintegrations_sdkv2.ListApplicationsInput{}, + func(opts *appintegrations_sdkv2.Options) { + opts.APIOptions = append(opts.APIOptions, + addRetrieveEndpointURLMiddleware(t, &endpoint), + addCancelRequestMiddleware(), + ) + }, + ) + if err == nil { + t.Fatal("Expected an error, got none") + } else if !errors.Is(err, errCancelOperation) { + t.Fatalf("Unexpected error: %s", err) + } return endpoint } diff --git a/internal/service/appintegrations/service_package_gen.go b/internal/service/appintegrations/service_package_gen.go index 0ad4dcc869ae..93220fece94f 100644 --- a/internal/service/appintegrations/service_package_gen.go +++ b/internal/service/appintegrations/service_package_gen.go @@ -5,9 +5,8 @@ package appintegrations import ( "context" - aws_sdkv1 "github.com/aws/aws-sdk-go/aws" - session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" - appintegrationsservice_sdkv1 "github.com/aws/aws-sdk-go/service/appintegrationsservice" + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + appintegrations_sdkv2 "github.com/aws/aws-sdk-go-v2/service/appintegrations" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/types" "github.com/hashicorp/terraform-provider-aws/names" @@ -58,11 +57,15 @@ func (p *servicePackage) ServicePackageName() string { return names.AppIntegrations } -// NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. -func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appintegrationsservice_sdkv1.AppIntegrationsService, error) { - sess := config["session"].(*session_sdkv1.Session) +// NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. +func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) (*appintegrations_sdkv2.Client, error) { + cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) - return appintegrationsservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return appintegrations_sdkv2.NewFromConfig(cfg, func(o *appintegrations_sdkv2.Options) { + if endpoint := config["endpoint"].(string); endpoint != "" { + o.BaseEndpoint = aws_sdkv2.String(endpoint) + } + }), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/appintegrations/tags_gen.go b/internal/service/appintegrations/tags_gen.go index cab3092d60bd..315fa1c06c24 100644 --- a/internal/service/appintegrations/tags_gen.go +++ b/internal/service/appintegrations/tags_gen.go @@ -5,9 +5,8 @@ import ( "context" "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appintegrationsservice" - "github.com/aws/aws-sdk-go/service/appintegrationsservice/appintegrationsserviceiface" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/appintegrations" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/logging" @@ -16,21 +15,21 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// map[string]*string handling +// map[string]string handling // Tags returns appintegrations service tags. -func Tags(tags tftags.KeyValueTags) map[string]*string { - return aws.StringMap(tags.Map()) +func Tags(tags tftags.KeyValueTags) map[string]string { + return tags.Map() } // KeyValueTags creates tftags.KeyValueTags from appintegrations service tags. -func KeyValueTags(ctx context.Context, tags map[string]*string) tftags.KeyValueTags { +func KeyValueTags(ctx context.Context, tags map[string]string) tftags.KeyValueTags { return tftags.New(ctx, tags) } // getTagsIn returns appintegrations service tags from Context. // nil is returned if there are no input tags. -func getTagsIn(ctx context.Context) map[string]*string { +func getTagsIn(ctx context.Context) map[string]string { if inContext, ok := tftags.FromContext(ctx); ok { if tags := Tags(inContext.TagsIn.UnwrapOrDefault()); len(tags) > 0 { return tags @@ -41,7 +40,7 @@ func getTagsIn(ctx context.Context) map[string]*string { } // setTagsOut sets appintegrations service tags in Context. -func setTagsOut(ctx context.Context, tags map[string]*string) { +func setTagsOut(ctx context.Context, tags map[string]string) { if inContext, ok := tftags.FromContext(ctx); ok { inContext.TagsOut = option.Some(KeyValueTags(ctx, tags)) } @@ -50,7 +49,7 @@ func setTagsOut(ctx context.Context, tags map[string]*string) { // updateTags updates appintegrations service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. -func updateTags(ctx context.Context, conn appintegrationsserviceiface.AppIntegrationsServiceAPI, identifier string, oldTagsMap, newTagsMap any) error { +func updateTags(ctx context.Context, conn *appintegrations.Client, identifier string, oldTagsMap, newTagsMap any, optFns ...func(*appintegrations.Options)) error { oldTags := tftags.New(ctx, oldTagsMap) newTags := tftags.New(ctx, newTagsMap) @@ -59,12 +58,12 @@ func updateTags(ctx context.Context, conn appintegrationsserviceiface.AppIntegra removedTags := oldTags.Removed(newTags) removedTags = removedTags.IgnoreSystem(names.AppIntegrations) if len(removedTags) > 0 { - input := &appintegrationsservice.UntagResourceInput{ + input := &appintegrations.UntagResourceInput{ ResourceArn: aws.String(identifier), - TagKeys: aws.StringSlice(removedTags.Keys()), + TagKeys: removedTags.Keys(), } - _, err := conn.UntagResourceWithContext(ctx, input) + _, err := conn.UntagResource(ctx, input, optFns...) if err != nil { return fmt.Errorf("untagging resource (%s): %w", identifier, err) @@ -74,12 +73,12 @@ func updateTags(ctx context.Context, conn appintegrationsserviceiface.AppIntegra updatedTags := oldTags.Updated(newTags) updatedTags = updatedTags.IgnoreSystem(names.AppIntegrations) if len(updatedTags) > 0 { - input := &appintegrationsservice.TagResourceInput{ + input := &appintegrations.TagResourceInput{ ResourceArn: aws.String(identifier), Tags: Tags(updatedTags), } - _, err := conn.TagResourceWithContext(ctx, input) + _, err := conn.TagResource(ctx, input, optFns...) if err != nil { return fmt.Errorf("tagging resource (%s): %w", identifier, err) @@ -92,5 +91,5 @@ func updateTags(ctx context.Context, conn appintegrationsserviceiface.AppIntegra // UpdateTags updates appintegrations service tags. // It is called from outside this package. func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { - return updateTags(ctx, meta.(*conns.AWSClient).AppIntegrationsConn(ctx), identifier, oldTags, newTags) + return updateTags(ctx, meta.(*conns.AWSClient).AppIntegrationsClient(ctx), identifier, oldTags, newTags) } diff --git a/names/data/names_data.csv b/names/data/names_data.csv index 05429f0ff460..9523f2e90c1f 100644 --- a/names/data/names_data.csv +++ b/names/data/names_data.csv @@ -19,7 +19,7 @@ apprunner,apprunner,apprunner,apprunner,,apprunner,,,AppRunner,AppRunner,,,2,,aw appconfig,appconfig,appconfig,appconfig,,appconfig,,,AppConfig,AppConfig,,1,2,,aws_appconfig_,,appconfig_,AppConfig,AWS,,,,,,,AppConfig,ListApplications,, appconfigdata,appconfigdata,appconfigdata,appconfigdata,,appconfigdata,,,AppConfigData,AppConfigData,,1,,,aws_appconfigdata_,,appconfigdata_,AppConfig Data,AWS,,x,,,,,AppConfigData,,, appflow,appflow,appflow,appflow,,appflow,,,AppFlow,Appflow,,,2,,aws_appflow_,,appflow_,AppFlow,Amazon,,,,,,,Appflow,ListFlows,, -appintegrations,appintegrations,appintegrationsservice,appintegrations,,appintegrations,,appintegrationsservice,AppIntegrations,AppIntegrationsService,,1,,,aws_appintegrations_,,appintegrations_,AppIntegrations,Amazon,,,,,,,AppIntegrations,ListApplications,, +appintegrations,appintegrations,appintegrationsservice,appintegrations,,appintegrations,,appintegrationsservice,AppIntegrations,AppIntegrationsService,,,2,,aws_appintegrations_,,appintegrations_,AppIntegrations,Amazon,,,,,,,AppIntegrations,ListApplications,, application-autoscaling,applicationautoscaling,applicationautoscaling,applicationautoscaling,appautoscaling,applicationautoscaling,,applicationautoscaling,AppAutoScaling,ApplicationAutoScaling,,1,,aws_appautoscaling_,aws_applicationautoscaling_,,appautoscaling_,Application Auto Scaling,,,,,,,,Application Auto Scaling,DescribeScalableTargets,, applicationcostprofiler,applicationcostprofiler,applicationcostprofiler,applicationcostprofiler,,applicationcostprofiler,,,ApplicationCostProfiler,ApplicationCostProfiler,,1,,,aws_applicationcostprofiler_,,applicationcostprofiler_,Application Cost Profiler,AWS,,x,,,,,ApplicationCostProfiler,,, discovery,discovery,applicationdiscoveryservice,applicationdiscoveryservice,,discovery,,applicationdiscovery;applicationdiscoveryservice,Discovery,ApplicationDiscoveryService,,1,,,aws_discovery_,,discovery_,Application Discovery,AWS,,x,,,,,Application Discovery Service,,, diff --git a/names/names.go b/names/names.go index 02adbf742aad..45004b100678 100644 --- a/names/names.go +++ b/names/names.go @@ -27,6 +27,7 @@ import ( const ( AccessAnalyzerEndpointID = "access-analyzer" AMPEndpointID = "aps" + AppIntegrationsEndpointID = "app-integrations" AthenaEndpointID = "athena" AuditManagerEndpointID = "auditmanager" BatchEndpointID = "batch" From a087eb283f06b95c5bca7412717b446feedf61b8 Mon Sep 17 00:00:00 2001 From: mayank0202 Date: Fri, 29 Mar 2024 15:31:01 +0530 Subject: [PATCH 006/137] Enhancement: snowflake destination addition in firehose kinesis stream --- internal/service/firehose/delivery_stream.go | 119 ++++++++++++++++++ ...sis_firehose_delivery_stream.html.markdown | 102 ++++++++++++++- 2 files changed, 220 insertions(+), 1 deletion(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 71b950125329..6db84ed98e77 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -42,6 +42,7 @@ const ( destinationTypeOpenSearchServerless destinationType = "opensearchserverless" destinationTypeRedshift destinationType = "redshift" destinationTypeSplunk destinationType = "splunk" + destinationTypeSnowflake destinationType = "snowflake" ) func (destinationType) Values() []destinationType { @@ -53,6 +54,7 @@ func (destinationType) Values() []destinationType { destinationTypeOpenSearchServerless, destinationTypeRedshift, destinationTypeSplunk, + destinationTypeSnowflake, } } @@ -977,6 +979,113 @@ func resourceDeliveryStream() *schema.Resource { }, }, }, + "snowflake_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "account_url": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateSnowflakeAccountURL, + }, + "private_key": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "key_passphrase": { + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "user": { + Type: schema.TypeString, + Required: true, + }, + "database": { + Type: schema.TypeString, + Required: true, + }, + "schema": { + Type: schema.TypeString, + Required: true, + }, + "table": { + Type: schema.TypeString, + Required: true, + }, + "snowflake_role_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "snowflake_role": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "data_loading_option": { + Type: schema.TypeString, + Optional: true, + }, + "meta_data_column_name": { + Type: schema.TypeString, + Optional: true, + }, + "content_column_name": { + Type: schema.TypeString, + Optional: true, + }, + "snowflake_vpc_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "private_link_vpce_id": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "cloud_watch_logging_options": cloudWatchLoggingOptionsSchema(), + "processing_configuration": processingConfigurationSchema(), + "role_arn": { + Type: schema.TypeString, + Required: true, + }, + "retry_options": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "duration_in_seconds": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "s3_backup_mode": { + Type: schema.TypeString, + Optional: true, + }, + "s3_configuration": s3ConfigurationSchema(), + }, + }, + }, "opensearchserverless_configuration": { Type: schema.TypeList, Optional: true, @@ -3592,3 +3701,13 @@ func defaultProcessorParameters(destinationType destinationType, processorType t return make(map[types.ProcessorParameterName]string) } } + +func validateSnowflakeAccountURL(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !strings.HasPrefix(value, "https://") { + errors = append(errors, fmt.Errorf("%q must start with 'https://'", k)) + } + // Add more validation logic if needed, such as checking the format of the account URL + // You can use regular expressions or other methods for this validation. + return +} diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 8ce4c323076b..90d2050ffac7 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -8,7 +8,7 @@ description: |- # Resource: aws_kinesis_firehose_delivery_stream -Provides a Kinesis Firehose Delivery Stream resource. Amazon Kinesis Firehose is a fully managed, elastic service to easily deliver real-time data streams to destinations such as Amazon S3 and Amazon Redshift. +Provides a Kinesis Firehose Delivery Stream resource. Amazon Kinesis Firehose is a fully managed, elastic service to easily deliver real-time data streams to destinations such as Amazon S3 , Amazon Redshift and Snowflake. For more details, see the [Amazon Kinesis Firehose Documentation][1]. @@ -592,6 +592,83 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { } ``` +### Snowflake Destination + +```terraform +resource "aws_kinesis_firehose_delivery_stream" "example_snowflake_destination" { + name = "example-snowflake-destination" + destination = "snowflake" + + snowflake_destination_configuration { + account_url = "string" + private_key = "string" + key_passphrase = "string" + user = "string" + database = "string" + schema = "string" + table = "string" + snowflake_role_configuration { + enabled = true + snowflake_role = "string" + } + data_loading_option = "JSON_MAPPING" + meta_data_column_name = "string" + content_column_name = "string" + snowflake_vpc_configuration { + private_link_vpce_id = "string" + } + cloud_watch_logging_options { + enabled = true + log_group_name = "string" + log_stream_name = "string" + } + processing_configuration { + enabled = true + processors = [ + { + type = "RecordDeAggregation" + parameters = [ + { + parameter_name = "LambdaArn" + parameter_value = "string" + } + # Add more parameters as needed + ] + } + # Add more processors as needed + ] + } + role_arn = "string" + retry_options { + duration_in_seconds = 123 + } + s3_backup_mode = "FailedDataOnly" + s3_configuration { + role_arn = "string" + bucket_arn = "string" + prefix = "string" + error_output_prefix = "string" + buffering_hints { + size_in_mbs = 123 + interval_in_seconds = 456 + } + compression_format = "UNCOMPRESSED" + encryption_configuration { + no_encryption_config = "NoEncryption" + kms_encryption_config { + aws_kms_key_arn = "string" + } + } + cloud_watch_logging_options { + enabled = true + log_group_name = "string" + log_stream_name = "string" + } + } + } +} +``` + ## Argument Reference This resource supports the following arguments: @@ -760,6 +837,29 @@ The `http_endpoint_configuration` configuration block supports the following arg * `request_configuration` - (Optional) The request configuration. See [`request_configuration` block](#request_configuration-block) below for details. * `retry_duration` - (Optional) Total amount of seconds Firehose spends on retries. This duration starts after the initial attempt fails, It does not include the time periods during which Firehose waits for acknowledgment from the specified destination after each attempt. Valid values between `0` and `7200`. Default is `300`. +### `snowflake_configuration` block + +The `snowflake_configuration` configuration block supports the following arguments: + +* `account_url` - (Required) The URL of the Snowflake account. Format: https://[account_identifier].snowflakecomputing.com. +* `private_key` - (Required) The private key for authentication. +* `key_passphrase` - (Required) The passphrase for the private key. +* `user` - (Required) The user for authentication. +* `database` - (Required) The Snowflake database name. +* `schema` - (Required) The Snowflake schema name. +* `table` - (Required) The Snowflake table name. +* `snowflake_role_configuration` - (Optional) The configuration for Snowflake role. See [`snowflake_role_configuration` block](#snowflake_role_configuration-block) below for details. +* `data_loading_option` - (Optional) The data loading option. +* `meta_data_column_name` - (Optional) The name of the metadata column. +* `content_column_name` - (Optional) The name of the content column. +* `snowflake_vpc_configuration` - (Optional) The VPC configuration for Snowflake. See [`snowflake_vpc_configuration` block](#snowflake_vpc_configuration-block) below for details. +* `cloud_watch_logging_options` - (Optional) The CloudWatch logging options. See [`cloud_watch_logging_options` block](#cloud_watch_logging_options-block) below for details. +* `processing_configuration` - (Optional) The processing configuration. See [`processing_configuration` block](#processing_configuration-block) below for details. +* `role_arn` - (Required) The ARN of the IAM role. +* `retry_options` - (Optional) The retry options. See [`retry_options` block](#retry_options-block) below for details. +* `s3_backup_mode` - (Optional) The S3 backup mode. +* `s3_configuration` - (Required) The S3 configuration. See [`s3_configuration` block](#s3_configuration-block) below for details. + ### `cloudwatch_logging_options` block The `cloudwatch_logging_options` configuration block supports the following arguments: From 76309f7dc70074a5346b664cb4aad84f7fe299eb Mon Sep 17 00:00:00 2001 From: mayank0202 Date: Fri, 29 Mar 2024 15:49:01 +0530 Subject: [PATCH 007/137] added changelog --- .changelog/36646.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/36646.txt diff --git a/.changelog/36646.txt b/.changelog/36646.txt new file mode 100644 index 000000000000..98aa0783b851 --- /dev/null +++ b/.changelog/36646.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_kinesis_firehose_delivery_stream: Add `snowflake` as a destination +``` \ No newline at end of file From 9941f22bac94f2efa200558f91bb1c76a181e751 Mon Sep 17 00:00:00 2001 From: mayank0202 Date: Fri, 29 Mar 2024 15:52:25 +0530 Subject: [PATCH 008/137] ran make-fmt --- internal/service/firehose/delivery_stream.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 6db84ed98e77..674237917209 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -1059,8 +1059,8 @@ func resourceDeliveryStream() *schema.Resource { }, }, }, - "cloud_watch_logging_options": cloudWatchLoggingOptionsSchema(), - "processing_configuration": processingConfigurationSchema(), + "cloud_watch_logging_options": cloudWatchLoggingOptionsSchema(), + "processing_configuration": processingConfigurationSchema(), "role_arn": { Type: schema.TypeString, Required: true, @@ -1082,7 +1082,7 @@ func resourceDeliveryStream() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "s3_configuration": s3ConfigurationSchema(), + "s3_configuration": s3ConfigurationSchema(), }, }, }, @@ -3703,11 +3703,11 @@ func defaultProcessorParameters(destinationType destinationType, processorType t } func validateSnowflakeAccountURL(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !strings.HasPrefix(value, "https://") { - errors = append(errors, fmt.Errorf("%q must start with 'https://'", k)) - } - // Add more validation logic if needed, such as checking the format of the account URL - // You can use regular expressions or other methods for this validation. - return + value := v.(string) + if !strings.HasPrefix(value, "https://") { + errors = append(errors, fmt.Errorf("%q must start with 'https://'", k)) + } + // Add more validation logic if needed, such as checking the format of the account URL + // You can use regular expressions or other methods for this validation. + return } From 6f0d6c697456f70b7a1caf3b32df2386c279d900 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Wed, 3 Apr 2024 17:01:39 -0400 Subject: [PATCH 009/137] lint/semgrep --- .../service/globalaccelerator/cross_account_attachment.go | 4 ++-- .../globalaccelerator/cross_account_attachment_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index 429debae92ba..be657b08ea30 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -150,7 +150,7 @@ func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource. input := &globalaccelerator.DescribeCrossAccountAttachmentInput{ AttachmentArn: aws.String(state.ARN.ValueString()), } - out, err := conn.DescribeCrossAccountAttachment(input) + out, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, input) var nfe *globalaccelerator.AttachmentNotFoundException if errors.As(err, &nfe) { @@ -263,7 +263,7 @@ func (r *resourceCrossAccountAttachment) ImportState(ctx context.Context, req re conn := r.Meta().GlobalAcceleratorConn(ctx) attachmentArn := req.ID - output, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ AttachmentArn: aws.String(attachmentArn), }) if err != nil { diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index e20acfab718b..fe0f7bea9e09 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -411,7 +411,7 @@ func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.Tes continue } - _, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + _, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ AttachmentArn: aws.String(rs.Primary.ID), }) if err != nil && strings.Contains(err.Error(), "AttachmentNotFoundException") { @@ -436,7 +436,7 @@ func testAccCheckCrossAccountAttachmentExists(ctx context.Context, resourceName conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - output, err := conn.DescribeCrossAccountAttachment(&globalaccelerator.DescribeCrossAccountAttachmentInput{ + output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ AttachmentArn: aws.String(rs.Primary.ID), }) @@ -457,7 +457,7 @@ func testAccCheckCrossAccountAttachmentExists(ctx context.Context, resourceName func testAccCrossAccountAttachmentConfig_basic(rName string) string { return fmt.Sprintf(` resource "aws_globalaccelerator_cross_account_attachment" "test" { - name = %[1]q + name = %[1]q } `, rName) } @@ -465,7 +465,7 @@ resource "aws_globalaccelerator_cross_account_attachment" "test" { func testAccCrossAccountAttachmentConfig_principals(rName string, accountId string) string { return fmt.Sprintf(` resource "aws_globalaccelerator_cross_account_attachment" "test" { - name = %[1]q + name = %[1]q principals = [%[2]q] } `, rName, accountId) From afe919848b0ab08de13b6016a5881a439648f303 Mon Sep 17 00:00:00 2001 From: kathmbeck Date: Wed, 10 Apr 2024 12:54:02 -0400 Subject: [PATCH 010/137] naming, alphabetize feedback --- .../cross_account_attachment.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index be657b08ea30..ecdda10970d5 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -53,8 +53,14 @@ func (r *resourceCrossAccountAttachment) Metadata(_ context.Context, req resourc func (r *resourceCrossAccountAttachment) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "attachment_arn": framework.ARNAttributeComputedOnly(), - "id": framework.IDAttribute(), + "arn": framework.ARNAttributeComputedOnly(), + "created_time": schema.StringAttribute{ + Computed: true, + }, + "id": framework.IDAttribute(), + "last_modified_time": schema.StringAttribute{ + Computed: true, + }, "name": schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ @@ -69,12 +75,6 @@ func (r *resourceCrossAccountAttachment) Schema(ctx context.Context, req resourc Optional: true, ElementType: ResourceDataElementType, }, - "created_time": schema.StringAttribute{ - Computed: true, - }, - "last_modified_time": schema.StringAttribute{ - Computed: true, - }, }, } } @@ -517,7 +517,7 @@ func diffSlices(oldSlice, newSlice []string) (toAdd, toRemove map[string]struct{ type resourceCrossAccountAttachmentData struct { ID types.String `tfsdk:"id"` - ARN types.String `tfsdk:"attachment_arn"` + ARN types.String `tfsdk:"arn"` Name types.String `tfsdk:"name"` Principals types.List `tfsdk:"principals"` Resources types.List `tfsdk:"resources"` From 151f4563c179ffdd1277b25ee1e97a438a3155be Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Thu, 11 Apr 2024 00:59:50 -0700 Subject: [PATCH 011/137] New Resource Export --- internal/service/bcmdataexports/export.go | 486 ++++++++++++++++++ .../service/bcmdataexports/export_test.go | 231 +++++++++ internal/service/bcmdataexports/generate.go | 1 + .../bcmdataexports/service_package_gen.go | 7 +- internal/service/bcmdataexports/tags_gen.go | 146 ++++++ .../r/bcmdataexports_export.html.markdown | 85 +++ 6 files changed, 955 insertions(+), 1 deletion(-) create mode 100644 internal/service/bcmdataexports/export.go create mode 100644 internal/service/bcmdataexports/export_test.go create mode 100644 internal/service/bcmdataexports/tags_gen.go create mode 100644 website/docs/r/bcmdataexports_export.html.markdown diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go new file mode 100644 index 000000000000..8c98bc302336 --- /dev/null +++ b/internal/service/bcmdataexports/export.go @@ -0,0 +1,486 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package bcmdataexports + +import ( + "context" + "errors" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" + awstypes "github.com/aws/aws-sdk-go-v2/service/bcmdataexports/types" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" + "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/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/errs" + "github.com/hashicorp/terraform-provider-aws/internal/framework" + "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(name="Export") +// @Tags(identifierAttribute="id") +func newResourceExport(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &resourceExport{} + + r.SetDefaultCreateTimeout(30 * time.Minute) + r.SetDefaultUpdateTimeout(30 * time.Minute) + r.SetDefaultDeleteTimeout(30 * time.Minute) + + return r, nil +} + +const ( + ResNameExport = "Export" +) + +type resourceExport struct { + framework.ResourceWithConfigure + framework.WithTimeouts +} + +func (r *resourceExport) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = "aws_bcmdataexports_export" +} + +func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + dataQueryLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[DataQueryData](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "query_statement": schema.StringAttribute{ + Required: true, + }, + "table_configurations": schema.MapAttribute{ + // map[string]map[string]string + CustomType: fwtypes.NewMapTypeOf[fwtypes.MapValueOf[types.String]](ctx), + Optional: true, + }, + }, + }, + } + + s3OutputFormatConfigurationLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[s3OutputFormatConfiguration](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "compression": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.CompressionOption](), + }, + "format": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.FormatOption](), + }, + "output_type": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.S3OutputType](), + }, + "overwrite": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.OverwriteOption](), + }, + }, + }, + } + + s3DestinationLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[s3Destination](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "s3_bucket": schema.StringAttribute{ + Required: true, + }, + "s3_prefix": schema.StringAttribute{ + Required: true, + }, + "s3_region": schema.StringAttribute{ + Required: true, + }, + }, + Blocks: map[string]schema.Block{ + "s3_output_format_configuration": s3OutputFormatConfigurationLNB, + }, + }, + } + + destinationConfigurationsLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[DestinationConfigurationsData](ctx), + NestedObject: schema.NestedBlockObject{ + Blocks: map[string]schema.Block{ + "s3_destination": s3DestinationLNB, + }, + }, + } + + refreshCadenceLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[RefreshCadenceData](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "frequency": schema.StringAttribute{ + Required: true, + CustomType: fwtypes.StringEnumType[awstypes.FrequencyOption](), + }, + }, + }, + } + + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": framework.IDAttribute(), + names.AttrTags: tftags.TagsAttribute(), + names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), + }, + Blocks: map[string]schema.Block{ + "export": schema.ListNestedBlock{ + Validators: []validator.List{ + listvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "name": schema.StringAttribute{ + Required: true, + }, + "description": schema.StringAttribute{ + Optional: true, + }, + "export_arn": schema.StringAttribute{ + Computed: true, + }, + }, + Blocks: map[string]schema.Block{ + "dataQueryLNB": dataQueryLNB, + "destination_configurations": destinationConfigurationsLNB, + "refresh_cadence": refreshCadenceLNB, + }, + }, + }, + "timeouts": timeouts.Block(ctx, timeouts.Opts{ + Create: true, + Update: true, + Delete: true, + }), + }, + } +} + +func (r *resourceExport) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + conn := r.Meta().BCMDataExportsClient(ctx) + + var plan resourceExportData + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + in := &bcmdataexports.CreateExportInput{} + resp.Diagnostics.Append(flex.Expand(ctx, plan, in)...) + if resp.Diagnostics.HasError() { + return + } + + in.ResourceTags = getTagsIn(ctx) + + out, err := conn.CreateExport(ctx, in) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionCreating, ResNameExport, "", err), + err.Error(), + ) + return + } + if out == nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionCreating, ResNameExport, "", nil), + errors.New("empty output").Error(), + ) + return + } + + plan.ID = flex.StringToFramework(ctx, out.ExportArn) + + createTimeout := r.CreateTimeout(ctx, plan.Timeouts) + _, err = waitExportCreated(ctx, conn, plan.ID.ValueString(), createTimeout) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionWaitingForCreation, ResNameExport, plan.ID.String(), err), + err.Error(), + ) + return + } + + resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) + resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) +} + +func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + conn := r.Meta().BCMDataExportsClient(ctx) + + var state resourceExportData + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + // export,_ := state.Export.ToPtr(ctx) + + out, err := findExportByID(ctx, conn, state.ID.ValueString()) + if tfresource.NotFound(err) { + resp.State.RemoveResource(ctx) + return + } + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionSetting, ResNameExport, state.ID.String(), err), + err.Error(), + ) + return + } + + state.ID = flex.StringToFramework(ctx, out.ExportArn) + + resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + conn := r.Meta().BCMDataExportsClient(ctx) + + var plan, state resourceExportData + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + if !plan.Export.Equal(state.Export) { + in := &bcmdataexports.UpdateExportInput{} + resp.Diagnostics.Append(flex.Expand(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), plan, in)...) + if resp.Diagnostics.HasError() { + return + } + + out, err := conn.UpdateExport(ctx, in) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionUpdating, ResNameExport, plan.ID.String(), err), + err.Error(), + ) + return + } + if out == nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionUpdating, ResNameExport, plan.ID.String(), nil), + errors.New("empty output").Error(), + ) + return + } + + resp.Diagnostics.Append(flex.Flatten(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), in, &plan)...) + if resp.Diagnostics.HasError() { + return + } + } + + updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts) + _, err := waitExportUpdated(ctx, conn, plan.ID.ValueString(), updateTimeout) + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionWaitingForUpdate, ResNameExport, plan.ID.String(), err), + err.Error(), + ) + return + } + + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +func (r *resourceExport) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + conn := r.Meta().BCMDataExportsClient(ctx) + + var state resourceExportData + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + in := &bcmdataexports.DeleteExportInput{ + ExportArn: aws.String(state.ID.ValueString()), + } + + _, err := conn.DeleteExport(ctx, in) + if err != nil { + if errs.IsA[*retry.NotFoundError](err) { + return + } + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionDeleting, ResNameExport, state.ID.String(), err), + err.Error(), + ) + return + } + // deleteTimeout := r.DeleteTimeout(ctx, state.Timeouts) + // _, err = waitExportDeleted(ctx, conn, state.ID.ValueString(), deleteTimeout) + // if err != nil { + // resp.Diagnostics.AddError( + // create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionWaitingForDeletion, ResNameExport, state.ID.String(), err), + // err.Error(), + // ) + // return + // } +} + +func (r *resourceExport) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} + +const ( + statusHealthy = "Healthy" + statusError = "Unhealthy" +) + +func waitExportCreated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { + stateConf := &retry.StateChangeConf{ + Pending: []string{}, + Target: []string{statusHealthy}, + Refresh: statusExport(ctx, conn, id), + Timeout: timeout, + NotFoundChecks: 20, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + if out, ok := outputRaw.(*bcmdataexports.GetExportOutput); ok { + return out, err + } + + return nil, err +} + +func waitExportUpdated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { + stateConf := &retry.StateChangeConf{ + Pending: []string{statusError}, + Target: []string{statusHealthy}, + Refresh: statusExport(ctx, conn, id), + Timeout: timeout, + NotFoundChecks: 20, + ContinuousTargetOccurence: 2, + } + + outputRaw, err := stateConf.WaitForStateContext(ctx) + if out, ok := outputRaw.(*bcmdataexports.GetExportOutput); ok { + return out, err + } + + return nil, err +} + +// func waitExportDeleted(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*awstypes.Export, error) { +// stateConf := &retry.StateChangeConf{ +// Pending: []string{statusDeleting, statusHealthy}, +// Target: []string{}, +// Refresh: statusExport(ctx, conn, id), +// Timeout: timeout, +// } + +// outputRaw, err := stateConf.WaitForStateContext(ctx) +// if out, ok := outputRaw.(*bcmdataexports.Export); ok { +// return out, err +// } + +// return nil, err +// } + +func statusExport(ctx context.Context, conn *bcmdataexports.Client, id string) retry.StateRefreshFunc { + return func() (interface{}, string, error) { + out, err := findExportByID(ctx, conn, id) + if tfresource.NotFound(err) { + return nil, "", nil + } + + if err != nil { + return nil, "", err + } + + return out, statusHealthy, nil + } +} + +func findExportByID(ctx context.Context, conn *bcmdataexports.Client, exportArn string) (*awstypes.Export, error) { + in := &bcmdataexports.GetExportInput{ + ExportArn: aws.String(exportArn), + } + + out, err := conn.GetExport(ctx, in) + if errs.IsA[*awstypes.ResourceNotFoundException](err) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: in, + } + } + + if err != nil { + return nil, err + } + + if out == nil { + return nil, tfresource.NewEmptyResultError(in) + } + + return out.Export, nil +} + +type resourceExportData struct { + Export fwtypes.ListNestedObjectValueOf[ExportData] `tfsdk:"export"` + ID types.String `tfsdk:"id"` + Tags types.Map `tfsdk:"tags"` + TagsAll types.Map `tfsdk:"tags_all"` + Timeouts timeouts.Value `tfsdk:"timeouts"` +} + +type ExportData struct { + Description types.String `tfsdk:"description"` + Name types.String `tfsdk:"name"` + ExportArn types.String `tfsdk:"export_arn"` + DataQuery fwtypes.ListNestedObjectValueOf[DataQueryData] `tfsdk:"data_query"` + DestinationConfigurations fwtypes.ListNestedObjectValueOf[DestinationConfigurationsData] `tfsdk:"destination_configurations"` + RefreshCadence fwtypes.ListNestedObjectValueOf[RefreshCadenceData] `tfsdk:"refresh_cadence"` +} + +type DataQueryData struct { + QueryStatement types.String `tfsdk:"query_statement"` + TableConfigurations fwtypes.MapValueOf[fwtypes.MapValueOf[types.String]] `tfsdk:"table_configurations"` +} + +type s3OutputFormatConfiguration struct { + Compression fwtypes.StringEnum[awstypes.CompressionOption] `tfsdk:"compression"` + Format fwtypes.StringEnum[awstypes.FormatOption] `tfsdk:"format"` + OutputType fwtypes.StringEnum[awstypes.S3OutputType] `tfsdk:"output_type"` + Overwrite fwtypes.StringEnum[awstypes.OverwriteOption] `tfsdk:"overwrite"` +} + +type s3Destination struct { + S3Bucket types.String `tfsdk:"s3_bucket"` + S3Prefix types.String `tfsdk:"s3_prefix"` + S3Region types.String `tfsdk:"s3_region"` + S3OutputFormatConfiguration fwtypes.ListNestedObjectValueOf[s3OutputFormatConfiguration] `tfsdk:"s3_output_format_configuration"` +} + +type DestinationConfigurationsData struct { + s3Destination fwtypes.ListNestedObjectValueOf[s3Destination] `tfsdk:"s3_destination"` +} + +type RefreshCadenceData struct { + Frequency fwtypes.StringEnum[awstypes.FrequencyOption] `tfsdk:"frequency"` +} diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go new file mode 100644 index 000000000000..512ad51ebc71 --- /dev/null +++ b/internal/service/bcmdataexports/export_test.go @@ -0,0 +1,231 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package bcmdataexports_test + +import ( + "context" + "errors" + "fmt" + "testing" + + "github.com/YakDriver/regexache" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" + "github.com/aws/aws-sdk-go-v2/service/bcmdataexports/types" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "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" + "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" + + tfbcmdataexports "github.com/hashicorp/terraform-provider-aws/internal/service/bcmdataexports" +) + +func TestAccBCMDataExportsExport_basic(t *testing.T) { + ctx := acctest.Context(t) + // TIP: This is a long-running test guard for tests that run longer than + // 300s (5 min) generally. + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var export bcmdataexports.DescribeExportResponse + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_bcmdataexports_export.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) + testAccPreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckExportDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccExportConfig_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "auto_minor_version_upgrade", "false"), + resource.TestCheckResourceAttrSet(resourceName, "maintenance_window_start_time.0.day_of_week"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ + "console_access": "false", + "groups.#": "0", + "username": "Test", + "password": "TestTest1234", + }), + acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "bcmdataexports", regexache.MustCompile(`export:+.`)), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + }, + }, + }) +} + +func TestAccBCMDataExportsExport_disappears(t *testing.T) { + ctx := acctest.Context(t) + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var export bcmdataexports.DescribeExportResponse + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_bcmdataexports_export.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) + testAccPreCheck(t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckExportDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccExportConfig_basic(rName, testAccExportVersionNewer), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + // TIP: The Plugin-Framework disappears helper is similar to the Plugin-SDK version, + // but expects a new resource factory function as the third argument. To expose this + // private function to the testing package, you may need to add a line like the following + // to exports_test.go: + // + // var ResourceExport = newResourceExport + acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfbcmdataexports.ResourceExport, resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func testAccCheckExportDestroy(ctx context.Context) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_bcmdataexports_export" { + continue + } + + input := &bcmdataexports.DescribeExportInput{ + ExportId: aws.String(rs.Primary.ID), + } + _, err := conn.DescribeExport(ctx, &bcmdataexports.DescribeExportInput{ + ExportId: aws.String(rs.Primary.ID), + }) + if errs.IsA[*types.ResourceNotFoundException](err) { + return nil + } + if err != nil { + return create.Error(names.BCMDataExports, create.ErrActionCheckingDestroyed, tfbcmdataexports.ResNameExport, rs.Primary.ID, err) + } + + return create.Error(names.BCMDataExports, create.ErrActionCheckingDestroyed, tfbcmdataexports.ResNameExport, rs.Primary.ID, errors.New("not destroyed")) + } + + return nil + } +} + +func testAccCheckExportExists(ctx context.Context, name string, export *bcmdataexports.DescribeExportResponse) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[name] + if !ok { + return create.Error(names.BCMDataExports, create.ErrActionCheckingExistence, tfbcmdataexports.ResNameExport, name, errors.New("not found")) + } + + if rs.Primary.ID == "" { + return create.Error(names.BCMDataExports, create.ErrActionCheckingExistence, tfbcmdataexports.ResNameExport, name, errors.New("not set")) + } + + conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) + resp, err := conn.DescribeExport(ctx, &bcmdataexports.DescribeExportInput{ + ExportId: aws.String(rs.Primary.ID), + }) + + if err != nil { + return create.Error(names.BCMDataExports, create.ErrActionCheckingExistence, tfbcmdataexports.ResNameExport, rs.Primary.ID, err) + } + + *export = *resp + + return nil + } +} + +func testAccPreCheck(ctx context.Context, t *testing.T) { + conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) + + input := &bcmdataexports.ListExportsInput{} + _, err := conn.ListExports(ctx, input) + + if acctest.PreCheckSkipError(err) { + t.Skipf("skipping acceptance testing: %s", err) + } + if err != nil { + t.Fatalf("unexpected PreCheck error: %s", err) + } +} + +func testAccCheckExportNotRecreated(before, after *bcmdataexports.DescribeExportResponse) resource.TestCheckFunc { + return func(s *terraform.State) error { + if before, after := aws.ToString(before.ExportId), aws.ToString(after.ExportId); before != after { + return create.Error(names.BCMDataExports, create.ErrActionCheckingNotRecreated, tfbcmdataexports.ResNameExport, aws.ToString(before.ExportId), errors.New("recreated")) + } + + return nil + } +} + +func testAccExportConfig_basic(rName, version string) string { + return fmt.Sprintf(` + +resource "aws_s3_bucket" "test" { + bucket = "testing-bucket" +} + +resource "aws_bcmdataexports_export" "test" { + export { + name = "exampleexportname" + data_query { + query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" + table_configurations { + "COST_AND_USAGE_REPORT" { + "TIME_GRANULARITY" = "DAILY" + } + } + } + + "destination_configurations" { + "s3_destination" { + "s3_bucket" = aws_s3_bucket.test.bucket + "s3_prefix" = aws_s3_bucket.test.bucket_prefix + "s3_region" = aws_s3_bucket.test.region + "s3_output_configurations" { + "overwrite" = "OVERWRITE_REPORT" + "format" = "TEXT_OR_CSV" + "compression" = "GZIP" + "output_type" = "CUSTOM" + } + } + } + + "refresh_cadence" { + "frequency" = "SYNCHRONOUS" + } + } +} +`, rName, version) +} diff --git a/internal/service/bcmdataexports/generate.go b/internal/service/bcmdataexports/generate.go index ec65a3d07219..2df5358c2899 100644 --- a/internal/service/bcmdataexports/generate.go +++ b/internal/service/bcmdataexports/generate.go @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MPL-2.0 //go:generate go run ../../generate/servicepackage/main.go +//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -ListTags -ServiceTagsSlice -TagType=ResourceTag -UntagInTagsElem=ResourceTagKeys -UpdateTags -ListTagsOutTagsElem=ResourceTags -TagInTagsElem=ResourceTags // ONLY generate directives and package declaration! Do not add anything else to this file. package bcmdataexports diff --git a/internal/service/bcmdataexports/service_package_gen.go b/internal/service/bcmdataexports/service_package_gen.go index e9c669a96e9d..114e8fbc42f8 100644 --- a/internal/service/bcmdataexports/service_package_gen.go +++ b/internal/service/bcmdataexports/service_package_gen.go @@ -19,7 +19,12 @@ func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.Serv } func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.ServicePackageFrameworkResource { - return []*types.ServicePackageFrameworkResource{} + return []*types.ServicePackageFrameworkResource{ + { + Factory: newResourceExport, + Name: "Export", + }, + } } func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { diff --git a/internal/service/bcmdataexports/tags_gen.go b/internal/service/bcmdataexports/tags_gen.go new file mode 100644 index 000000000000..d56d440ea2e7 --- /dev/null +++ b/internal/service/bcmdataexports/tags_gen.go @@ -0,0 +1,146 @@ +// Code generated by internal/generate/tags/main.go; DO NOT EDIT. +package bcmdataexports + +import ( + "context" + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" + awstypes "github.com/aws/aws-sdk-go-v2/service/bcmdataexports/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/logging" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/internal/types/option" + "github.com/hashicorp/terraform-provider-aws/names" +) + +// listTags lists bcmdataexports service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func listTags(ctx context.Context, conn *bcmdataexports.Client, identifier string, optFns ...func(*bcmdataexports.Options)) (tftags.KeyValueTags, error) { + input := &bcmdataexports.ListTagsForResourceInput{ + ResourceArn: aws.String(identifier), + } + + output, err := conn.ListTagsForResource(ctx, input, optFns...) + + if err != nil { + return tftags.New(ctx, nil), err + } + + return KeyValueTags(ctx, output.ResourceTags), nil +} + +// ListTags lists bcmdataexports service tags and set them in Context. +// It is called from outside this package. +func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier string) error { + tags, err := listTags(ctx, meta.(*conns.AWSClient).BCMDataExportsClient(ctx), identifier) + + if err != nil { + return err + } + + if inContext, ok := tftags.FromContext(ctx); ok { + inContext.TagsOut = option.Some(tags) + } + + return nil +} + +// []*SERVICE.Tag handling + +// Tags returns bcmdataexports service tags. +func Tags(tags tftags.KeyValueTags) []awstypes.ResourceTag { + result := make([]awstypes.ResourceTag, 0, len(tags)) + + for k, v := range tags.Map() { + tag := awstypes.ResourceTag{ + Key: aws.String(k), + Value: aws.String(v), + } + + result = append(result, tag) + } + + return result +} + +// KeyValueTags creates tftags.KeyValueTags from bcmdataexports service tags. +func KeyValueTags(ctx context.Context, tags []awstypes.ResourceTag) tftags.KeyValueTags { + m := make(map[string]*string, len(tags)) + + for _, tag := range tags { + m[aws.ToString(tag.Key)] = tag.Value + } + + return tftags.New(ctx, m) +} + +// getTagsIn returns bcmdataexports service tags from Context. +// nil is returned if there are no input tags. +func getTagsIn(ctx context.Context) []awstypes.ResourceTag { + if inContext, ok := tftags.FromContext(ctx); ok { + if tags := Tags(inContext.TagsIn.UnwrapOrDefault()); len(tags) > 0 { + return tags + } + } + + return nil +} + +// setTagsOut sets bcmdataexports service tags in Context. +func setTagsOut(ctx context.Context, tags []awstypes.ResourceTag) { + if inContext, ok := tftags.FromContext(ctx); ok { + inContext.TagsOut = option.Some(KeyValueTags(ctx, tags)) + } +} + +// updateTags updates bcmdataexports service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func updateTags(ctx context.Context, conn *bcmdataexports.Client, identifier string, oldTagsMap, newTagsMap any, optFns ...func(*bcmdataexports.Options)) error { + oldTags := tftags.New(ctx, oldTagsMap) + newTags := tftags.New(ctx, newTagsMap) + + ctx = tflog.SetField(ctx, logging.KeyResourceId, identifier) + + removedTags := oldTags.Removed(newTags) + removedTags = removedTags.IgnoreSystem(names.BCMDataExports) + if len(removedTags) > 0 { + input := &bcmdataexports.UntagResourceInput{ + ResourceArn: aws.String(identifier), + ResourceTagKeys: removedTags.Keys(), + } + + _, err := conn.UntagResource(ctx, input, optFns...) + + if err != nil { + return fmt.Errorf("untagging resource (%s): %w", identifier, err) + } + } + + updatedTags := oldTags.Updated(newTags) + updatedTags = updatedTags.IgnoreSystem(names.BCMDataExports) + if len(updatedTags) > 0 { + input := &bcmdataexports.TagResourceInput{ + ResourceArn: aws.String(identifier), + ResourceTags: Tags(updatedTags), + } + + _, err := conn.TagResource(ctx, input, optFns...) + + if err != nil { + return fmt.Errorf("tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// UpdateTags updates bcmdataexports service tags. +// It is called from outside this package. +func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { + return updateTags(ctx, meta.(*conns.AWSClient).BCMDataExportsClient(ctx), identifier, oldTags, newTags) +} diff --git a/website/docs/r/bcmdataexports_export.html.markdown b/website/docs/r/bcmdataexports_export.html.markdown new file mode 100644 index 000000000000..14dc8211cada --- /dev/null +++ b/website/docs/r/bcmdataexports_export.html.markdown @@ -0,0 +1,85 @@ +--- +subcategory: "BCM Data Exports" +layout: "aws" +page_title: "AWS: aws_bcmdataexports_export" +description: |- + Terraform resource for managing an AWS BCM Data Exports Export. +--- + +# Resource: aws_bcmdataexports_export + +Terraform resource for managing an AWS BCM Data Exports Export. + +## Example Usage + +### Basic Usage + +```terraform +resource "aws_bcmdataexports_export" "example" { +} +``` + +## Argument Reference + +The following arguments are required: + +* `export` - (Required) The details of the export, including data query, name, description, and destination configuration. See the [`export` argument reference](#export-argument-reference) below. + +### `export` Argument Reference +* `data_query` - (Required) Data query for this specific data export. See the [`data_query` argument reference](#data_query-argument-reference) below. +* `destination_configurations` - (Required) Destination configuration for this specific data export. See the [`destination_configurations` argument reference](#destination_configurations-argument-reference) below. +* `name` - (Required) Name of this specific data export. +* `refresh_cadence` - (Required) Cadence for Amazon Web Services to update the export in your S3 bucket. See the [`refresh_cadence` argument reference](#refresh_cadence-argument-reference) below. +* `description` - (Optional) Description for this specific data export. + +### `data_query` Argument Reference +* `query_statement` - (Required) Query statement. +* `table_configurations` - (Optional) Table configuration. + +### `destination_configurations` Argument Reference +* `s3_destination` - (Required) Object that describes the destination of the data exports file. See the [`s3_destination` argument reference](#s3_destination-argument-reference) below. + +### `s3_destination` Argument Reference +* `s3_bucket` - (Required) Name of the Amazon S3 bucket used as the destination of a data export file. +* `s3_output_configurations` - (Required) Output configuration for the data export. See the [`s3_output_configurations` argument reference](#s3_output_configurations-argument-reference) below. +* `s3_prefix` - (Required) S3 path prefix you want prepended to the name of your data export. +* `s3_region` - (Required) S3 bucket region. + +### `s3_output_configurations` Argument Reference +* `compression` - (Required) Compression type for the data export. Valid values `GZIP`, `PARQUET`. +* `format` - (Required) File format for the data export. Valid values `TEXT_OR_CSV` or `PARQUET`. +* `output_type` - (Required) Output type for the data export. Valid value `CUSTOM`. +* `overwrite` - (Required) The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time. Valid values `CREATE_NEW_REPORT` or `OVERWRITE_REPORT`. + +### `refresh_cadence` Argument Reference +* `frequency` - (Required) Frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily. Valid values `SYNCHRONOUS`. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `export_arn` - Amazon Resource Name (ARN) for this export. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `60m`) +* `update` - (Default `180m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import BCM Data Exports Export using the `example_id_arg`. For example: + +```terraform +import { + to = aws_bcmdataexports_export.example + id = "export-id-12345678" +} +``` + +Using `terraform import`, import BCM Data Exports Export using the `example_id_arg`. For example: + +```console +% terraform import aws_bcmdataexports_export.example export-id-12345678 +``` From 3f11b9500a40c356d44c67123c5a1de5079bac78 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Thu, 11 Apr 2024 11:35:11 -0700 Subject: [PATCH 012/137] Add exports test --- internal/service/bcmdataexports/export.go | 8 +- .../service/bcmdataexports/export_test.go | 76 +++++-------------- .../service/bcmdataexports/exports_test.go | 10 +++ .../bcmdataexports/service_package_gen.go | 3 + 4 files changed, 36 insertions(+), 61 deletions(-) create mode 100644 internal/service/bcmdataexports/exports_test.go diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 8c98bc302336..df00ede3c9b4 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -233,7 +233,7 @@ func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, res return } - // export,_ := state.Export.ToPtr(ctx) + // export, _ := state.Export.ToPtr(ctx) out, err := findExportByID(ctx, conn, state.ID.ValueString()) if tfresource.NotFound(err) { @@ -248,7 +248,7 @@ func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, res return } - state.ID = flex.StringToFramework(ctx, out.ExportArn) + state.ID = flex.StringToFramework(ctx, out.Export.ExportArn) resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) @@ -417,7 +417,7 @@ func statusExport(ctx context.Context, conn *bcmdataexports.Client, id string) r } } -func findExportByID(ctx context.Context, conn *bcmdataexports.Client, exportArn string) (*awstypes.Export, error) { +func findExportByID(ctx context.Context, conn *bcmdataexports.Client, exportArn string) (*bcmdataexports.GetExportOutput, error) { in := &bcmdataexports.GetExportInput{ ExportArn: aws.String(exportArn), } @@ -438,7 +438,7 @@ func findExportByID(ctx context.Context, conn *bcmdataexports.Client, exportArn return nil, tfresource.NewEmptyResultError(in) } - return out.Export, nil + return out, nil } type resourceExportData struct { diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 512ad51ebc71..271a0cdbb238 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -9,8 +9,6 @@ import ( "fmt" "testing" - "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" "github.com/aws/aws-sdk-go-v2/service/bcmdataexports/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" @@ -20,27 +18,24 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/create" "github.com/hashicorp/terraform-provider-aws/internal/errs" - "github.com/hashicorp/terraform-provider-aws/names" - tfbcmdataexports "github.com/hashicorp/terraform-provider-aws/internal/service/bcmdataexports" + "github.com/hashicorp/terraform-provider-aws/names" ) func TestAccBCMDataExportsExport_basic(t *testing.T) { ctx := acctest.Context(t) - // TIP: This is a long-running test guard for tests that run longer than - // 300s (5 min) generally. if testing.Short() { t.Skip("skipping long-running test in short mode") } - var export bcmdataexports.DescribeExportResponse + var export bcmdataexports.GetExportOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_bcmdataexports_export.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) + acctest.PreCheckPartitionHasService(t, names.BCMDataExportsServiceID) testAccPreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), @@ -51,22 +46,13 @@ func TestAccBCMDataExportsExport_basic(t *testing.T) { Config: testAccExportConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), - resource.TestCheckResourceAttr(resourceName, "auto_minor_version_upgrade", "false"), - resource.TestCheckResourceAttrSet(resourceName, "maintenance_window_start_time.0.day_of_week"), - resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", - }), - acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "bcmdataexports", regexache.MustCompile(`export:+.`)), + resource.TestCheckResourceAttrSet(resourceName, "export"), ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, }, }, }) @@ -78,30 +64,23 @@ func TestAccBCMDataExportsExport_disappears(t *testing.T) { t.Skip("skipping long-running test in short mode") } - var export bcmdataexports.DescribeExportResponse + var export bcmdataexports.GetExportOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_bcmdataexports_export.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) - testAccPreCheck(t) + acctest.PreCheckPartitionHasService(t, names.BCMDataExportsServiceID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckExportDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccExportConfig_basic(rName, testAccExportVersionNewer), + Config: testAccExportConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), - // TIP: The Plugin-Framework disappears helper is similar to the Plugin-SDK version, - // but expects a new resource factory function as the third argument. To expose this - // private function to the testing package, you may need to add a line like the following - // to exports_test.go: - // - // var ResourceExport = newResourceExport acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfbcmdataexports.ResourceExport, resourceName), ), ExpectNonEmptyPlan: true, @@ -119,17 +98,12 @@ func testAccCheckExportDestroy(ctx context.Context) resource.TestCheckFunc { continue } - input := &bcmdataexports.DescribeExportInput{ - ExportId: aws.String(rs.Primary.ID), - } - _, err := conn.DescribeExport(ctx, &bcmdataexports.DescribeExportInput{ - ExportId: aws.String(rs.Primary.ID), - }) + _, err := tfbcmdataexports.FindExportByID(ctx, conn, rs.Primary.ID) if errs.IsA[*types.ResourceNotFoundException](err) { return nil } if err != nil { - return create.Error(names.BCMDataExports, create.ErrActionCheckingDestroyed, tfbcmdataexports.ResNameExport, rs.Primary.ID, err) + return err } return create.Error(names.BCMDataExports, create.ErrActionCheckingDestroyed, tfbcmdataexports.ResNameExport, rs.Primary.ID, errors.New("not destroyed")) @@ -139,7 +113,7 @@ func testAccCheckExportDestroy(ctx context.Context) resource.TestCheckFunc { } } -func testAccCheckExportExists(ctx context.Context, name string, export *bcmdataexports.DescribeExportResponse) resource.TestCheckFunc { +func testAccCheckExportExists(ctx context.Context, name string, export *bcmdataexports.GetExportOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -151,9 +125,7 @@ func testAccCheckExportExists(ctx context.Context, name string, export *bcmdatae } conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) - resp, err := conn.DescribeExport(ctx, &bcmdataexports.DescribeExportInput{ - ExportId: aws.String(rs.Primary.ID), - }) + resp, err := tfbcmdataexports.FindExportByID(ctx, conn, rs.Primary.ID) if err != nil { return create.Error(names.BCMDataExports, create.ErrActionCheckingExistence, tfbcmdataexports.ResNameExport, rs.Primary.ID, err) @@ -168,8 +140,8 @@ func testAccCheckExportExists(ctx context.Context, name string, export *bcmdatae func testAccPreCheck(ctx context.Context, t *testing.T) { conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) - input := &bcmdataexports.ListExportsInput{} - _, err := conn.ListExports(ctx, input) + input := &bcmdataexports.GetExportInput{} + _, err := conn.GetExport(ctx, input) if acctest.PreCheckSkipError(err) { t.Skipf("skipping acceptance testing: %s", err) @@ -179,17 +151,7 @@ func testAccPreCheck(ctx context.Context, t *testing.T) { } } -func testAccCheckExportNotRecreated(before, after *bcmdataexports.DescribeExportResponse) resource.TestCheckFunc { - return func(s *terraform.State) error { - if before, after := aws.ToString(before.ExportId), aws.ToString(after.ExportId); before != after { - return create.Error(names.BCMDataExports, create.ErrActionCheckingNotRecreated, tfbcmdataexports.ResNameExport, aws.ToString(before.ExportId), errors.New("recreated")) - } - - return nil - } -} - -func testAccExportConfig_basic(rName, version string) string { +func testAccExportConfig_basic(rName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { @@ -198,7 +160,7 @@ resource "aws_s3_bucket" "test" { resource "aws_bcmdataexports_export" "test" { export { - name = "exampleexportname" + name = %[1]q data_query { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations { @@ -227,5 +189,5 @@ resource "aws_bcmdataexports_export" "test" { } } } -`, rName, version) +`, rName) } diff --git a/internal/service/bcmdataexports/exports_test.go b/internal/service/bcmdataexports/exports_test.go new file mode 100644 index 000000000000..0e94a2a17c35 --- /dev/null +++ b/internal/service/bcmdataexports/exports_test.go @@ -0,0 +1,10 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package bcmdataexports + +// Exports for use in tests only. +var ( + ResourceExport = newResourceExport + FindExportByID = findExportByID +) diff --git a/internal/service/bcmdataexports/service_package_gen.go b/internal/service/bcmdataexports/service_package_gen.go index 114e8fbc42f8..5de283d0f37c 100644 --- a/internal/service/bcmdataexports/service_package_gen.go +++ b/internal/service/bcmdataexports/service_package_gen.go @@ -23,6 +23,9 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic { Factory: newResourceExport, Name: "Export", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: "id", + }, }, } } From b4a8aae7b3ef0fb65d624a569391417d31c1f88a Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Tue, 16 Apr 2024 15:49:53 -0700 Subject: [PATCH 013/137] Fix formatting docs; fix test; add endpoint --- internal/framework/flex/auto_flatten.go | 48 +++++++++++ internal/service/bcmdataexports/export.go | 51 ++++++++---- .../service/bcmdataexports/export_test.go | 79 +++++++++++-------- names/names.go | 1 + .../r/bcmdataexports_export.html.markdown | 6 ++ 5 files changed, 136 insertions(+), 49 deletions(-) diff --git a/internal/framework/flex/auto_flatten.go b/internal/framework/flex/auto_flatten.go index 6f5f224f7eaa..2fbab26de263 100644 --- a/internal/framework/flex/auto_flatten.go +++ b/internal/framework/flex/auto_flatten.go @@ -578,6 +578,54 @@ func (flattener autoFlattener) map_(ctx context.Context, vFrom reflect.Value, tT return diags } + case reflect.Map: + switch tTo := tTo.(type) { + case basetypes.MapTypable: + // + // map[string]map[string]string -> types.Map(OfMap[types.String]). + // + if vFrom.IsNil() { + to, d := tTo.ValueFromMap(ctx, types.MapNull(types.MapType{ElemType: types.StringType})) + diags.Append(d...) + if diags.HasError() { + return diags + } + + vTo.Set(reflect.ValueOf(to)) + return diags + } + + from := vFrom.Interface().(map[string]map[string]string) + elements := make(map[string]attr.Value, len(from)) + for k, v := range from { + innerElements := make(map[string]attr.Value, len(v)) + for ik, iv := range v { + innerElements[ik] = types.StringValue(iv) + } + innerMap, d := fwtypes.NewMapValueOf[types.String](ctx, innerElements) + diags.Append(d...) + if diags.HasError() { + return diags + } + + elements[k] = innerMap + } + map_, d := fwtypes.NewMapValueOf[fwtypes.MapValueOf[types.String]](ctx, elements) + diags.Append(d...) + if diags.HasError() { + return diags + } + + to, d := tTo.ValueFromMap(ctx, map_.MapValue) + diags.Append(d...) + if diags.HasError() { + return diags + } + + vTo.Set(reflect.ValueOf(to)) + return diags + } + case reflect.Ptr: switch tMapElem.Elem().Kind() { case reflect.Struct: diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index df00ede3c9b4..28ef9a6e03ae 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -6,6 +6,7 @@ package bcmdataexports import ( "context" "errors" + "log" "time" "github.com/aws/aws-sdk-go-v2/aws" @@ -16,6 +17,8 @@ import ( "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" @@ -36,7 +39,6 @@ func newResourceExport(_ context.Context) (resource.ResourceWithConfigure, error r.SetDefaultCreateTimeout(30 * time.Minute) r.SetDefaultUpdateTimeout(30 * time.Minute) - r.SetDefaultDeleteTimeout(30 * time.Minute) return r, nil } @@ -71,8 +73,8 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, }, } - s3OutputFormatConfigurationLNB := schema.ListNestedBlock{ - CustomType: fwtypes.NewListNestedObjectTypeOf[s3OutputFormatConfiguration](ctx), + s3OutputConfigurationsLNB := schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[s3OutputConfigurations](ctx), NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ "compression": schema.StringAttribute{ @@ -110,7 +112,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, }, }, Blocks: map[string]schema.Block{ - "s3_output_format_configuration": s3OutputFormatConfigurationLNB, + "s3_output_configurations": s3OutputConfigurationsLNB, }, }, } @@ -144,6 +146,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, }, Blocks: map[string]schema.Block{ "export": schema.ListNestedBlock{ + CustomType: fwtypes.NewListNestedObjectTypeOf[ExportData](ctx), Validators: []validator.List{ listvalidator.SizeAtMost(1), }, @@ -157,10 +160,13 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, }, "export_arn": schema.StringAttribute{ Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, }, Blocks: map[string]schema.Block{ - "dataQueryLNB": dataQueryLNB, + "data_query": dataQueryLNB, "destination_configurations": destinationConfigurationsLNB, "refresh_cadence": refreshCadenceLNB, }, @@ -210,6 +216,13 @@ func (r *resourceExport) Create(ctx context.Context, req resource.CreateRequest, plan.ID = flex.StringToFramework(ctx, out.ExportArn) + export, _ := plan.Export.ToPtr(ctx) + export.ExportArn = flex.StringToFramework(ctx, out.ExportArn) + + plan.Export = fwtypes.NewListNestedObjectValueOfPtrMust(ctx, export) + + log.Printf("[WARN] export arn: %s", export.ExportArn) + createTimeout := r.CreateTimeout(ctx, plan.Timeouts) _, err = waitExportCreated(ctx, conn, plan.ID.ValueString(), createTimeout) if err != nil { @@ -220,7 +233,7 @@ func (r *resourceExport) Create(ctx context.Context, req resource.CreateRequest, return } - resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) + // resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) } @@ -233,8 +246,6 @@ func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, res return } - // export, _ := state.Export.ToPtr(ctx) - out, err := findExportByID(ctx, conn, state.ID.ValueString()) if tfresource.NotFound(err) { resp.State.RemoveResource(ctx) @@ -248,6 +259,18 @@ func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, res return } + // exp := ExportData{} + // exp.Description = flex.StringToFramework(ctx, out.Export.Description) + + // dq := fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &DataQueryData{ + // QueryStatement: flex.StringToFramework(ctx, out.Export.DataQuery.QueryStatement), + // }) + // resp.Diagnostics.Append(flex.Flatten(ctx, out.Export, &exp)...) + // if resp.Diagnostics.HasError() { + // return + // } + + // state.Export = fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &exp) state.ID = flex.StringToFramework(ctx, out.Export.ExportArn) resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) @@ -463,7 +486,7 @@ type DataQueryData struct { TableConfigurations fwtypes.MapValueOf[fwtypes.MapValueOf[types.String]] `tfsdk:"table_configurations"` } -type s3OutputFormatConfiguration struct { +type s3OutputConfigurations struct { Compression fwtypes.StringEnum[awstypes.CompressionOption] `tfsdk:"compression"` Format fwtypes.StringEnum[awstypes.FormatOption] `tfsdk:"format"` OutputType fwtypes.StringEnum[awstypes.S3OutputType] `tfsdk:"output_type"` @@ -471,14 +494,14 @@ type s3OutputFormatConfiguration struct { } type s3Destination struct { - S3Bucket types.String `tfsdk:"s3_bucket"` - S3Prefix types.String `tfsdk:"s3_prefix"` - S3Region types.String `tfsdk:"s3_region"` - S3OutputFormatConfiguration fwtypes.ListNestedObjectValueOf[s3OutputFormatConfiguration] `tfsdk:"s3_output_format_configuration"` + S3Bucket types.String `tfsdk:"s3_bucket"` + S3Prefix types.String `tfsdk:"s3_prefix"` + S3Region types.String `tfsdk:"s3_region"` + S3OutputConfigurations fwtypes.ListNestedObjectValueOf[s3OutputConfigurations] `tfsdk:"s3_output_configurations"` } type DestinationConfigurationsData struct { - s3Destination fwtypes.ListNestedObjectValueOf[s3Destination] `tfsdk:"s3_destination"` + S3Destination fwtypes.ListNestedObjectValueOf[s3Destination] `tfsdk:"s3_destination"` } type RefreshCadenceData struct { diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 271a0cdbb238..704a40d97eba 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -35,8 +35,6 @@ func TestAccBCMDataExportsExport_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.BCMDataExportsServiceID) - testAccPreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -46,7 +44,7 @@ func TestAccBCMDataExportsExport_basic(t *testing.T) { Config: testAccExportConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), - resource.TestCheckResourceAttrSet(resourceName, "export"), + resource.TestCheckResourceAttr(resourceName, "export.#", "1"), ), }, { @@ -71,7 +69,7 @@ func TestAccBCMDataExportsExport_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.BCMDataExportsServiceID) + acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -137,25 +135,36 @@ func testAccCheckExportExists(ctx context.Context, name string, export *bcmdatae } } -func testAccPreCheck(ctx context.Context, t *testing.T) { - conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) - - input := &bcmdataexports.GetExportInput{} - _, err := conn.GetExport(ctx, input) - - if acctest.PreCheckSkipError(err) { - t.Skipf("skipping acceptance testing: %s", err) - } - if err != nil { - t.Fatalf("unexpected PreCheck error: %s", err) - } -} - func testAccExportConfig_basic(rName string) string { return fmt.Sprintf(` +resource "aws_s3_bucket_policy" "bucket" { + bucket = aws_s3_bucket.test.bucket + policy = jsonencode({ + Id = %[1]q + Statement = [{ + Action = [ + "s3:PutObject", + "s3:GetBucketPolicy" + ] + Effect = "Allow" + Sid = "EnableAWSDataExportsToWriteToS3AndCheckPolicy" + Principal = { + Service = [ + "billingreports.amazonaws.com", + "bcm-data-exports.amazonaws.com" + ] + } + Resource = [ + aws_s3_bucket.test.arn, + "${aws_s3_bucket.test.arn}/*", + ] + Version = "2012-10-17" + }) +} resource "aws_s3_bucket" "test" { - bucket = "testing-bucket" + bucket = %[1]q + force_destroy = true } resource "aws_bcmdataexports_export" "test" { @@ -163,29 +172,29 @@ resource "aws_bcmdataexports_export" "test" { name = %[1]q data_query { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" - table_configurations { - "COST_AND_USAGE_REPORT" { - "TIME_GRANULARITY" = "DAILY" + table_configurations = { + COST_AND_USAGE_REPORT = { + TIME_GRANULARITY = "DAILY" } } } - "destination_configurations" { - "s3_destination" { - "s3_bucket" = aws_s3_bucket.test.bucket - "s3_prefix" = aws_s3_bucket.test.bucket_prefix - "s3_region" = aws_s3_bucket.test.region - "s3_output_configurations" { - "overwrite" = "OVERWRITE_REPORT" - "format" = "TEXT_OR_CSV" - "compression" = "GZIP" - "output_type" = "CUSTOM" + destination_configurations { + s3_destination { + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" } - } + } } - "refresh_cadence" { - "frequency" = "SYNCHRONOUS" + refresh_cadence { + frequency = "SYNCHRONOUS" } } } diff --git a/names/names.go b/names/names.go index 4565d3ec8477..562cf2f5ed7c 100644 --- a/names/names.go +++ b/names/names.go @@ -37,6 +37,7 @@ const ( AutoScalingPlansEndpointID = "autoscaling-plans" BatchEndpointID = "batch" BedrockEndpointID = "bedrock" + BCMDataExportsEndpointID = "bcm-data-exports" BudgetsEndpointID = "budgets" ChimeSDKMediaPipelinesEndpointID = "media-pipelines-chime" ChimeSDKVoiceEndpointID = "voice-chime" diff --git a/website/docs/r/bcmdataexports_export.html.markdown b/website/docs/r/bcmdataexports_export.html.markdown index 14dc8211cada..1237be0db40e 100644 --- a/website/docs/r/bcmdataexports_export.html.markdown +++ b/website/docs/r/bcmdataexports_export.html.markdown @@ -26,6 +26,7 @@ The following arguments are required: * `export` - (Required) The details of the export, including data query, name, description, and destination configuration. See the [`export` argument reference](#export-argument-reference) below. ### `export` Argument Reference + * `data_query` - (Required) Data query for this specific data export. See the [`data_query` argument reference](#data_query-argument-reference) below. * `destination_configurations` - (Required) Destination configuration for this specific data export. See the [`destination_configurations` argument reference](#destination_configurations-argument-reference) below. * `name` - (Required) Name of this specific data export. @@ -33,25 +34,30 @@ The following arguments are required: * `description` - (Optional) Description for this specific data export. ### `data_query` Argument Reference + * `query_statement` - (Required) Query statement. * `table_configurations` - (Optional) Table configuration. ### `destination_configurations` Argument Reference + * `s3_destination` - (Required) Object that describes the destination of the data exports file. See the [`s3_destination` argument reference](#s3_destination-argument-reference) below. ### `s3_destination` Argument Reference + * `s3_bucket` - (Required) Name of the Amazon S3 bucket used as the destination of a data export file. * `s3_output_configurations` - (Required) Output configuration for the data export. See the [`s3_output_configurations` argument reference](#s3_output_configurations-argument-reference) below. * `s3_prefix` - (Required) S3 path prefix you want prepended to the name of your data export. * `s3_region` - (Required) S3 bucket region. ### `s3_output_configurations` Argument Reference + * `compression` - (Required) Compression type for the data export. Valid values `GZIP`, `PARQUET`. * `format` - (Required) File format for the data export. Valid values `TEXT_OR_CSV` or `PARQUET`. * `output_type` - (Required) Output type for the data export. Valid value `CUSTOM`. * `overwrite` - (Required) The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time. Valid values `CREATE_NEW_REPORT` or `OVERWRITE_REPORT`. ### `refresh_cadence` Argument Reference + * `frequency` - (Required) Frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily. Valid values `SYNCHRONOUS`. ## Attribute Reference From 4c658c6b3591550d03ba742a4658edd5e16b5447 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Tue, 16 Apr 2024 16:52:03 -0700 Subject: [PATCH 014/137] Add sweeper; fix tests --- internal/service/bcmdataexports/export.go | 46 ++---------- .../service/bcmdataexports/export_test.go | 18 +++-- internal/service/bcmdataexports/sweep.go | 75 +++++++++++++++++++ 3 files changed, 90 insertions(+), 49 deletions(-) create mode 100644 internal/service/bcmdataexports/sweep.go diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 28ef9a6e03ae..9efd3c2b9aa6 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -233,7 +233,6 @@ func (r *resourceExport) Create(ctx context.Context, req resource.CreateRequest, return } - // resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) resp.Diagnostics.Append(resp.State.Set(ctx, plan)...) } @@ -259,18 +258,6 @@ func (r *resourceExport) Read(ctx context.Context, req resource.ReadRequest, res return } - // exp := ExportData{} - // exp.Description = flex.StringToFramework(ctx, out.Export.Description) - - // dq := fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &DataQueryData{ - // QueryStatement: flex.StringToFramework(ctx, out.Export.DataQuery.QueryStatement), - // }) - // resp.Diagnostics.Append(flex.Flatten(ctx, out.Export, &exp)...) - // if resp.Diagnostics.HasError() { - // return - // } - - // state.Export = fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &exp) state.ID = flex.StringToFramework(ctx, out.Export.ExportArn) resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...) @@ -343,25 +330,18 @@ func (r *resourceExport) Delete(ctx context.Context, req resource.DeleteRequest, } _, err := conn.DeleteExport(ctx, in) + + if errs.IsA[*awstypes.ResourceNotFoundException](err) { + return + } + if err != nil { - if errs.IsA[*retry.NotFoundError](err) { - return - } resp.Diagnostics.AddError( create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionDeleting, ResNameExport, state.ID.String(), err), err.Error(), ) return } - // deleteTimeout := r.DeleteTimeout(ctx, state.Timeouts) - // _, err = waitExportDeleted(ctx, conn, state.ID.ValueString(), deleteTimeout) - // if err != nil { - // resp.Diagnostics.AddError( - // create.ProblemStandardMessage(names.BCMDataExports, create.ErrActionWaitingForDeletion, ResNameExport, state.ID.String(), err), - // err.Error(), - // ) - // return - // } } func (r *resourceExport) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { @@ -409,22 +389,6 @@ func waitExportUpdated(ctx context.Context, conn *bcmdataexports.Client, id stri return nil, err } -// func waitExportDeleted(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*awstypes.Export, error) { -// stateConf := &retry.StateChangeConf{ -// Pending: []string{statusDeleting, statusHealthy}, -// Target: []string{}, -// Refresh: statusExport(ctx, conn, id), -// Timeout: timeout, -// } - -// outputRaw, err := stateConf.WaitForStateContext(ctx) -// if out, ok := outputRaw.(*bcmdataexports.Export); ok { -// return out, err -// } - -// return nil, err -// } - func statusExport(ctx context.Context, conn *bcmdataexports.Client, id string) retry.StateRefreshFunc { return func() (interface{}, string, error) { out, err := findExportByID(ctx, conn, id) diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 704a40d97eba..19bf94134e7f 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -69,7 +69,6 @@ func TestAccBCMDataExportsExport_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) - acctest.PreCheckPartitionHasService(t, names.BCMDataExportsEndpointID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -153,11 +152,12 @@ resource "aws_s3_bucket_policy" "bucket" { "billingreports.amazonaws.com", "bcm-data-exports.amazonaws.com" ] - } - Resource = [ - aws_s3_bucket.test.arn, - "${aws_s3_bucket.test.arn}/*", - ] + } + Resource = [ + aws_s3_bucket.test.arn, + "${aws_s3_bucket.test.arn}/*", + ] + }] Version = "2012-10-17" }) } @@ -174,11 +174,13 @@ resource "aws_bcmdataexports_export" "test" { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations = { COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = "DAILY" + TIME_GRANULARITY = "HOURLY", + INCLUDE_RESOURCES = "FALSE", + INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", } } } - destination_configurations { s3_destination { s3_bucket = aws_s3_bucket.test.bucket diff --git a/internal/service/bcmdataexports/sweep.go b/internal/service/bcmdataexports/sweep.go new file mode 100644 index 000000000000..953b57270a13 --- /dev/null +++ b/internal/service/bcmdataexports/sweep.go @@ -0,0 +1,75 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package bcmdataexports + +import ( + "errors" + "fmt" + "log" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/auditmanager/types" + "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-aws/internal/sweep" + "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" + "github.com/hashicorp/terraform-provider-aws/internal/sweep/framework" +) + +func RegisterSweepers() { + resource.AddTestSweepers("aws_bcmdataexports", &resource.Sweeper{ + Name: "aws_bcmdataexports_export", + F: sweepExports, + }) +} + +// isCompleteSetupError checks whether the returned error message indicates +// AuditManager isn't yet enabled in the current region. +// +// For example: +// AccessDeniedException: Please complete AWS Audit Manager setup from home page to enable this action in this account. +func isCompleteSetupError(err error) bool { + var ade *types.AccessDeniedException + return errors.As(err, &ade) +} + +func sweepExports(region string) error { + ctx := sweep.Context(region) + client, err := sweep.SharedRegionalSweepClient(ctx, region) + if err != nil { + return fmt.Errorf("error getting client: %s", err) + } + + conn := client.BCMDataExportsClient(ctx) + sweepResources := make([]sweep.Sweepable, 0) + in := &bcmdataexports.ListExportsInput{} + + pages := bcmdataexports.NewListExportsPaginator(conn, in) + + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + if awsv2.SkipSweepError(err) || isCompleteSetupError(err) { + log.Printf("[WARN] Skipping BCM Data Exports export sweep for %s: %s", region, err) + return nil + } + if err != nil { + return fmt.Errorf("error retrieving BCM Data Exports Export: %w", err) + } + + for _, b := range page.Exports { + id := aws.ToString(b.ExportArn) + + log.Printf("[INFO] Deleting AuditManager Assessment: %s", id) + sweepResources = append(sweepResources, framework.NewSweepResource(newResourceExport, client, + framework.NewAttribute("id", id), + )) + } + } + + if err := sweep.SweepOrchestrator(ctx, sweepResources); err != nil { + return fmt.Errorf("error sweeping AuditManager Assessments for %s: %w", region, err) + } + + return nil +} From e9f3584bd9584d7f6c56a99baa671001c51f85f5 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Tue, 16 Apr 2024 16:58:18 -0700 Subject: [PATCH 015/137] Fix config format --- .../service/bcmdataexports/export_test.go | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 19bf94134e7f..85c1802441bb 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -142,16 +142,16 @@ resource "aws_s3_bucket_policy" "bucket" { Id = %[1]q Statement = [{ Action = [ - "s3:PutObject", - "s3:GetBucketPolicy" + "s3:PutObject", + "s3:GetBucketPolicy" ] Effect = "Allow" - Sid = "EnableAWSDataExportsToWriteToS3AndCheckPolicy" + Sid = "EnableAWSDataExportsToWriteToS3AndCheckPolicy" Principal = { - Service = [ - "billingreports.amazonaws.com", - "bcm-data-exports.amazonaws.com" - ] + Service = [ + "billingreports.amazonaws.com", + "bcm-data-exports.amazonaws.com" + ] } Resource = [ aws_s3_bucket.test.arn, @@ -163,7 +163,7 @@ resource "aws_s3_bucket_policy" "bucket" { } resource "aws_s3_bucket" "test" { - bucket = %[1]q + bucket = %[1]q force_destroy = true } @@ -174,24 +174,24 @@ resource "aws_bcmdataexports_export" "test" { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations = { COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = "HOURLY", - INCLUDE_RESOURCES = "FALSE", + TIME_GRANULARITY = "HOURLY", + INCLUDE_RESOURCES = "FALSE", INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", - INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", } } } destination_configurations { s3_destination { - s3_bucket = aws_s3_bucket.test.bucket - s3_prefix = aws_s3_bucket.test.bucket_prefix - s3_region = aws_s3_bucket.test.region - s3_output_configurations { - overwrite = "OVERWRITE_REPORT" - format = "TEXT_OR_CSV" - compression = "GZIP" - output_type = "CUSTOM" - } + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" + } } } From 36e4953b2bdf233a05133808e07c5202c584f798 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Wed, 17 Apr 2024 11:22:59 -0700 Subject: [PATCH 016/137] Add basic usage; run make gen --- internal/sweep/register_gen_test.go | 2 ++ .../r/bcmdataexports_export.html.markdown | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/internal/sweep/register_gen_test.go b/internal/sweep/register_gen_test.go index d6861528327c..89eb9e3718f3 100644 --- a/internal/sweep/register_gen_test.go +++ b/internal/sweep/register_gen_test.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/service/autoscalingplans" "github.com/hashicorp/terraform-provider-aws/internal/service/backup" "github.com/hashicorp/terraform-provider-aws/internal/service/batch" + "github.com/hashicorp/terraform-provider-aws/internal/service/bcmdataexports" "github.com/hashicorp/terraform-provider-aws/internal/service/budgets" "github.com/hashicorp/terraform-provider-aws/internal/service/cloud9" "github.com/hashicorp/terraform-provider-aws/internal/service/cloudformation" @@ -173,6 +174,7 @@ func registerSweepers() { autoscalingplans.RegisterSweepers() backup.RegisterSweepers() batch.RegisterSweepers() + bcmdataexports.RegisterSweepers() budgets.RegisterSweepers() cloud9.RegisterSweepers() cloudformation.RegisterSweepers() diff --git a/website/docs/r/bcmdataexports_export.html.markdown b/website/docs/r/bcmdataexports_export.html.markdown index 1237be0db40e..ab647b9d9076 100644 --- a/website/docs/r/bcmdataexports_export.html.markdown +++ b/website/docs/r/bcmdataexports_export.html.markdown @@ -15,7 +15,38 @@ Terraform resource for managing an AWS BCM Data Exports Export. ### Basic Usage ```terraform -resource "aws_bcmdataexports_export" "example" { +resource "aws_bcmdataexports_export" "test" { + export { + name = "testexample" + data_query { + query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" + table_configurations = { + COST_AND_USAGE_REPORT = { + TIME_GRANULARITY = "HOURLY", + INCLUDE_RESOURCES = "FALSE", + INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + } + } + } + destination_configurations { + s3_destination { + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" + } + } + } + + refresh_cadence { + frequency = "SYNCHRONOUS" + } + } } ``` From 021aab186e0ff174423ce40db77df7c54aeb5783 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Thu, 18 Apr 2024 15:58:10 -0700 Subject: [PATCH 017/137] Review changes --- internal/service/bcmdataexports/export.go | 51 ++-- .../service/bcmdataexports/export_test.go | 237 +++++++++++++++++- internal/service/bcmdataexports/sweep.go | 14 +- 3 files changed, 267 insertions(+), 35 deletions(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 9efd3c2b9aa6..e12f8362bda6 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -17,6 +17,7 @@ import ( "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/mapplanmodifier" "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" @@ -58,7 +59,7 @@ func (r *resourceExport) Metadata(_ context.Context, req resource.MetadataReques func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { dataQueryLNB := schema.ListNestedBlock{ - CustomType: fwtypes.NewListNestedObjectTypeOf[DataQueryData](ctx), + CustomType: fwtypes.NewListNestedObjectTypeOf[dataQueryData](ctx), NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ "query_statement": schema.StringAttribute{ @@ -68,6 +69,10 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, // map[string]map[string]string CustomType: fwtypes.NewMapTypeOf[fwtypes.MapValueOf[types.String]](ctx), Optional: true, + PlanModifiers: []planmodifier.Map{ + mapplanmodifier.RequiresReplace(), + mapplanmodifier.UseStateForUnknown(), + }, }, }, }, @@ -118,7 +123,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, } destinationConfigurationsLNB := schema.ListNestedBlock{ - CustomType: fwtypes.NewListNestedObjectTypeOf[DestinationConfigurationsData](ctx), + CustomType: fwtypes.NewListNestedObjectTypeOf[destinationConfigurationsData](ctx), NestedObject: schema.NestedBlockObject{ Blocks: map[string]schema.Block{ "s3_destination": s3DestinationLNB, @@ -127,7 +132,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, } refreshCadenceLNB := schema.ListNestedBlock{ - CustomType: fwtypes.NewListNestedObjectTypeOf[RefreshCadenceData](ctx), + CustomType: fwtypes.NewListNestedObjectTypeOf[refreshCadenceData](ctx), NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ "frequency": schema.StringAttribute{ @@ -146,7 +151,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, }, Blocks: map[string]schema.Block{ "export": schema.ListNestedBlock{ - CustomType: fwtypes.NewListNestedObjectTypeOf[ExportData](ctx), + CustomType: fwtypes.NewListNestedObjectTypeOf[exportData](ctx), Validators: []validator.List{ listvalidator.SizeAtMost(1), }, @@ -275,8 +280,10 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, } if !plan.Export.Equal(state.Export) { - in := &bcmdataexports.UpdateExportInput{} - resp.Diagnostics.Append(flex.Expand(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), plan, in)...) + in := &bcmdataexports.UpdateExportInput{ + ExportArn: aws.String(plan.ID.ValueString()), + } + resp.Diagnostics.Append(flex.Expand(ctx, plan, in)...) if resp.Diagnostics.HasError() { return } @@ -348,15 +355,19 @@ func (r *resourceExport) ImportState(ctx context.Context, req resource.ImportSta resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } +func (r *resourceExport) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + r.SetTagsAll(ctx, req, resp) +} + const ( - statusHealthy = "Healthy" - statusError = "Unhealthy" + statusHealthy = awstypes.ExportStatusCodeHealthy + statusUnhealthy = awstypes.ExportStatusCodeUnhealthy ) func waitExportCreated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { stateConf := &retry.StateChangeConf{ Pending: []string{}, - Target: []string{statusHealthy}, + Target: []string{string(statusHealthy)}, Refresh: statusExport(ctx, conn, id), Timeout: timeout, NotFoundChecks: 20, @@ -373,8 +384,8 @@ func waitExportCreated(ctx context.Context, conn *bcmdataexports.Client, id stri func waitExportUpdated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { stateConf := &retry.StateChangeConf{ - Pending: []string{statusError}, - Target: []string{statusHealthy}, + Pending: []string{string(statusUnhealthy)}, + Target: []string{string(statusHealthy)}, Refresh: statusExport(ctx, conn, id), Timeout: timeout, NotFoundChecks: 20, @@ -400,7 +411,7 @@ func statusExport(ctx context.Context, conn *bcmdataexports.Client, id string) r return nil, "", err } - return out, statusHealthy, nil + return out, string(statusHealthy), nil } } @@ -429,23 +440,23 @@ func findExportByID(ctx context.Context, conn *bcmdataexports.Client, exportArn } type resourceExportData struct { - Export fwtypes.ListNestedObjectValueOf[ExportData] `tfsdk:"export"` + Export fwtypes.ListNestedObjectValueOf[exportData] `tfsdk:"export"` ID types.String `tfsdk:"id"` Tags types.Map `tfsdk:"tags"` TagsAll types.Map `tfsdk:"tags_all"` Timeouts timeouts.Value `tfsdk:"timeouts"` } -type ExportData struct { +type exportData struct { Description types.String `tfsdk:"description"` Name types.String `tfsdk:"name"` ExportArn types.String `tfsdk:"export_arn"` - DataQuery fwtypes.ListNestedObjectValueOf[DataQueryData] `tfsdk:"data_query"` - DestinationConfigurations fwtypes.ListNestedObjectValueOf[DestinationConfigurationsData] `tfsdk:"destination_configurations"` - RefreshCadence fwtypes.ListNestedObjectValueOf[RefreshCadenceData] `tfsdk:"refresh_cadence"` + DataQuery fwtypes.ListNestedObjectValueOf[dataQueryData] `tfsdk:"data_query"` + DestinationConfigurations fwtypes.ListNestedObjectValueOf[destinationConfigurationsData] `tfsdk:"destination_configurations"` + RefreshCadence fwtypes.ListNestedObjectValueOf[refreshCadenceData] `tfsdk:"refresh_cadence"` } -type DataQueryData struct { +type dataQueryData struct { QueryStatement types.String `tfsdk:"query_statement"` TableConfigurations fwtypes.MapValueOf[fwtypes.MapValueOf[types.String]] `tfsdk:"table_configurations"` } @@ -464,10 +475,10 @@ type s3Destination struct { S3OutputConfigurations fwtypes.ListNestedObjectValueOf[s3OutputConfigurations] `tfsdk:"s3_output_configurations"` } -type DestinationConfigurationsData struct { +type destinationConfigurationsData struct { S3Destination fwtypes.ListNestedObjectValueOf[s3Destination] `tfsdk:"s3_destination"` } -type RefreshCadenceData struct { +type refreshCadenceData struct { Frequency fwtypes.StringEnum[awstypes.FrequencyOption] `tfsdk:"frequency"` } diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 85c1802441bb..cd4c4c230d33 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -45,6 +45,15 @@ func TestAccBCMDataExportsExport_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.#", "1"), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.#", "1"), + resource.TestCheckResourceAttrSet(resourceName, "export.0.data_query.0.query_statement"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.%", "1"), + resource.TestCheckResourceAttr(resourceName, "export.0.destination_configurations.#", "1"), + resource.TestCheckResourceAttr(resourceName, "export.0.destination_configurations.0.s3_destination.#", "1"), + resource.TestCheckResourceAttr(resourceName, "export.0.refresh_cadence.#", "1"), + resource.TestCheckResourceAttr(resourceName, "export.0.refresh_cadence.0.frequency", "SYNCHRONOUS"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), ), }, { @@ -86,6 +95,99 @@ func TestAccBCMDataExportsExport_disappears(t *testing.T) { }) } +func TestAccBCMDataExportsExport_tags(t *testing.T) { + ctx := acctest.Context(t) + + var export bcmdataexports.GetExportOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_bcmdataexports_export.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckExportDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccExportConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccExportConfig_tag2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + Config: testAccExportConfig_tags1(rName, "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + +func TestAccBCMDataExportsExport_updateTable(t *testing.T) { + ctx := acctest.Context(t) + var export bcmdataexports.GetExportOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_bcmdataexports_export.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckExportDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccExportConfig_updateTableConfigs(rName, "HOURLY", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccExportConfig_updateTableConfigs(rName, "DAILY", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), + Check: resource.ComposeTestCheckFunc( + testAccCheckExportExists(ctx, resourceName, &export), + resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "DAILY"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), + ), + }, + }, + }) +} + func testAccCheckExportDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).BCMDataExportsClient(ctx) @@ -134,7 +236,7 @@ func testAccCheckExportExists(ctx context.Context, name string, export *bcmdatae } } -func testAccExportConfig_basic(rName string) string { +func testAccExportConfigBase(rName string) string { return fmt.Sprintf(` resource "aws_s3_bucket_policy" "bucket" { bucket = aws_s3_bucket.test.bucket @@ -166,7 +268,13 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q force_destroy = true } +`, rName) +} +func testAccExportConfig_basic(rName string) string { + return acctest.ConfigCompose( + testAccExportConfigBase(rName), + fmt.Sprintf(` resource "aws_bcmdataexports_export" "test" { export { name = %[1]q @@ -200,5 +308,130 @@ resource "aws_bcmdataexports_export" "test" { } } } -`, rName) +`, rName)) +} + +func testAccExportConfig_tags1(rName, tagKey1, tagValue1 string) string { + return acctest.ConfigCompose( + testAccExportConfigBase(rName), + fmt.Sprintf(` +resource "aws_bcmdataexports_export" "test" { + export { + name = %[1]q + data_query { + query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" + table_configurations = { + COST_AND_USAGE_REPORT = { + TIME_GRANULARITY = "HOURLY", + INCLUDE_RESOURCES = "FALSE", + INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + } + } + } + destination_configurations { + s3_destination { + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" + } + } + } + refresh_cadence { + frequency = "SYNCHRONOUS" + } + } + tags = { + %[2]q = %[3]q + } +} +`, rName, tagKey1, tagValue1)) +} + +func testAccExportConfig_tag2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return acctest.ConfigCompose( + testAccExportConfigBase(rName), + fmt.Sprintf(` +resource "aws_bcmdataexports_export" "test" { + export { + name = %[1]q + data_query { + query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" + table_configurations = { + COST_AND_USAGE_REPORT = { + TIME_GRANULARITY = "HOURLY", + INCLUDE_RESOURCES = "FALSE", + INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + } + } + } + destination_configurations { + s3_destination { + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" + } + } + } + refresh_cadence { + frequency = "SYNCHRONOUS" + } + } + tags = { + %[2]q = %[3]q + %[4]q = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2)) +} + +func testAccExportConfig_updateTableConfigs(rName, timeGranularity, costUsageSettings string) string { + return acctest.ConfigCompose( + testAccExportConfigBase(rName), + fmt.Sprintf(` +resource "aws_bcmdataexports_export" "test" { + export { + name = %[1]q + data_query { + query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" + table_configurations = { + COST_AND_USAGE_REPORT = { + TIME_GRANULARITY = %[2]q, + INCLUDE_RESOURCES = "FALSE", + INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", + INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + } + } + } + destination_configurations { + s3_destination { + s3_bucket = aws_s3_bucket.test.bucket + s3_prefix = aws_s3_bucket.test.bucket_prefix + s3_region = aws_s3_bucket.test.region + s3_output_configurations { + overwrite = "OVERWRITE_REPORT" + format = "TEXT_OR_CSV" + compression = "GZIP" + output_type = "CUSTOM" + } + } + } + + refresh_cadence { + frequency = "SYNCHRONOUS" + } + } +} +`, rName, timeGranularity, costUsageSettings)) } diff --git a/internal/service/bcmdataexports/sweep.go b/internal/service/bcmdataexports/sweep.go index 953b57270a13..870b7f1e5f42 100644 --- a/internal/service/bcmdataexports/sweep.go +++ b/internal/service/bcmdataexports/sweep.go @@ -4,12 +4,10 @@ package bcmdataexports import ( - "errors" "fmt" "log" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/service/auditmanager/types" "github.com/aws/aws-sdk-go-v2/service/bcmdataexports" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" @@ -24,16 +22,6 @@ func RegisterSweepers() { }) } -// isCompleteSetupError checks whether the returned error message indicates -// AuditManager isn't yet enabled in the current region. -// -// For example: -// AccessDeniedException: Please complete AWS Audit Manager setup from home page to enable this action in this account. -func isCompleteSetupError(err error) bool { - var ade *types.AccessDeniedException - return errors.As(err, &ade) -} - func sweepExports(region string) error { ctx := sweep.Context(region) client, err := sweep.SharedRegionalSweepClient(ctx, region) @@ -49,7 +37,7 @@ func sweepExports(region string) error { for pages.HasMorePages() { page, err := pages.NextPage(ctx) - if awsv2.SkipSweepError(err) || isCompleteSetupError(err) { + if awsv2.SkipSweepError(err) { log.Printf("[WARN] Skipping BCM Data Exports export sweep for %s: %s", region, err) return nil } From af588cdf5fcd4ad4962b396d7dabae1e6ea07ec2 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Thu, 18 Apr 2024 20:12:29 -0700 Subject: [PATCH 018/137] Test update --- internal/service/bcmdataexports/export.go | 5 ++ .../service/bcmdataexports/export_test.go | 50 +++++++++---------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index e12f8362bda6..682347f8e3d0 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -279,14 +279,19 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, return } + log.Printf("[WARN] BEFORE EXPAND do i get here") + if !plan.Export.Equal(state.Export) { in := &bcmdataexports.UpdateExportInput{ ExportArn: aws.String(plan.ID.ValueString()), } + log.Printf("[WARN] inside EXPAND do i get here") resp.Diagnostics.Append(flex.Expand(ctx, plan, in)...) if resp.Diagnostics.HasError() { return } + log.Printf("[WARN] do i get here") + log.Printf("[WARN] export arn: %s", plan.ID.ValueString()) out, err := conn.UpdateExport(ctx, in) if err != nil { diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index cd4c4c230d33..6ef6b7f25684 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -167,7 +167,7 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), - resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), ), }, { @@ -281,11 +281,11 @@ resource "aws_bcmdataexports_export" "test" { data_query { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations = { - COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = "HOURLY", - INCLUDE_RESOURCES = "FALSE", - INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", - INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + "COST_AND_USAGE_REPORT" = { + "TIME_GRANULARITY" = "HOURLY", + "INCLUDE_RESOURCES" = "FALSE", + "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", + "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", } } } @@ -321,11 +321,11 @@ resource "aws_bcmdataexports_export" "test" { data_query { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations = { - COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = "HOURLY", - INCLUDE_RESOURCES = "FALSE", - INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", - INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + "COST_AND_USAGE_REPORT" = { + "TIME_GRANULARITY" = "HOURLY", + "INCLUDE_RESOURCES" = "FALSE", + "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", + "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", } } } @@ -363,11 +363,11 @@ resource "aws_bcmdataexports_export" "test" { data_query { query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" table_configurations = { - COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = "HOURLY", - INCLUDE_RESOURCES = "FALSE", - INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", - INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", + "COST_AND_USAGE_REPORT" = { + "TIME_GRANULARITY" = "HOURLY", + "INCLUDE_RESOURCES" = "FALSE", + "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", + "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", } } } @@ -404,15 +404,15 @@ resource "aws_bcmdataexports_export" "test" { export { name = %[1]q data_query { - query_statement = "SELECT identity_line_item_id, identity_time_interval, line_item_product_code,line_item_unblended_cost FROM COST_AND_USAGE_REPORT" - table_configurations = { - COST_AND_USAGE_REPORT = { - TIME_GRANULARITY = %[2]q, - INCLUDE_RESOURCES = "FALSE", - INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY = "FALSE", - INCLUDE_SPLIT_COST_ALLOCATION_DATA = "FALSE", - } - } + query_statement = %[3]q + // table_configurations = { + // "COST_AND_USAGE_REPORT" = { + // "TIME_GRANULARITY" = %[2]q, + // "INCLUDE_RESOURCES" = "FALSE", + // "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", + // "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", + // } + // } } destination_configurations { s3_destination { From 9d6d4a011bba54e25d3fe36e7c37e62ad5b77972 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 15:08:22 -0400 Subject: [PATCH 019/137] r/aws_kinesis_firehose_delivery_stream: Tidy up 'snowflake_configuration' schema. --- internal/service/firehose/delivery_stream.go | 119 +++++++++--------- ...sis_firehose_delivery_stream.html.markdown | 15 ++- 2 files changed, 65 insertions(+), 69 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 674237917209..a565f3a69b4b 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -986,35 +986,63 @@ func resourceDeliveryStream() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_url": { + Type: schema.TypeString, + Required: true, + }, + "cloudwatch_logging_options": cloudWatchLoggingOptionsSchema(), + "content_column_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "data_loading_option": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.SnowflakeDataLoadingOption](), + }, + "database": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "key_passphrase": { Type: schema.TypeString, Required: true, - ValidateFunc: validateSnowflakeAccountURL, + Sensitive: true, + ValidateFunc: validation.StringLenBetween(7, 255), + }, + "metadata_column_name": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, "private_key": { Type: schema.TypeString, Required: true, Sensitive: true, }, - "key_passphrase": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + "processing_configuration": processingConfigurationSchema(), + "retry_duration": { + Type: schema.TypeInt, + Optional: true, + Default: 60, + ValidateFunc: validation.IntBetween(0, 7200), }, - "user": { - Type: schema.TypeString, - Required: true, + "role_arn": { + Type: schema.TypeString, + Required: true, + ValidateFunc: verify.ValidARN, }, - "database": { - Type: schema.TypeString, - Required: true, + "s3_backup_mode": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.SnowflakeS3BackupMode](), }, + "s3_configuration": s3ConfigurationSchema(), "schema": { - Type: schema.TypeString, - Required: true, - }, - "table": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, "snowflake_role_configuration": { Type: schema.TypeList, @@ -1028,24 +1056,13 @@ func resourceDeliveryStream() *schema.Resource { Default: false, }, "snowflake_role": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, }, }, }, - "data_loading_option": { - Type: schema.TypeString, - Optional: true, - }, - "meta_data_column_name": { - Type: schema.TypeString, - Optional: true, - }, - "content_column_name": { - Type: schema.TypeString, - Optional: true, - }, "snowflake_vpc_configuration": { Type: schema.TypeList, Optional: true, @@ -1059,30 +1076,16 @@ func resourceDeliveryStream() *schema.Resource { }, }, }, - "cloud_watch_logging_options": cloudWatchLoggingOptionsSchema(), - "processing_configuration": processingConfigurationSchema(), - "role_arn": { - Type: schema.TypeString, - Required: true, - }, - "retry_options": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "duration_in_seconds": { - Type: schema.TypeInt, - Required: true, - }, - }, - }, + "table": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, - "s3_backup_mode": { - Type: schema.TypeString, - Optional: true, + "user": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, - "s3_configuration": s3ConfigurationSchema(), }, }, }, @@ -3701,13 +3704,3 @@ func defaultProcessorParameters(destinationType destinationType, processorType t return make(map[types.ProcessorParameterName]string) } } - -func validateSnowflakeAccountURL(v interface{}, k string) (ws []string, errors []error) { - value := v.(string) - if !strings.HasPrefix(value, "https://") { - errors = append(errors, fmt.Errorf("%q must start with 'https://'", k)) - } - // Add more validation logic if needed, such as checking the format of the account URL - // You can use regular expressions or other methods for this validation. - return -} diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 90d2050ffac7..d5a55e8ec5e5 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -612,7 +612,7 @@ resource "aws_kinesis_firehose_delivery_stream" "example_snowflake_destination" snowflake_role = "string" } data_loading_option = "JSON_MAPPING" - meta_data_column_name = "string" + metadata_column_name = "string" content_column_name = "string" snowflake_vpc_configuration { private_link_vpce_id = "string" @@ -848,15 +848,18 @@ The `snowflake_configuration` configuration block supports the following argumen * `database` - (Required) The Snowflake database name. * `schema` - (Required) The Snowflake schema name. * `table` - (Required) The Snowflake table name. -* `snowflake_role_configuration` - (Optional) The configuration for Snowflake role. See [`snowflake_role_configuration` block](#snowflake_role_configuration-block) below for details. +* `snowflake_role_configuration` - (Optional) The configuration for Snowflake role. + * `enabled` - (Optional) Whether the Snowflake role is enabled. + * `snowflake_role` - (Optional) The Snowflake role. * `data_loading_option` - (Optional) The data loading option. -* `meta_data_column_name` - (Optional) The name of the metadata column. +* `metadata_column_name` - (Optional) The name of the metadata column. * `content_column_name` - (Optional) The name of the content column. -* `snowflake_vpc_configuration` - (Optional) The VPC configuration for Snowflake. See [`snowflake_vpc_configuration` block](#snowflake_vpc_configuration-block) below for details. -* `cloud_watch_logging_options` - (Optional) The CloudWatch logging options. See [`cloud_watch_logging_options` block](#cloud_watch_logging_options-block) below for details. +* `snowflake_vpc_configuration` - (Optional) The VPC configuration for Snowflake. + * `private_link_vpce_id` - (Required) The VPCE ID for Firehose to privately connect with Snowflake. +* `cloudwatch_logging_options` - (Optional) The CloudWatch logging options. See [`cloud_watch_logging_options` block](#cloud_watch_logging_options-block) below for details. * `processing_configuration` - (Optional) The processing configuration. See [`processing_configuration` block](#processing_configuration-block) below for details. * `role_arn` - (Required) The ARN of the IAM role. -* `retry_options` - (Optional) The retry options. See [`retry_options` block](#retry_options-block) below for details. +* `retry_duration` - (Optional) After an initial failure to deliver to Snowflake, the total amount of time, in seconds between 0 to 7200, during which Firehose re-attempts delivery (including the first attempt). After this time has elapsed, the failed documents are written to Amazon S3. The default value is 60s. There will be no retry if the value is 0. * `s3_backup_mode` - (Optional) The S3 backup mode. * `s3_configuration` - (Required) The S3 configuration. See [`s3_configuration` block](#s3_configuration-block) below for details. From 1a89309927727efb6ad592a53f8435d2d73540e7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:15:41 -0400 Subject: [PATCH 020/137] r/aws_kinesis_firehose_delivery_stream: Add 'snowflake_configuration' flex. --- internal/service/firehose/delivery_stream.go | 223 +++++++++++++++++- ...sis_firehose_delivery_stream.html.markdown | 3 +- 2 files changed, 222 insertions(+), 4 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index a565f3a69b4b..055f3cd0c783 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -41,8 +41,8 @@ const ( destinationTypeOpenSearch destinationType = "opensearch" destinationTypeOpenSearchServerless destinationType = "opensearchserverless" destinationTypeRedshift destinationType = "redshift" - destinationTypeSplunk destinationType = "splunk" destinationTypeSnowflake destinationType = "snowflake" + destinationTypeSplunk destinationType = "splunk" ) func (destinationType) Values() []destinationType { @@ -53,8 +53,8 @@ func (destinationType) Values() []destinationType { destinationTypeOpenSearch, destinationTypeOpenSearchServerless, destinationTypeRedshift, - destinationTypeSplunk, destinationTypeSnowflake, + destinationTypeSplunk, } } @@ -1007,7 +1007,7 @@ func resourceDeliveryStream() *schema.Resource { }, "key_passphrase": { Type: schema.TypeString, - Required: true, + Optional: true, Sensitive: true, ValidateFunc: validation.StringLenBetween(7, 255), }, @@ -1332,6 +1332,7 @@ func resourceDeliveryStream() *schema.Resource { destinationTypeOpenSearch: "opensearch_configuration", destinationTypeOpenSearchServerless: "opensearchserverless_configuration", destinationTypeRedshift: "redshift_configuration", + destinationTypeSnowflake: "snowflake_configuration", destinationTypeSplunk: "splunk_configuration", }[destination] @@ -1389,6 +1390,10 @@ func resourceDeliveryStreamCreate(ctx context.Context, d *schema.ResourceData, m if v, ok := d.GetOk("redshift_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.RedshiftDestinationConfiguration = expandRedshiftDestinationConfiguration(v.([]interface{})[0].(map[string]interface{})) } + case destinationTypeSnowflake: + if v, ok := d.GetOk("snowflake_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + input.SnowflakeDestinationConfiguration = expandSnowflakeDestinationConfiguration(v.([]interface{})[0].(map[string]interface{})) + } case destinationTypeSplunk: if v, ok := d.GetOk("splunk_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.SplunkDestinationConfiguration = expandSplunkDestinationConfiguration(v.([]interface{})[0].(map[string]interface{})) @@ -1510,6 +1515,13 @@ func resourceDeliveryStreamRead(ctx context.Context, d *schema.ResourceData, met if err := d.Set("redshift_configuration", flattenRedshiftDestinationDescription(destination.RedshiftDestinationDescription, configuredPassword)); err != nil { return sdkdiag.AppendErrorf(diags, "setting redshift_configuration: %s", err) } + case destination.SnowflakeDestinationDescription != nil: + d.Set("destination", destinationTypeSnowflake) + configuredKeyPassphrase := d.Get("snowflake_configuration.0.key_passphrase").(string) + configuredPrivateKey := d.Get("snowflake_configuration.0.private_key").(string) + if err := d.Set("snowflake_configuration", flattenSnowflakeDestinationDescription(destination.SnowflakeDestinationDescription, configuredKeyPassphrase, configuredPrivateKey)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting snowflake_configuration: %s", err) + } case destination.SplunkDestinationDescription != nil: d.Set("destination", destinationTypeSplunk) if err := d.Set("splunk_configuration", flattenSplunkDestinationDescription(destination.SplunkDestinationDescription)); err != nil { @@ -1565,6 +1577,10 @@ func resourceDeliveryStreamUpdate(ctx context.Context, d *schema.ResourceData, m if v, ok := d.GetOk("redshift_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.RedshiftDestinationUpdate = expandRedshiftDestinationUpdate(v.([]interface{})[0].(map[string]interface{})) } + case destinationTypeSnowflake: + if v, ok := d.GetOk("snowflake_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + input.SnowflakeDestinationUpdate = expandSnowflakeDestinationUpdate(v.([]interface{})[0].(map[string]interface{})) + } case destinationTypeSplunk: if v, ok := d.GetOk("splunk_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.SplunkDestinationUpdate = expandSplunkDestinationUpdate(v.([]interface{})[0].(map[string]interface{})) @@ -2627,6 +2643,108 @@ func expandAmazonOpenSearchServerlessDestinationUpdate(oss map[string]interface{ return update } +func expandSnowflakeDestinationConfiguration(tfMap map[string]interface{}) *types.SnowflakeDestinationConfiguration { + roleARN := tfMap["role_arn"].(string) + apiObject := &types.SnowflakeDestinationConfiguration{ + AccountUrl: aws.String(tfMap["account_url"].(string)), + Database: aws.String(tfMap["database"].(string)), + PrivateKey: aws.String(tfMap["private_key"].(string)), + RetryOptions: expandSnowflakeRetryOptions(tfMap), + RoleARN: aws.String(roleARN), + S3Configuration: expandS3DestinationConfiguration(tfMap["s3_configuration"].([]interface{})), + Schema: aws.String(tfMap["schema"].(string)), + Table: aws.String(tfMap["table"].(string)), + User: aws.String(tfMap["user"].(string)), + } + + if _, ok := tfMap["cloudwatch_logging_options"]; ok { + apiObject.CloudWatchLoggingOptions = expandCloudWatchLoggingOptions(tfMap) + } + + if v, ok := tfMap["content_column_name"]; ok && v.(string) != "" { + apiObject.ContentColumnName = aws.String(v.(string)) + } + + if v, ok := tfMap["data_loading_option"]; ok && v.(string) != "" { + apiObject.DataLoadingOption = types.SnowflakeDataLoadingOption(v.(string)) + } + + if v, ok := tfMap["key_passphrase"]; ok && v.(string) != "" { + apiObject.KeyPassphrase = aws.String(v.(string)) + } + + if v, ok := tfMap["metadata_column_name"]; ok && v.(string) != "" { + apiObject.MetaDataColumnName = aws.String(v.(string)) + } + + if _, ok := tfMap["processing_configuration"]; ok { + apiObject.ProcessingConfiguration = expandProcessingConfiguration(tfMap, destinationTypeSnowflake, roleARN) + } + + if v, ok := tfMap["s3_backup_mode"]; ok { + apiObject.S3BackupMode = types.SnowflakeS3BackupMode(v.(string)) + } + + if _, ok := tfMap["snowflake_role_configuration"]; ok { + apiObject.SnowflakeRoleConfiguration = expandSnowflakeRoleConfiguration(tfMap) + } + + if _, ok := tfMap["snowflake_vpc_configuration"]; ok { + apiObject.SnowflakeVpcConfiguration = expandSnowflakeVPCConfiguration(tfMap) + } + + return apiObject +} + +func expandSnowflakeDestinationUpdate(tfMap map[string]interface{}) *types.SnowflakeDestinationUpdate { + roleARN := tfMap["role_arn"].(string) + apiObject := &types.SnowflakeDestinationUpdate{ + AccountUrl: aws.String(tfMap["account_url"].(string)), + Database: aws.String(tfMap["database"].(string)), + PrivateKey: aws.String(tfMap["private_key"].(string)), + RetryOptions: expandSnowflakeRetryOptions(tfMap), + RoleARN: aws.String(roleARN), + S3Update: expandS3DestinationUpdate(tfMap["s3_configuration"].([]interface{})), + Schema: aws.String(tfMap["schema"].(string)), + Table: aws.String(tfMap["table"].(string)), + User: aws.String(tfMap["user"].(string)), + } + + if _, ok := tfMap["cloudwatch_logging_options"]; ok { + apiObject.CloudWatchLoggingOptions = expandCloudWatchLoggingOptions(tfMap) + } + + if v, ok := tfMap["content_column_name"]; ok && v.(string) != "" { + apiObject.ContentColumnName = aws.String(v.(string)) + } + + if v, ok := tfMap["data_loading_option"]; ok && v.(string) != "" { + apiObject.DataLoadingOption = types.SnowflakeDataLoadingOption(v.(string)) + } + + if v, ok := tfMap["key_passphrase"]; ok && v.(string) != "" { + apiObject.KeyPassphrase = aws.String(v.(string)) + } + + if v, ok := tfMap["metadata_column_name"]; ok && v.(string) != "" { + apiObject.MetaDataColumnName = aws.String(v.(string)) + } + + if _, ok := tfMap["processing_configuration"]; ok { + apiObject.ProcessingConfiguration = expandProcessingConfiguration(tfMap, destinationTypeSnowflake, roleARN) + } + + if v, ok := tfMap["s3_backup_mode"]; ok { + apiObject.S3BackupMode = types.SnowflakeS3BackupMode(v.(string)) + } + + if _, ok := tfMap["snowflake_role_configuration"]; ok { + apiObject.SnowflakeRoleConfiguration = expandSnowflakeRoleConfiguration(tfMap) + } + + return apiObject +} + func expandSplunkDestinationConfiguration(splunk map[string]interface{}) *types.SplunkDestinationConfiguration { configuration := &types.SplunkDestinationConfiguration{ HECToken: aws.String(splunk["hec_token"].(string)), @@ -2913,6 +3031,47 @@ func expandRedshiftRetryOptions(redshift map[string]interface{}) *types.Redshift return retryOptions } +func expandSnowflakeRetryOptions(tfMap map[string]interface{}) *types.SnowflakeRetryOptions { + apiObject := &types.SnowflakeRetryOptions{} + + if v, ok := tfMap["retry_duration"].(int); ok { + apiObject.DurationInSeconds = aws.Int32(int32(v)) + } + + return apiObject +} + +func expandSnowflakeRoleConfiguration(tfMap map[string]interface{}) *types.SnowflakeRoleConfiguration { + tfList := tfMap["snowflake_role_configuration"].([]interface{}) + if len(tfList) == 0 { + return nil + } + + tfMap = tfList[0].(map[string]interface{}) + + apiObject := &types.SnowflakeRoleConfiguration{ + Enabled: aws.Bool(tfMap["enabled"].(bool)), + SnowflakeRole: aws.String(tfMap["snowflake_role"].(string)), + } + + return apiObject +} + +func expandSnowflakeVPCConfiguration(tfMap map[string]interface{}) *types.SnowflakeVpcConfiguration { + tfList := tfMap["snowflake_vpc_configuration"].([]interface{}) + if len(tfList) == 0 { + return nil + } + + tfMap = tfList[0].(map[string]interface{}) + + apiObject := &types.SnowflakeVpcConfiguration{ + PrivateLinkVpceId: aws.String(tfMap["private_link_vpce_id"].(string)), + } + + return apiObject +} + func expandSplunkRetryOptions(splunk map[string]interface{}) *types.SplunkRetryOptions { retryOptions := &types.SplunkRetryOptions{} @@ -3241,6 +3400,39 @@ func flattenRedshiftDestinationDescription(description *types.RedshiftDestinatio return []map[string]interface{}{m} } +func flattenSnowflakeDestinationDescription(apiObject *types.SnowflakeDestinationDescription, configuredKeyPassphrase, configuredPrivateKey string) []map[string]interface{} { + if apiObject == nil { + return []map[string]interface{}{} + } + + roleARN := aws.ToString(apiObject.RoleARN) + tfMap := map[string]interface{}{ + "account_url": aws.ToString(apiObject.AccountUrl), + "cloudwatch_logging_options": flattenCloudWatchLoggingOptions(apiObject.CloudWatchLoggingOptions), + "content_column_name": aws.ToString(apiObject.ContentColumnName), + "data_loading_option": apiObject.DataLoadingOption, + "database": aws.ToString(apiObject.Database), + "key_passphrase": configuredKeyPassphrase, + "metadata_column_name": aws.ToString(apiObject.MetaDataColumnName), + "private_key": configuredPrivateKey, + "processing_configuration": flattenProcessingConfiguration(apiObject.ProcessingConfiguration, destinationTypeSnowflake, roleARN), + "role_arn": roleARN, + "s3_backup_mode": apiObject.S3BackupMode, + "s3_configuration": flattenS3DestinationDescription(apiObject.S3DestinationDescription), + "schema": aws.ToString(apiObject.Schema), + "snowflake_role_configuration": flattenSnowflakeRoleConfiguration(apiObject.SnowflakeRoleConfiguration), + "snowflake_vpc_configuration": flattenSnowflakeVPCConfiguration(apiObject.SnowflakeVpcConfiguration), + "table": aws.ToString(apiObject.Table), + "user": aws.ToString(apiObject.User), + } + + if apiObject.RetryOptions != nil { + tfMap["retry_duration"] = int(aws.ToInt32(apiObject.RetryOptions.DurationInSeconds)) + } + + return []map[string]interface{}{tfMap} +} + func flattenSplunkDestinationDescription(description *types.SplunkDestinationDescription) []map[string]interface{} { if description == nil { return []map[string]interface{}{} @@ -3666,6 +3858,31 @@ func flattenDocumentIDOptions(apiObject *types.DocumentIdOptions) map[string]int return tfMap } +func flattenSnowflakeRoleConfiguration(apiObject *types.SnowflakeRoleConfiguration) []map[string]interface{} { + if apiObject == nil { + return []map[string]interface{}{} + } + + m := map[string]interface{}{ + "enabled": aws.ToBool(apiObject.Enabled), + "snowflake_role": aws.ToString(apiObject.SnowflakeRole), + } + + return []map[string]interface{}{m} +} + +func flattenSnowflakeVPCConfiguration(apiObject *types.SnowflakeVpcConfiguration) []map[string]interface{} { + if apiObject == nil { + return []map[string]interface{}{} + } + + m := map[string]interface{}{ + "private_link_vpce_id": aws.ToString(apiObject.PrivateLinkVpceId), + } + + return []map[string]interface{}{m} +} + func isDeliveryStreamOptionDisabled(v interface{}) bool { tfList := v.([]interface{}) if len(tfList) == 0 || tfList[0] == nil { diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index d5a55e8ec5e5..045a31cfec0e 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -680,13 +680,14 @@ This resource supports the following arguments: * `server_side_encryption` - (Optional) Encrypt at rest options. See [`server_side_encryption` block](#server_side_encryption-block) below for details. **NOTE:** Server-side encryption should not be enabled when a kinesis stream is configured as the source of the firehose delivery stream. -* `destination` – (Required) This is the destination to where the data is delivered. The only options are `s3` (Deprecated, use `extended_s3` instead), `extended_s3`, `redshift`, `elasticsearch`, `splunk`, `http_endpoint`, `opensearch` and `opensearchserverless`. +* `destination` – (Required) This is the destination to where the data is delivered. The only options are `s3` (Deprecated, use `extended_s3` instead), `extended_s3`, `redshift`, `elasticsearch`, `splunk`, `http_endpoint`, `opensearch`, `opensearchserverless` and `snowflake`. * `elasticsearch_configuration` - (Optional) Configuration options when `destination` is `elasticsearch`. See [`elasticsearch_configuration` block](#elasticsearch_configuration-block) below for details. * `extended_s3_configuration` - (Optional, only Required when `destination` is `extended_s3`) Enhanced configuration options for the s3 destination. See [`extended_s3_configuration` block](#extended_s3_configuration-block) below for details. * `http_endpoint_configuration` - (Optional) Configuration options when `destination` is `http_endpoint`. Requires the user to also specify an `s3_configuration` block. See [`http_endpoint_configuration` block](#http_endpoint_configuration-block) below for details. * `opensearch_configuration` - (Optional) Configuration options when `destination` is `opensearch`. See [`opensearch_configuration` block](#opensearch_configuration-block) below for details. * `opensearchserverless_configuration` - (Optional) Configuration options when `destination` is `opensearchserverless`. See [`opensearchserverless_configuration` block](#opensearchserverless_configuration-block) below for details. * `redshift_configuration` - (Optional) Configuration options when `destination` is `redshift`. Requires the user to also specify an `s3_configuration` block. See [`redshift_configuration` block](#redshift_configuration-block) below for details. +* `snowflake_configuration` - (Optional) Configuration options when `destination` is `snowflake`. See [`snowflake_configuration` block](#snowflake_configuration-block) below for details. * `splunk_configuration` - (Optional) Configuration options when `destination` is `splunk`. See [`splunk_configuration` block](#splunk_configuration-block) below for details. ### `kinesis_source_configuration` block From 3ec2c92355c5fdb4eeb6a83bbaf3623e06ad209e Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:21:10 -0400 Subject: [PATCH 021/137] Tweak 'TestAccFirehoseDeliveryStream_basic'. --- internal/service/firehose/delivery_stream_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index c4f173e19b42..6006d17c8458 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -90,6 +90,7 @@ func TestAccFirehoseDeliveryStream_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.enabled", "false"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_arn", ""), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_type", "AWS_OWNED_CMK"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "version_id"), From b7f9cbe78cd68c115d8d0b60164d3552a5d97134 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:21:47 -0400 Subject: [PATCH 022/137] Tweak CHANGELOG entry. --- .changelog/36646.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/36646.txt b/.changelog/36646.txt index 98aa0783b851..9539e1a81d5b 100644 --- a/.changelog/36646.txt +++ b/.changelog/36646.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -resource/aws_kinesis_firehose_delivery_stream: Add `snowflake` as a destination +resource/aws_kinesis_firehose_delivery_stream: Add `snowflake_configuration` argument ``` \ No newline at end of file From b069759e045e0a6bc7e3fa8318eea5516513f04b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:24:49 -0400 Subject: [PATCH 023/137] Temporarily remove 'snowflake_destination_configuration' example. --- ...sis_firehose_delivery_stream.html.markdown | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 045a31cfec0e..8eeda86fa8f0 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -600,71 +600,6 @@ resource "aws_kinesis_firehose_delivery_stream" "example_snowflake_destination" destination = "snowflake" snowflake_destination_configuration { - account_url = "string" - private_key = "string" - key_passphrase = "string" - user = "string" - database = "string" - schema = "string" - table = "string" - snowflake_role_configuration { - enabled = true - snowflake_role = "string" - } - data_loading_option = "JSON_MAPPING" - metadata_column_name = "string" - content_column_name = "string" - snowflake_vpc_configuration { - private_link_vpce_id = "string" - } - cloud_watch_logging_options { - enabled = true - log_group_name = "string" - log_stream_name = "string" - } - processing_configuration { - enabled = true - processors = [ - { - type = "RecordDeAggregation" - parameters = [ - { - parameter_name = "LambdaArn" - parameter_value = "string" - } - # Add more parameters as needed - ] - } - # Add more processors as needed - ] - } - role_arn = "string" - retry_options { - duration_in_seconds = 123 - } - s3_backup_mode = "FailedDataOnly" - s3_configuration { - role_arn = "string" - bucket_arn = "string" - prefix = "string" - error_output_prefix = "string" - buffering_hints { - size_in_mbs = 123 - interval_in_seconds = 456 - } - compression_format = "UNCOMPRESSED" - encryption_configuration { - no_encryption_config = "NoEncryption" - kms_encryption_config { - aws_kms_key_arn = "string" - } - } - cloud_watch_logging_options { - enabled = true - log_group_name = "string" - log_stream_name = "string" - } - } } } ``` From e327ee1184cab27693a8abf7ee60c868f029ef09 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:56:46 -0400 Subject: [PATCH 024/137] Fix markdown-link-check error. --- website/docs/r/kinesis_firehose_delivery_stream.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 8eeda86fa8f0..4574e108478e 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -599,7 +599,7 @@ resource "aws_kinesis_firehose_delivery_stream" "example_snowflake_destination" name = "example-snowflake-destination" destination = "snowflake" - snowflake_destination_configuration { + snowflake_configuration { } } ``` @@ -792,7 +792,7 @@ The `snowflake_configuration` configuration block supports the following argumen * `content_column_name` - (Optional) The name of the content column. * `snowflake_vpc_configuration` - (Optional) The VPC configuration for Snowflake. * `private_link_vpce_id` - (Required) The VPCE ID for Firehose to privately connect with Snowflake. -* `cloudwatch_logging_options` - (Optional) The CloudWatch logging options. See [`cloud_watch_logging_options` block](#cloud_watch_logging_options-block) below for details. +* `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. See [`cloudwatch_logging_options` block](#cloudwatch_logging_options-block) below for details. * `processing_configuration` - (Optional) The processing configuration. See [`processing_configuration` block](#processing_configuration-block) below for details. * `role_arn` - (Required) The ARN of the IAM role. * `retry_duration` - (Optional) After an initial failure to deliver to Snowflake, the total amount of time, in seconds between 0 to 7200, during which Firehose re-attempts delivery (including the first attempt). After this time has elapsed, the failed documents are written to Amazon S3. The default value is 60s. There will be no retry if the value is 0. From 78384d77b83a62fce10ac8a9abbbaf49225b7b70 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:57:31 -0400 Subject: [PATCH 025/137] r/aws_kinesis_firehose_delivery_stream: 'snowflake_configuration' default values. --- internal/service/firehose/delivery_stream.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 055f3cd0c783..4262ef50cf15 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -998,6 +998,7 @@ func resourceDeliveryStream() *schema.Resource { "data_loading_option": { Type: schema.TypeString, Optional: true, + Default: types.SnowflakeDataLoadingOptionJsonMapping, ValidateDiagFunc: enum.Validate[types.SnowflakeDataLoadingOption](), }, "database": { @@ -1036,6 +1037,7 @@ func resourceDeliveryStream() *schema.Resource { "s3_backup_mode": { Type: schema.TypeString, Optional: true, + Default: types.SnowflakeS3BackupModeFailedDataOnly, ValidateDiagFunc: enum.Validate[types.SnowflakeS3BackupMode](), }, "s3_configuration": s3ConfigurationSchema(), @@ -1062,6 +1064,7 @@ func resourceDeliveryStream() *schema.Resource { }, }, }, + DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, }, "snowflake_vpc_configuration": { Type: schema.TypeList, From dcfb7e5658b7833c20160e40d3dbf58e238898b5 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 16:59:40 -0400 Subject: [PATCH 026/137] Restore 'snowflake_configuration' example. --- ...kinesis_firehose_delivery_stream.html.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 4574e108478e..7f242b2d8832 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -600,6 +600,21 @@ resource "aws_kinesis_firehose_delivery_stream" "example_snowflake_destination" destination = "snowflake" snowflake_configuration { + account_url = "https://example.snowflakecomputing.com" + database = "example-db" + private_key = "..." + role_arn = aws_iam_role.firehose.arn + schema = "example-schema" + table = "example-table" + user = "example-usr" + + s3_configuration { + role_arn = aws_iam_role.firehose.arn + bucket_arn = aws_s3_bucket.bucket.arn + buffering_size = 10 + buffering_interval = 400 + compression_format = "GZIP" + } } } ``` From e3463787b663d2a5e2c47a0f456cad096b018ab5 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 17:19:15 -0400 Subject: [PATCH 027/137] Add 'TestAccFirehoseDeliveryStream_snowflakeUpdates'. --- .../service/firehose/delivery_stream_test.go | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index 6006d17c8458..95d939346c52 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -1062,6 +1062,89 @@ func TestAccFirehoseDeliveryStream_redshiftUpdates(t *testing.T) { }) } +func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { + ctx := acctest.Context(t) + var stream types.DeliveryStreamDescription + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + key := acctest.TLSRSAPrivateKeyPEM(t, 4096) + resourceName := "aws_kinesis_firehose_delivery_stream.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.FirehoseServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckDeliveryStreamDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccDeliveryStreamConfig_snowflakeBasic(rName, key), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "destination", "opensearchserverless"), + resource.TestCheckResourceAttrSet(resourceName, "destination_id"), + resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "http_endpoint_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "kinesis_source_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "opensearch_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "opensearchserverless_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "redshift_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.#", "1"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_arn", ""), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_type", "AWS_OWNED_CMK"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.account_url", fmt.Sprintf("https://%s.snowflakecomputing.com", rName)), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.log_stream_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.content_column_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.data_loading_option", "JSON_MAPPING"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.database", "test-db"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.key_passphrase", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.metadata_column_name", ""), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.private_key"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.#", "0"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.retry_duration", "60"), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.role_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_backup_mode", "FailedDataOnly"), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.s3_configuration.0.bucket_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.buffering_interval", "400"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.buffering_size", "10"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.log_stream_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.compression_format", "GZIP"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.error_output_prefix", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.kms_key_arn", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.prefix", ""), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.s3_configuration.0.role_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.schema", "test-schema"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.snowflake_role", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_vpc_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.table", "test-table"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.user", "test-usr"), + resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttrSet(resourceName, "version_id"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccFirehoseDeliveryStream_splunkUpdates(t *testing.T) { ctx := acctest.Context(t) var stream types.DeliveryStreamDescription @@ -1837,6 +1920,7 @@ func TestAccFirehoseDeliveryStream_openSearchServerlessUpdates(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.enabled", "false"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_arn", ""), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_type", "AWS_OWNED_CMK"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "version_id"), @@ -1908,6 +1992,7 @@ func TestAccFirehoseDeliveryStream_openSearchServerlessUpdates(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.enabled", "false"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_arn", ""), resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_type", "AWS_OWNED_CMK"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "version_id"), @@ -3548,6 +3633,34 @@ resource "aws_kinesis_firehose_delivery_stream" "test" { `, rName)) } +func testAccDeliveryStreamConfig_snowflakeBasic(rName, privateKey string) string { + return acctest.ConfigCompose(testAccDeliveryStreamConfig_base(rName), fmt.Sprintf(` +resource "aws_kinesis_firehose_delivery_stream" "test" { + depends_on = [aws_iam_role_policy.firehose] + name = %[1]q + destination = "snowflake" + + snowflake_configuration { + account_url = "https://%[1]s.snowflakecomputing.com" + database = "test-db" + private_key = "%[2]s" + role_arn = aws_iam_role.firehose.arn + schema = "test-schema" + table = "test-table" + user = "test-usr" + + s3_configuration { + role_arn = aws_iam_role.firehose.arn + bucket_arn = aws_s3_bucket.bucket.arn + buffering_size = 10 + buffering_interval = 400 + compression_format = "GZIP" + } + } +} +`, rName, acctest.TLSPEMEscapeNewlines(privateKey))) +} + func testAccDeliveryStreamConfig_splunkBasic(rName string) string { return acctest.ConfigCompose(testAccDeliveryStreamConfig_base(rName), fmt.Sprintf(` resource "aws_kinesis_firehose_delivery_stream" "test" { From 23ddb3ea503e48a207c5c92f540a397fe7c5eda3 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Fri, 19 Apr 2024 14:23:42 -0700 Subject: [PATCH 028/137] Fix flatten argument --- internal/service/bcmdataexports/export.go | 23 +++++++------ .../service/bcmdataexports/export_test.go | 34 +++++++++---------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 682347f8e3d0..6cafb45914b6 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -70,7 +70,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, CustomType: fwtypes.NewMapTypeOf[fwtypes.MapValueOf[types.String]](ctx), Optional: true, PlanModifiers: []planmodifier.Map{ - mapplanmodifier.RequiresReplace(), + // mapplanmodifier.RequiresReplaceIfConfigured(), mapplanmodifier.UseStateForUnknown(), }, }, @@ -282,16 +282,17 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, log.Printf("[WARN] BEFORE EXPAND do i get here") if !plan.Export.Equal(state.Export) { - in := &bcmdataexports.UpdateExportInput{ - ExportArn: aws.String(plan.ID.ValueString()), - } - log.Printf("[WARN] inside EXPAND do i get here") + in := &bcmdataexports.UpdateExportInput{} resp.Diagnostics.Append(flex.Expand(ctx, plan, in)...) if resp.Diagnostics.HasError() { return } + + in.ExportArn = aws.String(plan.ID.ValueString()) + in.Export.ExportArn = aws.String(state.ID.ValueString()) + log.Printf("[WARN] do i get here") - log.Printf("[WARN] export arn: %s", plan.ID.ValueString()) + log.Printf("[WARN] export arn: %s", state.ID.ValueString()) out, err := conn.UpdateExport(ctx, in) if err != nil { @@ -309,10 +310,12 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, return } - resp.Diagnostics.Append(flex.Flatten(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), in, &plan)...) - if resp.Diagnostics.HasError() { - return - } + resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) + + // resp.Diagnostics.Append(flex.Flatten(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), out, &plan)...) + // if resp.Diagnostics.HasError() { + // return + // } } updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts) diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 6ef6b7f25684..2ea0b3afa7b9 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -162,12 +162,12 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { CheckDestroy: testAccCheckExportDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccExportConfig_updateTableConfigs(rName, "HOURLY", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), + Config: testAccExportConfig_updateTableConfigs(rName, "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), - resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), - resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), + // resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), ), }, { @@ -176,12 +176,12 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccExportConfig_updateTableConfigs(rName, "DAILY", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), + Config: testAccExportConfig_updateTableConfigs(rName, "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), - resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_product_code, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), + // resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "DAILY"), + resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), ), }, }, @@ -396,7 +396,7 @@ resource "aws_bcmdataexports_export" "test" { `, rName, tagKey1, tagValue1, tagKey2, tagValue2)) } -func testAccExportConfig_updateTableConfigs(rName, timeGranularity, costUsageSettings string) string { +func testAccExportConfig_updateTableConfigs(rName, queryStatement string) string { return acctest.ConfigCompose( testAccExportConfigBase(rName), fmt.Sprintf(` @@ -404,15 +404,15 @@ resource "aws_bcmdataexports_export" "test" { export { name = %[1]q data_query { - query_statement = %[3]q - // table_configurations = { - // "COST_AND_USAGE_REPORT" = { - // "TIME_GRANULARITY" = %[2]q, - // "INCLUDE_RESOURCES" = "FALSE", - // "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", - // "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", - // } - // } + query_statement = %[2]q + table_configurations = { + "COST_AND_USAGE_REPORT" = { + "TIME_GRANULARITY" = "HOURLY", + "INCLUDE_RESOURCES" = "FALSE", + "INCLUDE_MANUAL_DISCOUNT_COMPATIBILITY" = "FALSE", + "INCLUDE_SPLIT_COST_ALLOCATION_DATA" = "FALSE", + } + } } destination_configurations { s3_destination { @@ -433,5 +433,5 @@ resource "aws_bcmdataexports_export" "test" { } } } -`, rName, timeGranularity, costUsageSettings)) +`, rName, queryStatement)) } From dc50aeb9d3802914c058e1493c4103469f69f838 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 17:32:28 -0400 Subject: [PATCH 029/137] Add 'acctest.TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries'. --- internal/acctest/crypto.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/acctest/crypto.go b/internal/acctest/crypto.go index d1745a5835d0..d606e4351d03 100644 --- a/internal/acctest/crypto.go +++ b/internal/acctest/crypto.go @@ -32,6 +32,12 @@ var ( tlsX509CertificateSerialNumberLimit = new(big.Int).Lsh(big.NewInt(1), 128) //nolint:gomnd ) +// TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries removes RSA private key +// pre and post encapsulation boundaries from a PEM string. +func TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries(pem string) string { + return removePEMEncapsulationBoundaries(pem, PEMBlockTypeRSAPrivateKey) +} + // TLSPEMRemovePublicKeyEncapsulationBoundaries removes public key // pre and post encapsulation boundaries from a PEM string. func TLSPEMRemovePublicKeyEncapsulationBoundaries(pem string) string { From c5457303948b6261363fafa6d3b8a38c0c0f5fc3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 17:32:56 -0400 Subject: [PATCH 030/137] Fixup 'TestAccFirehoseDeliveryStream_snowflakeUpdates'. --- internal/service/firehose/delivery_stream_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index 95d939346c52..ba3e35d2a458 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -1128,7 +1128,7 @@ func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.enabled", "false"), resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.snowflake_role", ""), - resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_vpc_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_vpc_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.table", "test-table"), resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.user", "test-usr"), resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), @@ -3658,7 +3658,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test" { } } } -`, rName, acctest.TLSPEMEscapeNewlines(privateKey))) +`, rName, acctest.TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries(acctest.TLSPEMRemoveNewlines(privateKey)))) } func testAccDeliveryStreamConfig_splunkBasic(rName string) string { From 75dbf6bf14a8ccdac9eb7d2cc07323511fe14224 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 19 Apr 2024 17:36:44 -0400 Subject: [PATCH 031/137] Fixup 'TestAccFirehoseDeliveryStream_snowflakeUpdates'. --- internal/service/firehose/delivery_stream_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index ba3e35d2a458..06de27ba4996 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -1080,7 +1080,7 @@ func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, "arn"), - resource.TestCheckResourceAttr(resourceName, "destination", "opensearchserverless"), + resource.TestCheckResourceAttr(resourceName, "destination", "snowflake"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), From 9207a032b813a20ed908778fd34fd3bedbda94ed Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Fri, 19 Apr 2024 16:45:58 -0700 Subject: [PATCH 032/137] use enum slice --- internal/service/bcmdataexports/export.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 6cafb45914b6..b8c66c61b0a8 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -24,6 +24,7 @@ import ( "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" "github.com/hashicorp/terraform-provider-aws/internal/framework" "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" @@ -279,8 +280,6 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, return } - log.Printf("[WARN] BEFORE EXPAND do i get here") - if !plan.Export.Equal(state.Export) { in := &bcmdataexports.UpdateExportInput{} resp.Diagnostics.Append(flex.Expand(ctx, plan, in)...) @@ -289,10 +288,7 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, } in.ExportArn = aws.String(plan.ID.ValueString()) - in.Export.ExportArn = aws.String(state.ID.ValueString()) - - log.Printf("[WARN] do i get here") - log.Printf("[WARN] export arn: %s", state.ID.ValueString()) + in.Export.ExportArn = aws.String(plan.ID.ValueString()) out, err := conn.UpdateExport(ctx, in) if err != nil { @@ -311,11 +307,6 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, } resp.Diagnostics.Append(flex.Flatten(ctx, out, &plan)...) - - // resp.Diagnostics.Append(flex.Flatten(context.WithValue(ctx, flex.ResourcePrefix, ResNameExport), out, &plan)...) - // if resp.Diagnostics.HasError() { - // return - // } } updateTimeout := r.UpdateTimeout(ctx, plan.Timeouts) @@ -375,7 +366,7 @@ const ( func waitExportCreated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { stateConf := &retry.StateChangeConf{ Pending: []string{}, - Target: []string{string(statusHealthy)}, + Target: enum.Slice(awstypes.ExportStatusCodeHealthy), Refresh: statusExport(ctx, conn, id), Timeout: timeout, NotFoundChecks: 20, @@ -392,8 +383,8 @@ func waitExportCreated(ctx context.Context, conn *bcmdataexports.Client, id stri func waitExportUpdated(ctx context.Context, conn *bcmdataexports.Client, id string, timeout time.Duration) (*bcmdataexports.GetExportOutput, error) { stateConf := &retry.StateChangeConf{ - Pending: []string{string(statusUnhealthy)}, - Target: []string{string(statusHealthy)}, + Pending: enum.Slice(awstypes.ExportStatusCodeUnhealthy), + Target: enum.Slice(awstypes.ExportStatusCodeHealthy), Refresh: statusExport(ctx, conn, id), Timeout: timeout, NotFoundChecks: 20, From 60b407eff82fc6f53c33c8af2057c775f5aead0e Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Fri, 19 Apr 2024 17:00:13 -0700 Subject: [PATCH 033/137] remove unnecessary set in update --- internal/service/bcmdataexports/export.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index b8c66c61b0a8..7240e629a732 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -288,7 +288,6 @@ func (r *resourceExport) Update(ctx context.Context, req resource.UpdateRequest, } in.ExportArn = aws.String(plan.ID.ValueString()) - in.Export.ExportArn = aws.String(plan.ID.ValueString()) out, err := conn.UpdateExport(ctx, in) if err != nil { From 1169ab93c8e72346a277f8d44e6f979480fca703 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 20 Apr 2024 16:28:41 -0400 Subject: [PATCH 034/137] Add 'testAccDeliveryStreamConfig_snowflakeUpdate'. --- .../service/firehose/delivery_stream_test.go | 138 +++++++++++++++++- 1 file changed, 135 insertions(+), 3 deletions(-) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index 06de27ba4996..92810de04eef 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -1137,9 +1137,84 @@ func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"snowflake_configuration.0.private_key"}, + }, + { + Config: testAccDeliveryStreamConfig_snowflakeUpdate(rName, key), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "destination", "snowflake"), + resource.TestCheckResourceAttrSet(resourceName, "destination_id"), + resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "http_endpoint_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "kinesis_source_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "opensearch_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "opensearchserverless_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "redshift_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.#", "1"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_arn", ""), + resource.TestCheckResourceAttr(resourceName, "server_side_encryption.0.key_type", "AWS_OWNED_CMK"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.account_url", fmt.Sprintf("https://%s.snowflakecomputing.com", rName)), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.cloudwatch_logging_options.0.log_stream_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.content_column_name", "test-content"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.data_loading_option", "VARIANT_CONTENT_MAPPING"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.database", "test-db"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.key_passphrase", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.metadata_column_name", ""), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.private_key"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.0.type", "Lambda"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.0.parameters.#", "3"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.0.parameters.*", map[string]string{ + "parameter_name": "LambdaArn", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.0.parameters.*", map[string]string{ + "parameter_name": "BufferSizeInMBs", + "parameter_value": "1.1", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "snowflake_configuration.0.processing_configuration.0.processors.0.parameters.*", map[string]string{ + "parameter_name": "BufferIntervalInSeconds", + "parameter_value": "70", + }), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.retry_duration", "60"), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.role_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_backup_mode", "FailedDataOnly"), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.s3_configuration.0.bucket_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.buffering_interval", "400"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.buffering_size", "10"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.cloudwatch_logging_options.0.log_stream_name", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.compression_format", "GZIP"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.error_output_prefix", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.kms_key_arn", ""), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.s3_configuration.0.prefix", ""), + resource.TestCheckResourceAttrSet(resourceName, "snowflake_configuration.0.s3_configuration.0.role_arn"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.schema", "test-schema"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.#", "1"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_role_configuration.0.snowflake_role", "test-role"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.snowflake_vpc_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.table", "test-table"), + resource.TestCheckResourceAttr(resourceName, "snowflake_configuration.0.user", "test-usr"), + resource.TestCheckResourceAttr(resourceName, "splunk_configuration.#", "0"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttrSet(resourceName, "version_id"), + ), }, }, }) @@ -3661,6 +3736,63 @@ resource "aws_kinesis_firehose_delivery_stream" "test" { `, rName, acctest.TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries(acctest.TLSPEMRemoveNewlines(privateKey)))) } +func testAccDeliveryStreamConfig_snowflakeUpdate(rName, privateKey string) string { + return acctest.ConfigCompose(testAccDeliveryStreamConfig_base(rName), testAccDeliveryStreamConfig_baseLambda(rName), fmt.Sprintf(` +resource "aws_kinesis_firehose_delivery_stream" "test" { + depends_on = [aws_iam_role_policy.firehose] + name = %[1]q + destination = "snowflake" + + snowflake_configuration { + account_url = "https://%[1]s.snowflakecomputing.com" + database = "test-db" + private_key = "%[2]s" + role_arn = aws_iam_role.firehose.arn + schema = "test-schema" + table = "test-table" + user = "test-usr" + + s3_configuration { + role_arn = aws_iam_role.firehose.arn + bucket_arn = aws_s3_bucket.bucket.arn + buffering_size = 10 + buffering_interval = 400 + compression_format = "GZIP" + } + + data_loading_option = "VARIANT_CONTENT_MAPPING" + content_column_name = "test-content" + + snowflake_role_configuration { + enabled = true + snowflake_role = "test-role" + } + + processing_configuration { + enabled = false + + processors { + type = "Lambda" + + parameters { + parameter_name = "LambdaArn" + parameter_value = "${aws_lambda_function.lambda_function_test.arn}:$LATEST" + } + parameters { + parameter_name = "BufferSizeInMBs" + parameter_value = "1.1" + } + parameters { + parameter_name = "BufferIntervalInSeconds" + parameter_value = "70" + } + } + } + } +} +`, rName, acctest.TLSPEMRemoveRSAPrivateKeyEncapsulationBoundaries(acctest.TLSPEMRemoveNewlines(privateKey)))) +} + func testAccDeliveryStreamConfig_splunkBasic(rName string) string { return acctest.ConfigCompose(testAccDeliveryStreamConfig_base(rName), fmt.Sprintf(` resource "aws_kinesis_firehose_delivery_stream" "test" { From 2fef0a45129584e68b7991ee41087dfc7204db47 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 20 Apr 2024 16:37:51 -0400 Subject: [PATCH 035/137] Acceptance test output: % make testacc TESTARGS='-run=TestAccFirehoseDeliveryStream_snowflakeUpdates' PKG=firehose ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.21.8 test ./internal/service/firehose/... -v -count 1 -parallel 20 -run=TestAccFirehoseDeliveryStream_snowflakeUpdates -timeout 360m === RUN TestAccFirehoseDeliveryStream_snowflakeUpdates === PAUSE TestAccFirehoseDeliveryStream_snowflakeUpdates === CONT TestAccFirehoseDeliveryStream_snowflakeUpdates --- PASS: TestAccFirehoseDeliveryStream_snowflakeUpdates (102.16s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/firehose 114.313s From fb58173f211c321a111d883ea313ea2194fa1c12 Mon Sep 17 00:00:00 2001 From: Oussama Bounaim <1151352+obounaim@users.noreply.github.com> Date: Sun, 21 Apr 2024 13:26:39 +0000 Subject: [PATCH 036/137] Update Go devcontainer image to version 1.22 --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 00458209988d..1d516a742eb6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,5 +3,5 @@ { "name": "Go", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/go:1.21" + "image": "mcr.microsoft.com/devcontainers/go:1.22" } From 4afd62400f35eb6b9cd4faf61cab42b82d7ec4f0 Mon Sep 17 00:00:00 2001 From: team-tf-cdk Date: Mon, 22 Apr 2024 00:25:25 +0000 Subject: [PATCH 037/137] cdktf: update index.html.markdown,r/xray_sampling_rule.html.markdown,r/xray_group.html.markdown,r/xray_encryption_config.html.markdown,r/workspaces_workspace.html.markdown,r/workspaces_ip_group.html.markdown,r/workspaces_directory.html.markdown,r/workspaces_connection_alias.html.markdown,r/worklink_website_certificate_authority_association.html.markdown,r/worklink_fleet.html.markdown,r/wafv2_web_acl_logging_configuration.html.markdown,r/wafv2_web_acl_association.html.markdown,r/wafv2_web_acl.html.markdown,r/wafv2_rule_group.html.markdown,r/wafv2_regex_pattern_set.html.markdown,r/wafv2_ip_set.html.markdown,r/wafregional_xss_match_set.html.markdown,r/wafregional_web_acl_association.html.markdown,r/wafregional_web_acl.html.markdown,r/wafregional_sql_injection_match_set.html.markdown,r/wafregional_size_constraint_set.html.markdown,r/wafregional_rule_group.html.markdown,r/wafregional_rule.html.markdown,r/wafregional_regex_pattern_set.html.markdown,r/wafregional_regex_match_set.html.markdown,r/wafregional_rate_based_rule.html.markdown,r/wafregional_ipset.html.markdown,r/wafregional_geo_match_set.html.markdown,r/wafregional_byte_match_set.html.markdown,r/waf_xss_match_set.html.markdown,r/waf_web_acl.html.markdown,r/waf_sql_injection_match_set.html.markdown,r/waf_size_constraint_set.html.markdown,r/waf_rule_group.html.markdown,r/waf_rule.html.markdown,r/waf_regex_pattern_set.html.markdown,r/waf_regex_match_set.html.markdown,r/waf_rate_based_rule.html.markdown,r/waf_ipset.html.markdown,r/waf_geo_match_set.html.markdown,r/waf_byte_match_set.html.markdown,r/vpn_gateway_route_propagation.html.markdown,r/vpn_gateway_attachment.html.markdown,r/vpn_gateway.html.markdown,r/vpn_connection_route.html.markdown,r/vpn_connection.html.markdown,r/vpclattice_target_group_attachment.html.markdown,r/vpclattice_target_group.html.markdown,r/vpclattice_service_network_vpc_association.html.markdown,r/vpclattice_service_network_service_association.html.markdown,r/vpclattice_service_network.html.markdown,r/vpclattice_service.html.markdown,r/vpclattice_resource_policy.html.markdown,r/vpclattice_listener_rule.html.markdown,r/vpclattice_listener.html.markdown,r/vpclattice_auth_policy.html.markdown,r/vpclattice_access_log_subscription.html.markdown,r/vpc_security_group_ingress_rule.html.markdown,r/vpc_security_group_egress_rule.html.markdown,r/vpc_peering_connection_options.html.markdown,r/vpc_peering_connection_accepter.html.markdown,r/vpc_peering_connection.html.markdown,r/vpc_network_performance_metric_subscription.html.markdown,r/vpc_ipv6_cidr_block_association.html.markdown,r/vpc_ipv4_cidr_block_association.html.markdown,r/vpc_ipam_scope.html.markdown,r/vpc_ipam_resource_discovery_association.html.markdown,r/vpc_ipam_resource_discovery.html.markdown,r/vpc_ipam_preview_next_cidr.html.markdown,r/vpc_ipam_pool_cidr_allocation.html.markdown,r/vpc_ipam_pool_cidr.html.markdown,r/vpc_ipam_pool.html.markdown,r/vpc_ipam_organization_admin_account.html.markdown,r/vpc_ipam.html.markdown,r/vpc_endpoint_subnet_association.html.markdown,r/vpc_endpoint_service_allowed_principal.html.markdown,r/vpc_endpoint_service.html.markdown,r/vpc_endpoint_security_group_association.html.markdown,r/vpc_endpoint_route_table_association.html.markdown,r/vpc_endpoint_policy.html.markdown,r/vpc_endpoint_connection_notification.html.markdown,r/vpc_endpoint_connection_accepter.html.markdown,r/vpc_endpoint.html.markdown,r/vpc_dhcp_options_association.html.markdown,r/vpc_dhcp_options.html.markdown,r/vpc.html.markdown,r/volume_attachment.html.markdown,r/verifiedpermissions_schema.html.markdown,r/verifiedpermissions_policy_template.html.markdown,r/verifiedpermissions_policy_store.html.markdown,r/verifiedpermissions_policy.html.markdown,r/verifiedaccess_trust_provider.html.markdown,r/verifiedaccess_instance_trust_provider_attachment.html.markdown,r/verifiedaccess_instance_logging_configuration.html.markdown,r/verifiedaccess_instance.html.markdown,r/verifiedaccess_group.html.markdown,r/verifiedaccess_endpoint.html.markdown,r/transfer_workflow.html.markdown,r/transfer_user.html.markdown,r/transfer_tag.html.markdown,r/transfer_ssh_key.html.markdown,r/transfer_server.html.markdown,r/transfer_profile.html.markdown,r/transfer_connector.html.markdown,r/transfer_certificate.html.markdown,r/transfer_agreement.html.markdown,r/transfer_access.html.markdown,r/transcribe_vocabulary_filter.html.markdown,r/transcribe_vocabulary.html.markdown,r/transcribe_medical_vocabulary.html.markdown,r/transcribe_language_model.html.markdown,r/timestreamwrite_table.html.markdown,r/timestreamwrite_database.html.markdown,r/synthetics_group_association.html.markdown,r/synthetics_group.html.markdown,r/synthetics_canary.html.markdown,r/swf_domain.html.markdown,r/subnet.html.markdown,r/storagegateway_working_storage.html.markdown,r/storagegateway_upload_buffer.html.markdown,r/storagegateway_tape_pool.html.markdown,r/storagegateway_stored_iscsi_volume.html.markdown,r/storagegateway_smb_file_share.html.markdown,r/storagegateway_nfs_file_share.html.markdown,r/storagegateway_gateway.html.markdown,r/storagegateway_file_system_association.html.markdown,r/storagegateway_cached_iscsi_volume.html.markdown,r/storagegateway_cache.html.markdown,r/ssoadmin_trusted_token_issuer.html.markdown,r/ssoadmin_permissions_boundary_attachment.html.markdown,r/ssoadmin_permission_set_inline_policy.html.markdown,r/ssoadmin_permission_set.html.markdown,r/ssoadmin_managed_policy_attachment.html.markdown,r/ssoadmin_instance_access_control_attributes.html.markdown,r/ssoadmin_customer_managed_policy_attachment.html.markdown,r/ssoadmin_application_assignment_configuration.html.markdown,r/ssoadmin_application_assignment.html.markdown,r/ssoadmin_application_access_scope.html.markdown,r/ssoadmin_application.html.markdown,r/ssoadmin_account_assignment.html.markdown,r/ssmincidents_response_plan.html.markdown,r/ssmincidents_replication_set.html.markdown,r/ssmcontacts_rotation.html.markdown,r/ssmcontacts_plan.html.markdown,r/ssmcontacts_contact_channel.html.markdown,r/ssmcontacts_contact.html.markdown,r/ssm_service_setting.html.markdown,r/ssm_resource_data_sync.html.markdown,r/ssm_patch_group.html.markdown,r/ssm_patch_baseline.html.markdown,r/ssm_parameter.html.markdown,r/ssm_maintenance_window_task.html.markdown,r/ssm_maintenance_window_target.html.markdown,r/ssm_maintenance_window.html.markdown,r/ssm_document.html.markdown,r/ssm_default_patch_baseline.html.markdown,r/ssm_association.html.markdown,r/ssm_activation.html.markdown,r/sqs_queue_redrive_policy.html.markdown,r/sqs_queue_redrive_allow_policy.html.markdown,r/sqs_queue_policy.html.markdown,r/sqs_queue.html.markdown,r/spot_instance_request.html.markdown,r/spot_fleet_request.html.markdown,r/spot_datafeed_subscription.html.markdown,r/sns_topic_subscription.html.markdown,r/sns_topic_policy.html.markdown,r/sns_topic_data_protection_policy.html.markdown,r/sns_topic.html.markdown,r/sns_sms_preferences.html.markdown,r/sns_platform_application.html.markdown,r/snapshot_create_volume_permission.html.markdown,r/simpledb_domain.html.markdown,r/signer_signing_profile_permission.html.markdown,r/signer_signing_profile.html.markdown,r/signer_signing_job.html.markdown,r/shield_protection_health_check_association.html.markdown,r/shield_protection_group.html.markdown,r/shield_protection.html.markdown,r/shield_proactive_engagement.html.markdown,r/shield_drt_access_role_arn_association.html.markdown,r/shield_drt_access_log_bucket_association.html.markdown,r/shield_application_layer_automatic_response.html.markdown,r/sfn_state_machine.html.markdown,r/sfn_alias.html.markdown,r/sfn_activity.html.markdown,r/sesv2_email_identity_policy.html.markdown,r/sesv2_email_identity_mail_from_attributes.html.markdown,r/sesv2_email_identity_feedback_attributes.html.markdown,r/sesv2_email_identity.html.markdown,r/sesv2_dedicated_ip_pool.html.markdown,r/sesv2_dedicated_ip_assignment.html.markdown,r/sesv2_contact_list.html.markdown,r/sesv2_configuration_set_event_destination.html.markdown,r/sesv2_configuration_set.html.markdown,r/sesv2_account_vdm_attributes.html.markdown,r/ses_template.html.markdown,r/ses_receipt_rule_set.html.markdown,r/ses_receipt_rule.html.markdown,r/ses_receipt_filter.html.markdown,r/ses_identity_policy.html.markdown,r/ses_identity_notification_topic.html.markdown,r/ses_event_destination.html.markdown,r/ses_email_identity.html.markdown,r/ses_domain_mail_from.html.markdown,r/ses_domain_identity_verification.html.markdown,r/ses_domain_identity.html.markdown,r/ses_domain_dkim.html.markdown,r/ses_configuration_set.html.markdown,r/ses_active_receipt_rule_set.html.markdown,r/servicequotas_template_association.html.markdown,r/servicequotas_template.html.markdown,r/servicequotas_service_quota.html.markdown,r/servicecatalogappregistry_application.html.markdown,r/servicecatalog_tag_option_resource_association.html.markdown,r/servicecatalog_tag_option.html.markdown,r/servicecatalog_service_action.html.markdown,r/servicecatalog_provisioning_artifact.html.markdown,r/servicecatalog_provisioned_product.html.markdown,r/servicecatalog_product_portfolio_association.html.markdown,r/servicecatalog_product.html.markdown,r/servicecatalog_principal_portfolio_association.html.markdown,r/servicecatalog_portfolio_share.html.markdown,r/servicecatalog_portfolio.html.markdown,r/servicecatalog_organizations_access.html.markdown,r/servicecatalog_constraint.html.markdown,r/servicecatalog_budget_resource_association.html.markdown,r/service_discovery_service.html.markdown,r/service_discovery_public_dns_namespace.html.markdown,r/service_discovery_private_dns_namespace.html.markdown,r/service_discovery_instance.html.markdown,r/service_discovery_http_namespace.html.markdown,r/serverlessapplicationrepository_cloudformation_stack.html.markdown,r/securitylake_subscriber_notification.html.markdown,r/securitylake_subscriber.html.markdown,r/securitylake_data_lake.html.markdown,r/securitylake_custom_log_source.html.markdown,r/securitylake_aws_log_source.html.markdown,r/securityhub_standards_subscription.html.markdown,r/securityhub_standards_control.html.markdown,r/securityhub_product_subscription.html.markdown,r/securityhub_organization_configuration.html.markdown,r/securityhub_organization_admin_account.html.markdown,r/securityhub_member.html.markdown,r/securityhub_invite_accepter.html.markdown,r/securityhub_insight.html.markdown,r/securityhub_finding_aggregator.html.markdown,r/securityhub_configuration_policy_association.markdown,r/securityhub_configuration_policy.html.markdown,r/securityhub_automation_rule.html.markdown,r/securityhub_action_target.html.markdown,r/securityhub_account.html.markdown,r/security_group_rule.html.markdown,r/security_group.html.markdown,r/secretsmanager_secret_version.html.markdown,r/secretsmanager_secret_rotation.html.markdown,r/secretsmanager_secret_policy.html.markdown,r/secretsmanager_secret.html.markdown,r/schemas_schema.html.markdown,r/schemas_registry_policy.html.markdown,r/schemas_registry.html.markdown,r/schemas_discoverer.html.markdown,r/scheduler_schedule_group.html.markdown,r/scheduler_schedule.html.markdown,r/sagemaker_workteam.html.markdown,r/sagemaker_workforce.html.markdown,r/sagemaker_user_profile.html.markdown,r/sagemaker_studio_lifecycle_config.html.markdown,r/sagemaker_space.html.markdown,r/sagemaker_servicecatalog_portfolio_status.html.markdown,r/sagemaker_project.html.markdown,r/sagemaker_pipeline.html.markdown,r/sagemaker_notebook_instance_lifecycle_configuration.html.markdown,r/sagemaker_notebook_instance.html.markdown,r/sagemaker_monitoring_schedule.html.markdown,r/sagemaker_model_package_group_policy.html.markdown,r/sagemaker_model_package_group.html.markdown,r/sagemaker_model.html.markdown,r/sagemaker_image_version.html.markdown,r/sagemaker_image.html.markdown,r/sagemaker_human_task_ui.html.markdown,r/sagemaker_flow_definition.html.markdown,r/sagemaker_feature_group.html.markdown,r/sagemaker_endpoint_configuration.html.markdown,r/sagemaker_endpoint.html.markdown,r/sagemaker_domain.html.markdown,r/sagemaker_device_fleet.html.markdown,r/sagemaker_device.html.markdown,r/sagemaker_data_quality_job_definition.html.markdown,r/sagemaker_code_repository.html.markdown,r/sagemaker_app_image_config.html.markdown,r/sagemaker_app.html.markdown,r/s3outposts_endpoint.html.markdown,r/s3control_storage_lens_configuration.html.markdown,r/s3control_object_lambda_access_point_policy.html.markdown,r/s3control_object_lambda_access_point.html.markdown,r/s3control_multi_region_access_point_policy.html.markdown,r/s3control_multi_region_access_point.html.markdown,r/s3control_bucket_policy.html.markdown,r/s3control_bucket_lifecycle_configuration.html.markdown,r/s3control_bucket.html.markdown,r/s3control_access_point_policy.html.markdown,r/s3control_access_grants_location.html.markdown,r/s3control_access_grants_instance_resource_policy.html.markdown,r/s3control_access_grants_instance.html.markdown,r/s3control_access_grant.html.markdown,r/s3_object_copy.html.markdown,r/s3_object.html.markdown,r/s3_directory_bucket.html.markdown,r/s3_bucket_website_configuration.html.markdown,r/s3_bucket_versioning.html.markdown,r/s3_bucket_server_side_encryption_configuration.html.markdown,r/s3_bucket_request_payment_configuration.html.markdown,r/s3_bucket_replication_configuration.html.markdown,r/s3_bucket_public_access_block.html.markdown,r/s3_bucket_policy.html.markdown,r/s3_bucket_ownership_controls.html.markdown,r/s3_bucket_object_lock_configuration.html.markdown,r/s3_bucket_object.html.markdown,r/s3_bucket_notification.html.markdown,r/s3_bucket_metric.html.markdown,r/s3_bucket_logging.html.markdown,r/s3_bucket_lifecycle_configuration.html.markdown,r/s3_bucket_inventory.html.markdown,r/s3_bucket_intelligent_tiering_configuration.html.markdown,r/s3_bucket_cors_configuration.html.markdown,r/s3_bucket_analytics_configuration.html.markdown,r/s3_bucket_acl.html.markdown,r/s3_bucket_accelerate_configuration.html.markdown,r/s3_bucket.html.markdown,r/s3_account_public_access_block.html.markdown,r/s3_access_point.html.markdown,r/rum_metrics_destination.html.markdown,r/rum_app_monitor.html.markdown,r/route_table_association.html.markdown,r/route_table.html.markdown,r/route53recoveryreadiness_resource_set.html.markdown,r/route53recoveryreadiness_recovery_group.html.markdown,r/route53recoveryreadiness_readiness_check.html.markdown,r/route53recoveryreadiness_cell.html.markdown,r/route53recoverycontrolconfig_safety_rule.html.markdown,r/route53recoverycontrolconfig_routing_control.html.markdown,r/route53recoverycontrolconfig_control_panel.html.markdown,r/route53recoverycontrolconfig_cluster.html.markdown,r/route53domains_registered_domain.html.markdown,r/route53domains_delegation_signer_record.html.markdown,r/route53_zone_association.html.markdown,r/route53_zone.html.markdown,r/route53_vpc_association_authorization.html.markdown,r/route53_traffic_policy_instance.html.markdown,r/route53_traffic_policy.html.markdown,r/route53_resolver_rule_association.html.markdown,r/route53_resolver_rule.html.markdown,r/route53_resolver_query_log_config_association.html.markdown,r/route53_resolver_query_log_config.html.markdown,r/route53_resolver_firewall_rule_group_association.html.markdown,r/route53_resolver_firewall_rule_group.html.markdown,r/route53_resolver_firewall_rule.html.markdown,r/route53_resolver_firewall_domain_list.html.markdown,r/route53_resolver_firewall_config.html.markdown,r/route53_resolver_endpoint.html.markdown,r/route53_resolver_dnssec_config.html.markdown,r/route53_resolver_config.html.markdown,r/route53_record.html.markdown,r/route53_query_log.html.markdown,r/route53_key_signing_key.html.markdown,r/route53_hosted_zone_dnssec.html.markdown,r/route53_health_check.html.markdown,r/route53_delegation_set.html.markdown,r/route53_cidr_location.html.markdown,r/route53_cidr_collection.html.markdown,r/route.html.markdown,r/rolesanywhere_trust_anchor.html.markdown,r/rolesanywhere_profile.html.markdown,r/resourcegroups_resource.html.markdown,r/resourcegroups_group.html.markdown,r/resourceexplorer2_view.html.markdown,r/resourceexplorer2_index.html.markdown,r/rekognition_project.html.markdown,r/rekognition_collection.html.markdown,r/redshiftserverless_workgroup.html.markdown,r/redshiftserverless_usage_limit.html.markdown,r/redshiftserverless_snapshot.html.markdown,r/redshiftserverless_resource_policy.html.markdown,r/redshiftserverless_namespace.html.markdown,r/redshiftserverless_endpoint_access.html.markdown,r/redshiftserverless_custom_domain_association.html.markdown,r/redshiftdata_statement.html.markdown,r/redshift_usage_limit.html.markdown,r/redshift_subnet_group.html.markdown,r/redshift_snapshot_schedule_association.html.markdown,r/redshift_snapshot_schedule.html.markdown,r/redshift_snapshot_copy_grant.html.markdown,r/redshift_snapshot_copy.html.markdown,r/redshift_scheduled_action.html.markdown,r/redshift_resource_policy.html.markdown,r/redshift_partner.html.markdown,r/redshift_parameter_group.html.markdown,r/redshift_logging.html.markdown,r/redshift_hsm_configuration.html.markdown,r/redshift_hsm_client_certificate.html.markdown,r/redshift_event_subscription.html.markdown,r/redshift_endpoint_authorization.html.markdown,r/redshift_endpoint_access.html.markdown,r/redshift_data_share_consumer_association.html.markdown,r/redshift_data_share_authorization.html.markdown,r/redshift_cluster_snapshot.html.markdown,r/redshift_cluster_iam_roles.html.markdown,r/redshift_cluster.html.markdown,r/redshift_authentication_profile.html.markdown,r/rds_reserved_instance.html.markdown,r/rds_global_cluster.html.markdown,r/rds_export_task.html.markdown,r/rds_custom_db_engine_version.markdown,r/rds_cluster_role_association.html.markdown,r/rds_cluster_parameter_group.html.markdown,r/rds_cluster_instance.html.markdown,r/rds_cluster_endpoint.html.markdown,r/rds_cluster_activity_stream.html.markdown,r/rds_cluster.html.markdown,r/rbin_rule.html.markdown,r/ram_sharing_with_organization.html.markdown,r/ram_resource_share_accepter.html.markdown,r/ram_resource_share.html.markdown,r/ram_resource_association.html.markdown,r/ram_principal_association.html.markdown,r/quicksight_vpc_connection.html.markdown,r/quicksight_user.html.markdown,r/quicksight_theme.html.markdown,r/quicksight_template_alias.html.markdown,r/quicksight_template.html.markdown,r/quicksight_refresh_schedule.html.markdown,r/quicksight_namespace.html.markdown,r/quicksight_ingestion.html.markdown,r/quicksight_iam_policy_assignment.html.markdown,r/quicksight_group_membership.html.markdown,r/quicksight_group.html.markdown,r/quicksight_folder_membership.html.markdown,r/quicksight_folder.html.markdown,r/quicksight_data_source.html.markdown,r/quicksight_data_set.html.markdown,r/quicksight_dashboard.html.markdown,r/quicksight_analysis.html.markdown,r/quicksight_account_subscription.html.markdown,r/qldb_stream.html.markdown,r/qldb_ledger.html.markdown,r/proxy_protocol_policy.html.markdown,r/prometheus_workspace.html.markdown,r/prometheus_scraper.html.markdown,r/prometheus_rule_group_namespace.html.markdown,r/prometheus_alert_manager_definition.html.markdown,r/placement_group.html.markdown,r/pipes_pipe.html.markdown,r/pinpoint_sms_channel.html.markdown,r/pinpoint_gcm_channel.html.markdown,r/pinpoint_event_stream.html.markdown,r/pinpoint_email_channel.html.markdown,r/pinpoint_baidu_channel.html.markdown,r/pinpoint_app.html.markdown,r/pinpoint_apns_voip_sandbox_channel.html.markdown,r/pinpoint_apns_voip_channel.html.markdown,r/pinpoint_apns_sandbox_channel.html.markdown,r/pinpoint_apns_channel.html.markdown,r/pinpoint_adm_channel.html.markdown,r/osis_pipeline.html.markdown,r/organizations_resource_policy.html.markdown,r/organizations_policy_attachment.html.markdown,r/organizations_policy.html.markdown,r/organizations_organizational_unit.html.markdown,r/organizations_organization.html.markdown,r/organizations_delegated_administrator.html.markdown,r/organizations_account.html.markdown,r/opsworks_user_profile.html.markdown,r/opsworks_static_web_layer.html.markdown,r/opsworks_stack.html.markdown,r/opsworks_rds_db_instance.html.markdown,r/opsworks_rails_app_layer.html.markdown,r/opsworks_php_app_layer.html.markdown,r/opsworks_permission.html.markdown,r/opsworks_nodejs_app_layer.html.markdown,r/opsworks_mysql_layer.html.markdown,r/opsworks_memcached_layer.html.markdown,r/opsworks_java_app_layer.html.markdown,r/opsworks_instance.html.markdown,r/opsworks_haproxy_layer.html.markdown,r/opsworks_ganglia_layer.html.markdown,r/opsworks_ecs_cluster_layer.html.markdown,r/opsworks_custom_layer.html.markdown,r/opsworks_application.html.markdown,r/opensearchserverless_vpc_endpoint.html.markdown,r/opensearchserverless_security_policy.html.markdown,r/opensearchserverless_security_config.html.markdown,r/opensearchserverless_lifecycle_policy.html.markdown,r/opensearchserverless_collection.html.markdown,r/opensearchserverless_access_policy.html.markdown,r/opensearch_vpc_endpoint.html.markdown,r/opensearch_package_association.html.markdown,r/opensearch_package.html.markdown,r/opensearch_outbound_connection.html.markdown,r/opensearch_inbound_connection_accepter.html.markdown,r/opensearch_domain_saml_options.html.markdown,r/opensearch_domain_policy.html.markdown,r/opensearch_domain.html.markdown,r/oam_sink_policy.html.markdown,r/oam_sink.html.markdown,r/oam_link.html.markdown,r/networkmanager_vpc_attachment.html.markdown,r/networkmanager_transit_gateway_route_table_attachment.html.markdown,r/networkmanager_transit_gateway_registration.html.markdown,r/networkmanager_transit_gateway_peering.html.markdown,r/networkmanager_transit_gateway_connect_peer_association.html.markdown,r/networkmanager_site_to_site_vpn_attachment.html.markdown,r/networkmanager_site.html.markdown,r/networkmanager_link_association.html.markdown,r/networkmanager_link.html.markdown,r/networkmanager_global_network.html.markdown,r/networkmanager_device.html.markdown,r/networkmanager_customer_gateway_association.html.markdown,r/networkmanager_core_network_policy_attachment.html.markdown,r/networkmanager_core_network.html.markdown,r/networkmanager_connection.html.markdown,r/networkmanager_connect_peer.html.markdown,r/networkmanager_connect_attachment.html.markdown,r/networkmanager_attachment_accepter.html.markdown,r/networkfirewall_rule_group.html.markdown,r/networkfirewall_resource_policy.html.markdown,r/networkfirewall_logging_configuration.html.markdown,r/networkfirewall_firewall_policy.html.markdown,r/networkfirewall_firewall.html.markdown,r/network_interface_sg_attachment.html.markdown,r/network_interface_attachment.html.markdown,r/network_interface.html.markdown,r/network_acl_rule.html.markdown,r/network_acl_association.html.markdown,r/network_acl.html.markdown,r/neptune_subnet_group.html.markdown,r/neptune_parameter_group.html.markdown,r/neptune_global_cluster.html.markdown,r/neptune_event_subscription.html.markdown,r/neptune_cluster_snapshot.html.markdown,r/neptune_cluster_parameter_group.html.markdown,r/neptune_cluster_instance.html.markdown,r/neptune_cluster_endpoint.html.markdown,r/neptune_cluster.html.markdown,r/nat_gateway.html.markdown,r/mwaa_environment.html.markdown,r/mskconnect_worker_configuration.html.markdown,r/mskconnect_custom_plugin.html.markdown,r/mskconnect_connector.html.markdown,r/msk_vpc_connection.html.markdown,r/msk_serverless_cluster.html.markdown,r/msk_scram_secret_association.html.markdown,r/msk_replicator.html.markdown,r/msk_configuration.html.markdown,r/msk_cluster_policy.html.markdown,r/msk_cluster.html.markdown,r/mq_configuration.html.markdown,r/mq_broker.html.markdown,r/memorydb_user.html.markdown,r/memorydb_subnet_group.html.markdown,r/memorydb_snapshot.html.markdown,r/memorydb_parameter_group.html.markdown,r/memorydb_cluster.html.markdown,r/memorydb_acl.html.markdown,r/medialive_multiplex_program.html.markdown,r/medialive_multiplex.html.markdown,r/medialive_input_security_group.html.markdown,r/medialive_input.html.markdown,r/medialive_channel.html.markdown,r/media_store_container_policy.html.markdown,r/media_store_container.html.markdown,r/media_package_channel.html.markdown,r/media_convert_queue.html.markdown,r/main_route_table_association.html.markdown,r/macie2_organization_admin_account.html.markdown,r/macie2_member.html.markdown,r/macie2_invitation_accepter.html.markdown,r/macie2_findings_filter.html.markdown,r/macie2_custom_data_identifier.html.markdown,r/macie2_classification_job.html.markdown,r/macie2_classification_export_configuration.html.markdown,r/macie2_account.html.markdown,r/m2_environment.html.markdown,r/m2_deployment.html.markdown,r/m2_application.html.markdown,r/location_tracker_association.html.markdown,r/location_tracker.html.markdown,r/location_route_calculator.html.markdown,r/location_place_index.html.markdown,r/location_map.html.markdown,r/location_geofence_collection.html.markdown,r/load_balancer_policy.html.markdown,r/load_balancer_listener_policy.html.markdown,r/load_balancer_backend_server_policy.html.markdown,r/lightsail_static_ip_attachment.html.markdown,r/lightsail_static_ip.html.markdown,r/lightsail_lb_stickiness_policy.html.markdown,r/lightsail_lb_https_redirection_policy.html.markdown,r/lightsail_lb_certificate_attachment.html.markdown,r/lightsail_lb_certificate.html.markdown,r/lightsail_lb_attachment.html.markdown,r/lightsail_lb.html.markdown,r/lightsail_key_pair.html.markdown,r/lightsail_instance_public_ports.html.markdown,r/lightsail_instance.html.markdown,r/lightsail_domain_entry.html.markdown,r/lightsail_domain.html.markdown,r/lightsail_distribution.html.markdown,r/lightsail_disk_attachment.html.markdown,r/lightsail_disk.html.markdown,r/lightsail_database.html.markdown,r/lightsail_container_service_deployment_version.html.markdown,r/lightsail_container_service.html.markdown,r/lightsail_certificate.html.markdown,r/lightsail_bucket_resource_access.html.markdown,r/lightsail_bucket_access_key.html.markdown,r/lightsail_bucket.html.markdown,r/licensemanager_license_configuration.html.markdown,r/licensemanager_grant_accepter.html.markdown,r/licensemanager_grant.html.markdown,r/licensemanager_association.html.markdown,r/lexv2models_slot_type.html.markdown,r/lexv2models_slot.html.markdown,r/lexv2models_intent.html.markdown,r/lexv2models_bot_version.html.markdown,r/lexv2models_bot_locale.html.markdown,r/lexv2models_bot.html.markdown,r/lex_slot_type.html.markdown,r/lex_intent.html.markdown,r/lex_bot_alias.html.markdown,r/lex_bot.html.markdown,r/lb_trust_store_revocation.html.markdown,r/lb_trust_store.html.markdown,r/lb_target_group_attachment.html.markdown,r/lb_target_group.html.markdown,r/lb_ssl_negotiation_policy.html.markdown,r/lb_listener_rule.html.markdown,r/lb_listener_certificate.html.markdown,r/lb_listener.html.markdown,r/lb_cookie_stickiness_policy.html.markdown,r/lb.html.markdown,r/launch_template.html.markdown,r/launch_configuration.html.markdown,r/lambda_provisioned_concurrency_config.html.markdown,r/lambda_permission.html.markdown,r/lambda_layer_version_permission.html.markdown,r/lambda_layer_version.html.markdown,r/lambda_invocation.html.markdown,r/lambda_function_url.html.markdown,r/lambda_function_event_invoke_config.html.markdown,r/lambda_function.html.markdown,r/lambda_event_source_mapping.html.markdown,r/lambda_code_signing_config.html.markdown,r/lambda_alias.html.markdown,r/lakeformation_resource_lf_tags.html.markdown,r/lakeformation_resource_lf_tag.html.markdown,r/lakeformation_resource.html.markdown,r/lakeformation_permissions.html.markdown,r/lakeformation_lf_tag.html.markdown,r/lakeformation_data_lake_settings.html.markdown,r/lakeformation_data_cells_filter.html.markdown,r/kms_replica_key.html.markdown,r/kms_replica_external_key.html.markdown,r/kms_key_policy.html.markdown,r/kms_key.html.markdown,r/kms_grant.html.markdown,r/kms_external_key.html.markdown,r/kms_custom_key_store.html.markdown,r/kms_ciphertext.html.markdown,r/kms_alias.html.markdown,r/kinesisanalyticsv2_application_snapshot.html.markdown,r/kinesisanalyticsv2_application.html.markdown,r/kinesis_video_stream.html.markdown,r/kinesis_stream_consumer.html.markdown,r/kinesis_stream.html.markdown,r/kinesis_resource_policy.html.markdown,r/kinesis_firehose_delivery_stream.html.markdown,r/kinesis_analytics_application.html.markdown,r/keyspaces_table.html.markdown,r/keyspaces_keyspace.html.markdown,r/key_pair.html.markdown,r/kendra_thesaurus.html.markdown,r/kendra_query_suggestions_block_list.html.markdown,r/kendra_index.html.markdown,r/kendra_faq.html.markdown,r/kendra_experience.html.markdown,r/kendra_data_source.html.markdown,r/ivschat_room.html.markdown,r/ivschat_logging_configuration.html.markdown,r/ivs_recording_configuration.html.markdown,r/ivs_playback_key_pair.html.markdown,r/ivs_channel.html.markdown,r/iot_topic_rule_destination.html.markdown,r/iot_topic_rule.html.markdown,r/iot_thing_type.html.markdown,r/iot_thing_principal_attachment.html.markdown,r/iot_thing_group_membership.html.markdown,r/iot_thing_group.html.markdown,r/iot_thing.html.markdown,r/iot_role_alias.html.markdown,r/iot_provisioning_template.html.markdown,r/iot_policy_attachment.html.markdown,r/iot_policy.html.markdown,r/iot_logging_options.html.markdown,r/iot_indexing_configuration.html.markdown,r/iot_event_configurations.html.markdown,r/iot_domain_configuration.html.markdown,r/iot_certificate.html.markdown,r/iot_ca_certificate.html.markdown,r/iot_billing_group.html.markdown,r/iot_authorizer.html.markdown,r/internetmonitor_monitor.html.markdown,r/internet_gateway_attachment.html.markdown,r/internet_gateway.html.markdown,r/instance.html.markdown,r/inspector_resource_group.html.markdown,r/inspector_assessment_template.html.markdown,r/inspector_assessment_target.html.markdown,r/inspector2_organization_configuration.html.markdown,r/inspector2_member_association.html.markdown,r/inspector2_enabler.html.markdown,r/inspector2_delegated_admin_account.html.markdown,r/imagebuilder_workflow.html.markdown,r/imagebuilder_infrastructure_configuration.html.markdown,r/imagebuilder_image_recipe.html.markdown,r/imagebuilder_image_pipeline.html.markdown,r/imagebuilder_image.html.markdown,r/imagebuilder_distribution_configuration.html.markdown,r/imagebuilder_container_recipe.html.markdown,r/imagebuilder_component.html.markdown,r/identitystore_user.html.markdown,r/identitystore_group_membership.html.markdown,r/identitystore_group.html.markdown,r/iam_virtual_mfa_device.html.markdown,r/iam_user_ssh_key.html.markdown,r/iam_user_policy_attachment.html.markdown,r/iam_user_policy.html.markdown,r/iam_user_login_profile.html.markdown,r/iam_user_group_membership.html.markdown,r/iam_user.html.markdown,r/iam_signing_certificate.html.markdown,r/iam_service_specific_credential.html.markdown,r/iam_service_linked_role.html.markdown,r/iam_server_certificate.html.markdown,r/iam_security_token_service_preferences.html.markdown,r/iam_saml_provider.html.markdown,r/iam_role_policy_attachment.html.markdown,r/iam_role_policy.html.markdown,r/iam_role.html.markdown,r/iam_policy_attachment.html.markdown,r/iam_policy.html.markdown,r/iam_openid_connect_provider.html.markdown,r/iam_instance_profile.html.markdown,r/iam_group_policy_attachment.html.markdown,r/iam_group_policy.html.markdown,r/iam_group_membership.html.markdown,r/iam_group.html.markdown,r/iam_account_password_policy.html.markdown,r/iam_account_alias.html.markdown,r/iam_access_key.html.markdown,r/guardduty_threatintelset.html.markdown,r/guardduty_publishing_destination.html.markdown,r/guardduty_organization_configuration_feature.html.markdown,r/guardduty_organization_configuration.html.markdown,r/guardduty_organization_admin_account.html.markdown,r/guardduty_member.html.markdown,r/guardduty_ipset.html.markdown,r/guardduty_invite_accepter.html.markdown,r/guardduty_filter.html.markdown,r/guardduty_detector_feature.html.markdown,r/guardduty_detector.html.markdown,r/grafana_workspace_saml_configuration.html.markdown,r/grafana_workspace_api_key.html.markdown,r/grafana_workspace.html.markdown,r/grafana_role_association.html.markdown,r/grafana_license_association.html.markdown,r/glue_workflow.html.markdown,r/glue_user_defined_function.html.markdown,r/glue_trigger.html.markdown,r/glue_security_configuration.html.markdown,r/glue_schema.html.markdown,r/glue_resource_policy.html.markdown,r/glue_registry.html.markdown,r/glue_partition_index.html.markdown,r/glue_partition.html.markdown,r/glue_ml_transform.html.markdown,r/glue_job.html.markdown,r/glue_dev_endpoint.html.markdown,r/glue_data_quality_ruleset.html.markdown,r/glue_data_catalog_encryption_settings.html.markdown,r/glue_crawler.html.markdown,r/glue_connection.html.markdown,r/glue_classifier.html.markdown,r/glue_catalog_table.html.markdown,r/glue_catalog_database.html.markdown,r/globalaccelerator_listener.html.markdown,r/globalaccelerator_endpoint_group.html.markdown,r/globalaccelerator_custom_routing_listener.html.markdown,r/globalaccelerator_custom_routing_endpoint_group.html.markdown,r/globalaccelerator_custom_routing_accelerator.html.markdown,r/globalaccelerator_accelerator.html.markdown,r/glacier_vault_lock.html.markdown,r/glacier_vault.html.markdown,r/gamelift_script.html.markdown,r/gamelift_game_session_queue.html.markdown,r/gamelift_game_server_group.html.markdown,r/gamelift_fleet.html.markdown,r/gamelift_build.html.markdown,r/gamelift_alias.html.markdown,r/fsx_windows_file_system.html.markdown,r/fsx_openzfs_volume.html.markdown,r/fsx_openzfs_snapshot.html.markdown,r/fsx_openzfs_file_system.html.markdown,r/fsx_ontap_volume.html.markdown,r/fsx_ontap_storage_virtual_machine.html.markdown,r/fsx_ontap_file_system.html.markdown,r/fsx_lustre_file_system.html.markdown,r/fsx_file_cache.html.markdown,r/fsx_data_repository_association.html.markdown,r/fsx_backup.html.markdown,r/fms_policy.html.markdown,r/fms_admin_account.html.markdown,r/flow_log.html.markdown,r/fis_experiment_template.html.markdown,r/finspace_kx_volume.html.markdown,r/finspace_kx_user.html.markdown,r/finspace_kx_scaling_group.html.markdown,r/finspace_kx_environment.html.markdown,r/finspace_kx_dataview.html.markdown,r/finspace_kx_database.html.markdown,r/finspace_kx_cluster.html.markdown,r/evidently_segment.html.markdown,r/evidently_project.html.markdown,r/evidently_launch.html.markdown,r/evidently_feature.html.markdown,r/emrserverless_application.html.markdown,r/emrcontainers_virtual_cluster.html.markdown,r/emrcontainers_job_template.html.markdown,r/emr_studio_session_mapping.html.markdown,r/emr_studio.html.markdown,r/emr_security_configuration.html.markdown,r/emr_managed_scaling_policy.html.markdown,r/emr_instance_group.html.markdown,r/emr_instance_fleet.html.markdown,r/emr_cluster.html.markdown,r/emr_block_public_access_configuration.html.markdown,r/elb_attachment.html.markdown,r/elb.html.markdown,r/elastictranscoder_preset.html.markdown,r/elastictranscoder_pipeline.html.markdown,r/elasticsearch_vpc_endpoint.html.markdown,r/elasticsearch_domain_saml_options.html.markdown,r/elasticsearch_domain_policy.html.markdown,r/elasticsearch_domain.html.markdown,r/elasticache_user_group_association.html.markdown,r/elasticache_user_group.html.markdown,r/elasticache_user.html.markdown,r/elasticache_subnet_group.html.markdown,r/elasticache_serverless_cache.html.markdown,r/elasticache_replication_group.html.markdown,r/elasticache_parameter_group.html.markdown,r/elasticache_global_replication_group.html.markdown,r/elasticache_cluster.html.markdown,r/elastic_beanstalk_environment.html.markdown,r/elastic_beanstalk_configuration_template.html.markdown,r/elastic_beanstalk_application_version.html.markdown,r/elastic_beanstalk_application.html.markdown,r/eks_pod_identity_association.html.markdown,r/eks_node_group.html.markdown,r/eks_identity_provider_config.html.markdown,r/eks_fargate_profile.html.markdown,r/eks_cluster.html.markdown,r/eks_addon.html.markdown,r/eks_access_policy_association.html.markdown,r/eks_access_entry.html.markdown,r/eip_domain_name.html.markdown,r/eip_association.html.markdown,r/eip.html.markdown,r/egress_only_internet_gateway.html.markdown,r/efs_replication_configuration.html.markdown,r/efs_mount_target.html.markdown,r/efs_file_system_policy.html.markdown,r/efs_file_system.html.markdown,r/efs_backup_policy.html.markdown,r/efs_access_point.html.markdown,r/ecs_task_set.html.markdown,r/ecs_task_definition.html.markdown,r/ecs_tag.html.markdown,r/ecs_service.html.markdown,r/ecs_cluster_capacity_providers.html.markdown,r/ecs_cluster.html.markdown,r/ecs_capacity_provider.html.markdown,r/ecs_account_setting_default.html.markdown,r/ecrpublic_repository_policy.html.markdown,r/ecrpublic_repository.html.markdown,r/ecr_repository_policy.html.markdown,r/ecr_repository.html.markdown,r/ecr_replication_configuration.html.markdown,r/ecr_registry_scanning_configuration.html.markdown,r/ecr_registry_policy.html.markdown,r/ecr_pull_through_cache_rule.html.markdown,r/ecr_lifecycle_policy.html.markdown,r/ec2_transit_gateway_vpc_attachment_accepter.html.markdown,r/ec2_transit_gateway_vpc_attachment.html.markdown,r/ec2_transit_gateway_route_table_propagation.html.markdown,r/ec2_transit_gateway_route_table_association.html.markdown,r/ec2_transit_gateway_route_table.html.markdown,r/ec2_transit_gateway_route.html.markdown,r/ec2_transit_gateway_prefix_list_reference.html.markdown,r/ec2_transit_gateway_policy_table_association.html.markdown,r/ec2_transit_gateway_policy_table.html.markdown,r/ec2_transit_gateway_peering_attachment_accepter.html.markdown,r/ec2_transit_gateway_peering_attachment.html.markdown,r/ec2_transit_gateway_multicast_group_source.html.markdown,r/ec2_transit_gateway_multicast_group_member.html.markdown,r/ec2_transit_gateway_multicast_domain_association.html.markdown,r/ec2_transit_gateway_multicast_domain.html.markdown,r/ec2_transit_gateway_connect_peer.html.markdown,r/ec2_transit_gateway_connect.html.markdown,r/ec2_transit_gateway.html.markdown,r/ec2_traffic_mirror_target.html.markdown,r/ec2_traffic_mirror_session.html.markdown,r/ec2_traffic_mirror_filter_rule.html.markdown,r/ec2_traffic_mirror_filter.html.markdown,r/ec2_tag.html.markdown,r/ec2_subnet_cidr_reservation.html.markdown,r/ec2_serial_console_access.html.markdown,r/ec2_network_insights_path.html.markdown,r/ec2_network_insights_analysis.html.markdown,r/ec2_managed_prefix_list_entry.html.markdown,r/ec2_managed_prefix_list.html.markdown,r/ec2_local_gateway_route_table_vpc_association.html.markdown,r/ec2_local_gateway_route.html.markdown,r/ec2_instance_state.html.markdown,r/ec2_instance_metadata_defaults.html.markdown,r/ec2_instance_connect_endpoint.html.markdown,r/ec2_image_block_public_access.markdown,r/ec2_host.html.markdown,r/ec2_fleet.html.markdown,r/ec2_client_vpn_route.html.markdown,r/ec2_client_vpn_network_association.html.markdown,r/ec2_client_vpn_endpoint.html.markdown,r/ec2_client_vpn_authorization_rule.html.markdown,r/ec2_carrier_gateway.html.markdown,r/ec2_capacity_reservation.html.markdown,r/ec2_availability_zone_group.html.markdown,r/ebs_volume.html.markdown,r/ebs_snapshot_import.html.markdown,r/ebs_snapshot_copy.html.markdown,r/ebs_snapshot.html.markdown,r/ebs_fast_snapshot_restore.html.markdown,r/ebs_encryption_by_default.html.markdown,r/ebs_default_kms_key.html.markdown,r/dynamodb_tag.html.markdown,r/dynamodb_table_replica.html.markdown,r/dynamodb_table_item.html.markdown,r/dynamodb_table_export.html.markdown,r/dynamodb_table.html.markdown,r/dynamodb_resource_policy.html.markdown,r/dynamodb_kinesis_streaming_destination.html.markdown,r/dynamodb_global_table.html.markdown,r/dynamodb_contributor_insights.html.markdown,r/dx_transit_virtual_interface.html.markdown,r/dx_public_virtual_interface.html.markdown,r/dx_private_virtual_interface.html.markdown,r/dx_macsec_key_association.html.markdown,r/dx_lag.html.markdown,r/dx_hosted_transit_virtual_interface_accepter.html.markdown,r/dx_hosted_transit_virtual_interface.html.markdown,r/dx_hosted_public_virtual_interface_accepter.html.markdown,r/dx_hosted_public_virtual_interface.html.markdown,r/dx_hosted_private_virtual_interface_accepter.html.markdown,r/dx_hosted_private_virtual_interface.html.markdown,r/dx_hosted_connection.html.markdown,r/dx_gateway_association_proposal.html.markdown,r/dx_gateway_association.html.markdown,r/dx_gateway.html.markdown,r/dx_connection_confirmation.html.markdown,r/dx_connection_association.html.markdown,r/dx_connection.html.markdown,r/dx_bgp_peer.html.markdown,r/docdbelastic_cluster.html.markdown,r/docdb_subnet_group.html.markdown,r/docdb_global_cluster.html.markdown,r/docdb_event_subscription.html.markdown,r/docdb_cluster_snapshot.html.markdown,r/docdb_cluster_parameter_group.html.markdown,r/docdb_cluster_instance.html.markdown,r/docdb_cluster.html.markdown,r/dms_s3_endpoint.html.markdown,r/dms_replication_task.html.markdown,r/dms_replication_subnet_group.html.markdown,r/dms_replication_instance.html.markdown,r/dms_replication_config.html.markdown,r/dms_event_subscription.html.markdown,r/dms_endpoint.html.markdown,r/dms_certificate.html.markdown,r/dlm_lifecycle_policy.html.markdown,r/directory_service_trust.html.markdown,r/directory_service_shared_directory_accepter.html.markdown,r/directory_service_shared_directory.html.markdown,r/directory_service_region.html.markdown,r/directory_service_radius_settings.html.markdown,r/directory_service_log_subscription.html.markdown,r/directory_service_directory.html.markdown,r/directory_service_conditional_forwarder.html.markdown,r/devopsguru_service_integration.html.markdown,r/devopsguru_resource_collection.html.markdown,r/devopsguru_notification_channel.html.markdown,r/devopsguru_event_sources_config.html.markdown,r/devicefarm_upload.html.markdown,r/devicefarm_test_grid_project.html.markdown,r/devicefarm_project.html.markdown,r/devicefarm_network_profile.html.markdown,r/devicefarm_instance_profile.html.markdown,r/devicefarm_device_pool.html.markdown,r/detective_organization_configuration.html.markdown,r/detective_organization_admin_account.html.markdown,r/detective_member.html.markdown,r/detective_invitation_accepter.html.markdown,r/detective_graph.html.markdown,r/default_vpc_dhcp_options.html.markdown,r/default_vpc.html.markdown,r/default_subnet.html.markdown,r/default_security_group.html.markdown,r/default_route_table.html.markdown,r/default_network_acl.html.markdown,r/db_subnet_group.html.markdown,r/db_snapshot_copy.html.markdown,r/db_snapshot.html.markdown,r/db_proxy_target.html.markdown,r/db_proxy_endpoint.html.markdown,r/db_proxy_default_target_group.html.markdown,r/db_proxy.html.markdown,r/db_parameter_group.html.markdown,r/db_option_group.html.markdown,r/db_instance_role_association.html.markdown,r/db_instance_automated_backups_replication.html.markdown,r/db_instance.html.markdown,r/db_event_subscription.html.markdown,r/db_cluster_snapshot.html.markdown,r/dax_subnet_group.html.markdown,r/dax_parameter_group.html.markdown,r/dax_cluster.html.markdown,r/datasync_task.html.markdown,r/datasync_location_smb.html.markdown,r/datasync_location_s3.html.markdown,r/datasync_location_object_storage.html.markdown,r/datasync_location_nfs.html.markdown,r/datasync_location_hdfs.html.markdown,r/datasync_location_fsx_windows_file_system.html.markdown,r/datasync_location_fsx_openzfs_file_system.html.markdown,r/datasync_location_fsx_ontap_file_system.html.markdown,r/datasync_location_fsx_lustre_file_system.html.markdown,r/datasync_location_efs.html.markdown,r/datasync_location_azure_blob.html.markdown,r/datasync_agent.html.markdown,r/datapipeline_pipeline_definition.html.markdown,r/datapipeline_pipeline.html.markdown,r/dataexchange_revision.html.markdown,r/dataexchange_data_set.html.markdown,r/customerprofiles_profile.html.markdown,r/customerprofiles_domain.html.markdown,r/customer_gateway.html.markdown,r/cur_report_definition.html.markdown,r/controltower_landing_zone.html.markdown,r/controltower_control.html.markdown,r/connect_vocabulary.html.markdown,r/connect_user_hierarchy_structure.html.markdown,r/connect_user_hierarchy_group.html.markdown,r/connect_user.html.markdown,r/connect_security_profile.html.markdown,r/connect_routing_profile.html.markdown,r/connect_quick_connect.html.markdown,r/connect_queue.html.markdown,r/connect_phone_number.html.markdown,r/connect_lambda_function_association.html.markdown,r/connect_instance_storage_config.html.markdown,r/connect_instance.html.markdown,r/connect_hours_of_operation.html.markdown,r/connect_contact_flow_module.html.markdown,r/connect_contact_flow.html.markdown,r/connect_bot_association.html.markdown,r/config_retention_configuration.html.markdown,r/config_remediation_configuration.html.markdown,r/config_organization_managed_rule.html.markdown,r/config_organization_custom_rule.html.markdown,r/config_organization_custom_policy_rule.html.markdown,r/config_organization_conformance_pack.html.markdown,r/config_delivery_channel.html.markdown,r/config_conformance_pack.html.markdown,r/config_configuration_recorder_status.html.markdown,r/config_configuration_recorder.html.markdown,r/config_configuration_aggregator.html.markdown,r/config_config_rule.html.markdown,r/config_aggregate_authorization.html.markdown,r/comprehend_entity_recognizer.html.markdown,r/comprehend_document_classifier.html.markdown,r/cognito_user_pool_ui_customization.html.markdown,r/cognito_user_pool_domain.html.markdown,r/cognito_user_pool_client.html.markdown,r/cognito_user_pool.html.markdown,r/cognito_user_in_group.html.markdown,r/cognito_user_group.html.markdown,r/cognito_user.html.markdown,r/cognito_risk_configuration.html.markdown,r/cognito_resource_server.html.markdown,r/cognito_managed_user_pool_client.html.markdown,r/cognito_identity_provider.html.markdown,r/cognito_identity_pool_roles_attachment.html.markdown,r/cognito_identity_pool_provider_principal_tag.html.markdown,r/cognito_identity_pool.html.markdown,r/codestarnotifications_notification_rule.html.markdown,r/codestarconnections_host.html.markdown,r/codestarconnections_connection.html.markdown,r/codepipeline_webhook.html.markdown,r/codepipeline_custom_action_type.html.markdown,r/codepipeline.html.markdown,r/codegurureviewer_repository_association.html.markdown,r/codeguruprofiler_profiling_group.html.markdown,r/codedeploy_deployment_group.html.markdown,r/codedeploy_deployment_config.html.markdown,r/codedeploy_app.html.markdown,r/codecommit_trigger.html.markdown,r/codecommit_repository.html.markdown,r/codecommit_approval_rule_template_association.html.markdown,r/codecommit_approval_rule_template.html.markdown,r/codecatalyst_source_repository.html.markdown,r/codecatalyst_project.html.markdown,r/codecatalyst_dev_environment.html.markdown,r/codebuild_webhook.html.markdown,r/codebuild_source_credential.html.markdown,r/codebuild_resource_policy.html.markdown,r/codebuild_report_group.html.markdown,r/codebuild_project.html.markdown,r/codeartifact_repository_permissions_policy.html.markdown,r/codeartifact_repository.html.markdown,r/codeartifact_domain_permissions_policy.html.markdown,r/codeartifact_domain.html.markdown,r/cloudwatch_query_definition.html.markdown,r/cloudwatch_metric_stream.html.markdown,r/cloudwatch_metric_alarm.html.markdown,r/cloudwatch_log_subscription_filter.html.markdown,r/cloudwatch_log_stream.html.markdown,r/cloudwatch_log_resource_policy.html.markdown,r/cloudwatch_log_metric_filter.html.markdown,r/cloudwatch_log_group.html.markdown,r/cloudwatch_log_destination_policy.html.markdown,r/cloudwatch_log_destination.html.markdown,r/cloudwatch_log_data_protection_policy.html.markdown,r/cloudwatch_event_target.html.markdown,r/cloudwatch_event_rule.html.markdown,r/cloudwatch_event_permission.html.markdown,r/cloudwatch_event_endpoint.html.markdown,r/cloudwatch_event_connection.html.markdown,r/cloudwatch_event_bus_policy.html.markdown,r/cloudwatch_event_bus.html.markdown,r/cloudwatch_event_archive.html.markdown,r/cloudwatch_event_api_destination.html.markdown,r/cloudwatch_dashboard.html.markdown,r/cloudwatch_composite_alarm.html.markdown,r/cloudtrail_event_data_store.html.markdown,r/cloudtrail.html.markdown,r/cloudsearch_domain_service_access_policy.html.markdown,r/cloudsearch_domain.html.markdown,r/cloudhsm_v2_hsm.html.markdown,r/cloudhsm_v2_cluster.html.markdown,r/cloudfrontkeyvaluestore_key.html.markdown,r/cloudfront_response_headers_policy.html.markdown,r/cloudfront_realtime_log_config.html.markdown,r/cloudfront_public_key.html.markdown,r/cloudfront_origin_request_policy.html.markdown,r/cloudfront_origin_access_identity.html.markdown,r/cloudfront_origin_access_control.html.markdown,r/cloudfront_monitoring_subscription.html.markdown,r/cloudfront_key_value_store.html.markdown,r/cloudfront_key_group.html.markdown,r/cloudfront_function.html.markdown,r/cloudfront_field_level_encryption_profile.html.markdown,r/cloudfront_field_level_encryption_config.html.markdown,r/cloudfront_distribution.html.markdown,r/cloudfront_continuous_deployment_policy.html.markdown,r/cloudfront_cache_policy.html.markdown,r/cloudformation_type.html.markdown,r/cloudformation_stack_set_instance.html.markdown,r/cloudformation_stack_set.html.markdown,r/cloudformation_stack.html.markdown,r/cloudcontrolapi_resource.html.markdown,r/cloud9_environment_membership.html.markdown,r/cloud9_environment_ec2.html.markdown,r/cleanrooms_configured_table.html.markdown,r/cleanrooms_collaboration.html.markdown,r/chimesdkvoice_voice_profile_domain.html.markdown,r/chimesdkvoice_sip_rule.html.markdown,r/chimesdkvoice_sip_media_application.html.markdown,r/chimesdkvoice_global_settings.html.markdown,r/chimesdkmediapipelines_media_insights_pipeline_configuration.html.markdown,r/chime_voice_connector_termination_credentials.html.markdown,r/chime_voice_connector_termination.html.markdown,r/chime_voice_connector_streaming.html.markdown,r/chime_voice_connector_origination.html.markdown,r/chime_voice_connector_logging.html.markdown,r/chime_voice_connector_group.html.markdown,r/chime_voice_connector.html.markdown,r/ce_cost_category.html.markdown,r/ce_cost_allocation_tag.html.markdown,r/ce_anomaly_subscription.html.markdown,r/ce_anomaly_monitor.html.markdown,r/budgets_budget_action.html.markdown,r/budgets_budget.html.markdown,r/bedrockagent_agent_alias.html.markdown,r/bedrockagent_agent_action_group.html.markdown,r/bedrockagent_agent.html.markdown,r/bedrock_provisioned_model_throughput.html.markdown,r/bedrock_model_invocation_logging_configuration.html.markdown,r/bedrock_custom_model.html.markdown,r/batch_scheduling_policy.html.markdown,r/batch_job_queue.html.markdown,r/batch_job_definition.html.markdown,r/batch_compute_environment.html.markdown,r/backup_vault_policy.html.markdown,r/backup_vault_notifications.html.markdown,r/backup_vault_lock_configuration.html.markdown,r/backup_vault.html.markdown,r/backup_selection.html.markdown,r/backup_report_plan.html.markdown,r/backup_region_settings.html.markdown,r/backup_plan.html.markdown,r/backup_global_settings.html.markdown,r/backup_framework.html.markdown,r/autoscalingplans_scaling_plan.html.markdown,r/autoscaling_traffic_source_attachment.html.markdown,r/autoscaling_schedule.html.markdown,r/autoscaling_policy.html.markdown,r/autoscaling_notification.html.markdown,r/autoscaling_lifecycle_hook.html.markdown,r/autoscaling_group_tag.html.markdown,r/autoscaling_group.html.markdown,r/autoscaling_attachment.html.markdown,r/auditmanager_organization_admin_account_registration.html.markdown,r/auditmanager_framework_share.html.markdown,r/auditmanager_framework.html.markdown,r/auditmanager_control.html.markdown,r/auditmanager_assessment_report.html.markdown,r/auditmanager_assessment_delegation.html.markdown,r/auditmanager_assessment.html.markdown,r/auditmanager_account_registration.html.markdown,r/athena_workgroup.html.markdown,r/athena_prepared_statement.html.markdown,r/athena_named_query.html.markdown,r/athena_database.html.markdown,r/athena_data_catalog.html.markdown,r/appsync_type.html.markdown,r/appsync_resolver.html.markdown,r/appsync_graphql_api.html.markdown,r/appsync_function.html.markdown,r/appsync_domain_name_api_association.html.markdown,r/appsync_domain_name.html.markdown,r/appsync_datasource.html.markdown,r/appsync_api_key.html.markdown,r/appsync_api_cache.html.markdown,r/appstream_user_stack_association.html.markdown,r/appstream_user.html.markdown,r/appstream_stack.html.markdown,r/appstream_image_builder.html.markdown,r/appstream_fleet_stack_association.html.markdown,r/appstream_fleet.html.markdown,r/appstream_directory_config.html.markdown,r/apprunner_vpc_ingress_connection.html.markdown,r/apprunner_vpc_connector.html.markdown,r/apprunner_service.html.markdown,r/apprunner_observability_configuration.html.markdown,r/apprunner_deployment.html.markdown,r/apprunner_default_auto_scaling_configuration_version.html.markdown,r/apprunner_custom_domain_association.html.markdown,r/apprunner_connection.html.markdown,r/apprunner_auto_scaling_configuration_version.html.markdown,r/appmesh_virtual_service.html.markdown,r/appmesh_virtual_router.html.markdown,r/appmesh_virtual_node.html.markdown,r/appmesh_virtual_gateway.html.markdown,r/appmesh_route.html.markdown,r/appmesh_mesh.html.markdown,r/appmesh_gateway_route.html.markdown,r/applicationinsights_application.html.markdown,r/appintegrations_event_integration.html.markdown,r/appintegrations_data_integration.html.markdown,r/appflow_flow.html.markdown,r/appflow_connector_profile.html.markdown,r/appconfig_hosted_configuration_version.html.markdown,r/appconfig_extension_association.html.markdown,r/appconfig_extension.html.markdown,r/appconfig_environment.html.markdown,r/appconfig_deployment_strategy.html.markdown,r/appconfig_deployment.html.markdown,r/appconfig_configuration_profile.html.markdown,r/appconfig_application.html.markdown,r/appautoscaling_target.html.markdown,r/appautoscaling_scheduled_action.html.markdown,r/appautoscaling_policy.html.markdown,r/app_cookie_stickiness_policy.html.markdown,r/apigatewayv2_vpc_link.html.markdown,r/apigatewayv2_stage.html.markdown,r/apigatewayv2_route_response.html.markdown,r/apigatewayv2_route.html.markdown,r/apigatewayv2_model.html.markdown,r/apigatewayv2_integration_response.html.markdown,r/apigatewayv2_integration.html.markdown,r/apigatewayv2_domain_name.html.markdown,r/apigatewayv2_deployment.html.markdown,r/apigatewayv2_authorizer.html.markdown,r/apigatewayv2_api_mapping.html.markdown,r/apigatewayv2_api.html.markdown,r/api_gateway_vpc_link.html.markdown,r/api_gateway_usage_plan_key.html.markdown,r/api_gateway_usage_plan.html.markdown,r/api_gateway_stage.html.markdown,r/api_gateway_rest_api_policy.html.markdown,r/api_gateway_rest_api.html.markdown,r/api_gateway_resource.html.markdown,r/api_gateway_request_validator.html.markdown,r/api_gateway_model.html.markdown,r/api_gateway_method_settings.html.markdown,r/api_gateway_method_response.html.markdown,r/api_gateway_method.html.markdown,r/api_gateway_integration_response.html.markdown,r/api_gateway_integration.html.markdown,r/api_gateway_gateway_response.html.markdown,r/api_gateway_domain_name.html.markdown,r/api_gateway_documentation_version.html.markdown,r/api_gateway_documentation_part.html.markdown,r/api_gateway_deployment.html.markdown,r/api_gateway_client_certificate.html.markdown,r/api_gateway_base_path_mapping.html.markdown,r/api_gateway_authorizer.html.markdown,r/api_gateway_api_key.html.markdown,r/api_gateway_account.html.markdown,r/amplify_webhook.html.markdown,r/amplify_domain_association.html.markdown,r/amplify_branch.html.markdown,r/amplify_backend_environment.html.markdown,r/amplify_app.html.markdown,r/ami_launch_permission.html.markdown,r/ami_from_instance.html.markdown,r/ami_copy.html.markdown,r/ami.html.markdown,r/acmpca_policy.html.markdown,r/acmpca_permission.html.markdown,r/acmpca_certificate_authority_certificate.html.markdown,r/acmpca_certificate_authority.html.markdown,r/acmpca_certificate.html.markdown,r/acm_certificate_validation.html.markdown,r/acm_certificate.html.markdown,r/account_region.markdown,r/account_primary_contact.html.markdown,r/account_alternate_contact.html.markdown,r/accessanalyzer_archive_rule.html.markdown,r/accessanalyzer_analyzer.html.markdown,guides/version-5-upgrade.html.markdown,guides/version-4-upgrade.html.markdown,guides/version-3-upgrade.html.markdown,guides/version-2-upgrade.html.markdown,guides/using-aws-with-awscc-provider.html.markdown,guides/resource-tagging.html.markdown,guides/custom-service-endpoints.html.markdown,guides/continuous-validation-examples.html.markdown,functions/trim_iam_role_path.html.markdown,functions/arn_parse.html.markdown,functions/arn_build.html.markdown,d/workspaces_workspace.html.markdown,d/workspaces_image.html.markdown,d/workspaces_directory.html.markdown,d/workspaces_bundle.html.markdown,d/wafv2_web_acl.html.markdown,d/wafv2_rule_group.html.markdown,d/wafv2_regex_pattern_set.html.markdown,d/wafv2_ip_set.html.markdown,d/wafregional_web_acl.html.markdown,d/wafregional_subscribed_rule_group.html.markdown,d/wafregional_rule.html.markdown,d/wafregional_rate_based_rule.html.markdown,d/wafregional_ipset.html.markdown,d/waf_web_acl.html.markdown,d/waf_subscribed_rule_group.html.markdown,d/waf_rule.html.markdown,d/waf_rate_based_rule.html.markdown,d/waf_ipset.html.markdown,d/vpn_gateway.html.markdown,d/vpcs.html.markdown,d/vpclattice_service_network.html.markdown,d/vpclattice_service.html.markdown,d/vpclattice_resource_policy.html.markdown,d/vpclattice_listener.html.markdown,d/vpclattice_auth_policy.html.markdown,d/vpc_security_group_rules.html.markdown,d/vpc_security_group_rule.html.markdown,d/vpc_peering_connections.html.markdown,d/vpc_peering_connection.html.markdown,d/vpc_ipam_preview_next_cidr.html.markdown,d/vpc_ipam_pools.html.markdown,d/vpc_ipam_pool_cidrs.html.markdown,d/vpc_ipam_pool.html.markdown,d/vpc_endpoint_service.html.markdown,d/vpc_endpoint.html.markdown,d/vpc_dhcp_options.html.markdown,d/vpc.html.markdown,d/verifiedpermissions_policy_store.html.markdown,d/transfer_server.html.markdown,d/subnets.html.markdown,d/subnet.html.markdown,d/storagegateway_local_disk.html.markdown,d/ssoadmin_principal_application_assignments.html.markdown,d/ssoadmin_permission_set.html.markdown,d/ssoadmin_instances.html.markdown,d/ssoadmin_application_providers.html.markdown,d/ssoadmin_application_assignments.html.markdown,d/ssoadmin_application.html.markdown,d/ssmincidents_response_plan.html.markdown,d/ssmincidents_replication_set.html.markdown,d/ssmcontacts_rotation.html.markdown,d/ssmcontacts_plan.html.markdown,d/ssmcontacts_contact_channel.html.markdown,d/ssmcontacts_contact.html.markdown,d/ssm_patch_baseline.html.markdown,d/ssm_parameters_by_path.html.markdown,d/ssm_parameter.html.markdown,d/ssm_maintenance_windows.html.markdown,d/ssm_instances.html.markdown,d/ssm_document.html.markdown,d/sqs_queues.html.markdown,d/sqs_queue.html.markdown,d/sns_topic.html.markdown,d/signer_signing_profile.html.markdown,d/signer_signing_job.html.markdown,d/sfn_state_machine_versions.html.markdown,d/sfn_state_machine.html.markdown,d/sfn_alias.html.markdown,d/sfn_activity.html.markdown,d/sesv2_email_identity_mail_from_attributes.html.markdown,d/sesv2_email_identity.html.markdown,d/sesv2_dedicated_ip_pool.html.markdown,d/sesv2_configuration_set.html.markdown,d/ses_email_identity.html.markdown,d/ses_domain_identity.html.markdown,d/ses_active_receipt_rule_set.html.markdown,d/servicequotas_templates.html.markdown,d/servicequotas_service_quota.html.markdown,d/servicequotas_service.html.markdown,d/servicecatalogappregistry_application.html.markdown,d/servicecatalog_provisioning_artifacts.html.markdown,d/servicecatalog_product.html.markdown,d/servicecatalog_portfolio_constraints.html.markdown,d/servicecatalog_portfolio.html.markdown,d/servicecatalog_launch_paths.html.markdown,d/servicecatalog_constraint.html.markdown,d/service_discovery_service.html.markdown,d/service_discovery_http_namespace.html.markdown,d/service_discovery_dns_namespace.html.markdown,d/service.html.markdown,d/serverlessapplicationrepository_application.html.markdown,d/security_groups.html.markdown,d/security_group.html.markdown,d/secretsmanager_secrets.html.markdown,d/secretsmanager_secret_version.html.markdown,d/secretsmanager_secret_rotation.html.markdown,d/secretsmanager_secret.html.markdown,d/secretsmanager_random_password.html.markdown,d/sagemaker_prebuilt_ecr_image.html.markdown,d/s3control_multi_region_access_point.html.markdown,d/s3_objects.html.markdown,d/s3_object.html.markdown,d/s3_directory_buckets.html.markdown,d/s3_bucket_policy.html.markdown,d/s3_bucket_objects.html.markdown,d/s3_bucket_object.html.markdown,d/s3_bucket.html.markdown,d/s3_account_public_access_block.html.markdown,d/route_tables.html.markdown,d/route_table.html.markdown,d/route53_zone.html.markdown,d/route53_traffic_policy_document.html.markdown,d/route53_resolver_rules.html.markdown,d/route53_resolver_rule.html.markdown,d/route53_resolver_query_log_config.html.markdown,d/route53_resolver_firewall_rules.html.markdown,d/route53_resolver_firewall_rule_group_association.html.markdown,d/route53_resolver_firewall_rule_group.html.markdown,d/route53_resolver_firewall_domain_list.html.markdown,d/route53_resolver_firewall_config.html.markdown,d/route53_resolver_endpoint.html.markdown,d/route53_delegation_set.html.markdown,d/route.html.markdown,d/resourcegroupstaggingapi_resources.html.markdown,d/resourceexplorer2_search.html.markdown,d/regions.html.markdown,d/region.html.markdown,d/redshiftserverless_workgroup.html.markdown,d/redshiftserverless_namespace.html.markdown,d/redshiftserverless_credentials.html.markdown,d/redshift_subnet_group.html.markdown,d/redshift_service_account.html.markdown,d/redshift_producer_data_shares.html.markdown,d/redshift_orderable_cluster.html.markdown,d/redshift_data_shares.html.markdown,d/redshift_cluster_credentials.html.markdown,d/redshift_cluster.html.markdown,d/rds_reserved_instance_offering.html.markdown,d/rds_orderable_db_instance.html.markdown,d/rds_engine_version.html.markdown,d/rds_clusters.html.markdown,d/rds_cluster.html.markdown,d/rds_certificate.html.markdown,d/ram_resource_share.html.markdown,d/quicksight_user.html.markdown,d/quicksight_theme.html.markdown,d/quicksight_group.html.markdown,d/quicksight_data_set.html.markdown,d/qldb_ledger.html.markdown,d/prometheus_workspaces.html.markdown,d/prometheus_workspace.html.markdown,d/pricing_product.html.markdown,d/prefix_list.html.markdown,d/polly_voices.html.markdown,d/partition.html.markdown,d/outposts_sites.html.markdown,d/outposts_site.html.markdown,d/outposts_outposts.html.markdown,d/outposts_outpost_instance_types.html.markdown,d/outposts_outpost_instance_type.html.markdown,d/outposts_outpost.html.markdown,d/outposts_assets.html.markdown,d/outposts_asset.html.markdown,d/organizations_resource_tags.html.markdown,d/organizations_policy.html.markdown,d/organizations_policies_for_target.html.markdown,d/organizations_policies.html.markdown,d/organizations_organizational_units.html.markdown,d/organizations_organizational_unit_descendant_accounts.html.markdown,d/organizations_organizational_unit_child_accounts.html.markdown,d/organizations_organizational_unit.html.markdown,d/organizations_organization.html.markdown,d/organizations_delegated_services.html.markdown,d/organizations_delegated_administrators.html.markdown,d/opensearchserverless_vpc_endpoint.html.markdown,d/opensearchserverless_security_policy.html.markdown,d/opensearchserverless_security_config.html.markdown,d/opensearchserverless_lifecycle_policy.html.markdown,d/opensearchserverless_collection.html.markdown,d/opensearchserverless_access_policy.html.markdown,d/opensearch_domain.html.markdown,d/oam_sinks.html.markdown,d/oam_sink.html.markdown,d/oam_links.html.markdown,d/oam_link.html.markdown,d/networkmanager_sites.html.markdown,d/networkmanager_site.html.markdown,d/networkmanager_links.html.markdown,d/networkmanager_link.html.markdown,d/networkmanager_global_networks.html.markdown,d/networkmanager_global_network.html.markdown,d/networkmanager_devices.html.markdown,d/networkmanager_device.html.markdown,d/networkmanager_core_network_policy_document.html.markdown,d/networkmanager_connections.html.markdown,d/networkmanager_connection.html.markdown,d/networkfirewall_resource_policy.html.markdown,d/networkfirewall_firewall_policy.html.markdown,d/networkfirewall_firewall.html.markdown,d/network_interfaces.html.markdown,d/network_interface.html.markdown,d/network_acls.html.markdown,d/neptune_orderable_db_instance.html.markdown,d/neptune_engine_version.html.markdown,d/nat_gateways.html.markdown,d/nat_gateway.html.markdown,d/mskconnect_worker_configuration.html.markdown,d/mskconnect_custom_plugin.html.markdown,d/mskconnect_connector.html.markdown,d/msk_vpc_connection.html.markdown,d/msk_kafka_version.html.markdown,d/msk_configuration.html.markdown,d/msk_cluster.html.markdown,d/msk_broker_nodes.html.markdown,d/msk_bootstrap_brokers.html.markdown,d/mq_broker_instance_type_offerings.html.markdown,d/mq_broker_engine_types.html.markdown,d/mq_broker.html.markdown,d/memorydb_user.html.markdown,d/memorydb_subnet_group.html.markdown,d/memorydb_snapshot.html.markdown,d/memorydb_parameter_group.html.markdown,d/memorydb_cluster.html.markdown,d/memorydb_acl.html.markdown,d/medialive_input.html.markdown,d/media_convert_queue.html.markdown,d/location_tracker_associations.html.markdown,d/location_tracker_association.html.markdown,d/location_tracker.html.markdown,d/location_route_calculator.html.markdown,d/location_place_index.html.markdown,d/location_map.html.markdown,d/location_geofence_collection.html.markdown,d/licensemanager_received_licenses.html.markdown,d/licensemanager_received_license.html.markdown,d/licensemanager_grants.html.markdown,d/lex_slot_type.html.markdown,d/lex_intent.html.markdown,d/lex_bot_alias.html.markdown,d/lex_bot.html.markdown,d/lbs.html.markdown,d/lb_trust_store.html.markdown,d/lb_target_group.html.markdown,d/lb_listener.html.markdown,d/lb_hosted_zone_id.html.markdown,d/lb.html.markdown,d/launch_template.html.markdown,d/launch_configuration.html.markdown,d/lambda_layer_version.html.markdown,d/lambda_invocation.html.markdown,d/lambda_functions.html.markdown,d/lambda_function_url.html.markdown,d/lambda_function.html.markdown,d/lambda_code_signing_config.html.markdown,d/lambda_alias.html.markdown,d/lakeformation_resource.html.markdown,d/lakeformation_permissions.html.markdown,d/lakeformation_data_lake_settings.html.markdown,d/kms_secrets.html.markdown,d/kms_secret.html.markdown,d/kms_public_key.html.markdown,d/kms_key.html.markdown,d/kms_custom_key_store.html.markdown,d/kms_ciphertext.html.markdown,d/kms_alias.html.markdown,d/kinesis_stream_consumer.html.markdown,d/kinesis_stream.html.markdown,d/kinesis_firehose_delivery_stream.html.markdown,d/key_pair.html.markdown,d/kendra_thesaurus.html.markdown,d/kendra_query_suggestions_block_list.html.markdown,d/kendra_index.html.markdown,d/kendra_faq.html.markdown,d/kendra_experience.html.markdown,d/ivs_stream_key.html.markdown,d/ip_ranges.html.markdown,d/iot_registration_code.html.markdown,d/iot_endpoint.html.markdown,d/internet_gateway.html.markdown,d/instances.html.markdown,d/instance.html.markdown,d/inspector_rules_packages.html.markdown,d/imagebuilder_infrastructure_configurations.html.markdown,d/imagebuilder_infrastructure_configuration.html.markdown,d/imagebuilder_image_recipes.html.markdown,d/imagebuilder_image_recipe.html.markdown,d/imagebuilder_image_pipelines.html.markdown,d/imagebuilder_image_pipeline.html.markdown,d/imagebuilder_image.html.markdown,d/imagebuilder_distribution_configurations.html.markdown,d/imagebuilder_distribution_configuration.html.markdown,d/imagebuilder_container_recipes.html.markdown,d/imagebuilder_container_recipe.html.markdown,d/imagebuilder_components.html.markdown,d/imagebuilder_component.html.markdown,d/identitystore_user.html.markdown,d/identitystore_groups.html.markdown,d/identitystore_group.html.markdown,d/iam_users.html.markdown,d/iam_user_ssh_key.html.markdown,d/iam_user.html.markdown,d/iam_session_context.html.markdown,d/iam_server_certificate.html.markdown,d/iam_saml_provider.html.markdown,d/iam_roles.html.markdown,d/iam_role.html.markdown,d/iam_principal_policy_simulation.html.markdown,d/iam_policy_document.html.markdown,d/iam_policy.html.markdown,d/iam_openid_connect_provider.html.markdown,d/iam_instance_profiles.html.markdown,d/iam_instance_profile.html.markdown,d/iam_group.html.markdown,d/iam_account_alias.html.markdown,d/iam_access_keys.html.markdown,d/guardduty_finding_ids.html.markdown,d/guardduty_detector.html.markdown,d/grafana_workspace.html.markdown,d/glue_script.html.markdown,d/glue_data_catalog_encryption_settings.html.markdown,d/glue_connection.html.markdown,d/glue_catalog_table.html.markdown,d/globalaccelerator_custom_routing_accelerator.html.markdown,d/globalaccelerator_accelerator.html.markdown,d/fsx_windows_file_system.html.markdown,d/fsx_openzfs_snapshot.html.markdown,d/fsx_ontap_storage_virtual_machines.html.markdown,d/fsx_ontap_storage_virtual_machine.html.markdown,d/fsx_ontap_file_system.html.markdown,d/emrcontainers_virtual_cluster.html.markdown,d/emr_supported_instance_types.html.markdown,d/emr_release_labels.html.markdown,d/elb_service_account.html.markdown,d/elb_hosted_zone_id.html.markdown,d/elb.html.markdown,d/elasticsearch_domain.html.markdown,d/elasticache_user.html.markdown,d/elasticache_subnet_group.html.markdown,d/elasticache_replication_group.html.markdown,d/elasticache_cluster.html.markdown,d/elastic_beanstalk_solution_stack.html.markdown,d/elastic_beanstalk_hosted_zone.html.markdown,d/elastic_beanstalk_application.html.markdown,d/eks_node_groups.html.markdown,d/eks_node_group.html.markdown,d/eks_clusters.html.markdown,d/eks_cluster_auth.html.markdown,d/eks_cluster.html.markdown,d/eks_addon_version.html.markdown,d/eks_addon.html.markdown,d/eks_access_entry.html.markdown,d/eips.html.markdown,d/eip.html.markdown,d/efs_mount_target.html.markdown,d/efs_file_system.html.markdown,d/efs_access_points.html.markdown,d/efs_access_point.html.markdown,d/ecs_task_execution.html.markdown,d/ecs_task_definition.html.markdown,d/ecs_service.html.markdown,d/ecs_container_definition.html.markdown,d/ecs_cluster.html.markdown,d/ecrpublic_authorization_token.html.markdown,d/ecr_repository.html.markdown,d/ecr_repositories.html.markdown,d/ecr_pull_through_cache_rule.html.markdown,d/ecr_lifecycle_policy_document.html.markdown,d/ecr_image.html.markdown,d/ecr_authorization_token.html.markdown,d/ec2_transit_gateway_vpn_attachment.html.markdown,d/ec2_transit_gateway_vpc_attachments.html.markdown,d/ec2_transit_gateway_vpc_attachment.html.markdown,d/ec2_transit_gateway_route_tables.html.markdown,d/ec2_transit_gateway_route_table_routes.html.markdown,d/ec2_transit_gateway_route_table_propagations.html.markdown,d/ec2_transit_gateway_route_table_associations.html.markdown,d/ec2_transit_gateway_route_table.html.markdown,d/ec2_transit_gateway_peering_attachment.html.markdown,d/ec2_transit_gateway_multicast_domain.html.markdown,d/ec2_transit_gateway_dx_gateway_attachment.html.markdown,d/ec2_transit_gateway_connect_peer.html.markdown,d/ec2_transit_gateway_connect.html.markdown,d/ec2_transit_gateway_attachments.html.markdown,d/ec2_transit_gateway_attachment.html.markdown,d/ec2_transit_gateway.html.markdown,d/ec2_spot_price.html.markdown,d/ec2_serial_console_access.html.markdown,d/ec2_public_ipv4_pools.html.markdown,d/ec2_public_ipv4_pool.html.markdown,d/ec2_network_insights_path.html.markdown,d/ec2_network_insights_analysis.html.markdown,d/ec2_managed_prefix_lists.html.markdown,d/ec2_managed_prefix_list.html.markdown,d/ec2_local_gateways.html.markdown,d/ec2_local_gateway_virtual_interface_groups.html.markdown,d/ec2_local_gateway_virtual_interface_group.html.markdown,d/ec2_local_gateway_virtual_interface.html.markdown,d/ec2_local_gateway_route_tables.html.markdown,d/ec2_local_gateway_route_table.html.markdown,d/ec2_local_gateway.html.markdown,d/ec2_instance_types.html.markdown,d/ec2_instance_type_offerings.html.markdown,d/ec2_instance_type_offering.html.markdown,d/ec2_instance_type.html.markdown,d/ec2_host.html.markdown,d/ec2_coip_pools.html.markdown,d/ec2_coip_pool.html.markdown,d/ec2_client_vpn_endpoint.html.markdown,d/ebs_volumes.html.markdown,d/ebs_volume.html.markdown,d/ebs_snapshot_ids.html.markdown,d/ebs_snapshot.html.markdown,d/ebs_encryption_by_default.html.markdown,d/ebs_default_kms_key.html.markdown,d/dynamodb_table_item.html.markdown,d/dynamodb_table.html.markdown,d/dx_router_configuration.html.markdown,d/dx_locations.html.markdown,d/dx_location.html.markdown,d/dx_gateway.html.markdown,d/dx_connection.html.markdown,d/docdb_orderable_db_instance.html.markdown,d/docdb_engine_version.html.markdown,d/dms_replication_task.html.markdown,d/dms_replication_subnet_group.html.markdown,d/dms_replication_instance.html.markdown,d/dms_endpoint.html.markdown,d/dms_certificate.html.markdown,d/directory_service_directory.html.markdown,d/devopsguru_resource_collection.html.markdown,d/devopsguru_notification_channel.html.markdown,d/default_tags.html.markdown,d/db_subnet_group.html.markdown,d/db_snapshot.html.markdown,d/db_proxy.html.markdown,d/db_parameter_group.markdown,d/db_instances.html.markdown,d/db_instance.html.markdown,d/db_event_categories.html.markdown,d/db_cluster_snapshot.html.markdown,d/datapipeline_pipeline_definition.html.markdown,d/datapipeline_pipeline.html.markdown,d/customer_gateway.html.markdown,d/cur_report_definition.html.markdown,d/controltower_controls.html.markdown,d/connect_vocabulary.html.markdown,d/connect_user_hierarchy_structure.html.markdown,d/connect_user_hierarchy_group.html.markdown,d/connect_user.html.markdown,d/connect_security_profile.html.markdown,d/connect_routing_profile.html.markdown,d/connect_quick_connect.html.markdown,d/connect_queue.html.markdown,d/connect_prompt.html.markdown,d/connect_lambda_function_association.html.markdown,d/connect_instance_storage_config.html.markdown,d/connect_instance.html.markdown,d/connect_hours_of_operation.html.markdown,d/connect_contact_flow_module.html.markdown,d/connect_contact_flow.html.markdown,d/connect_bot_association.html.markdown,d/cognito_user_pools.html.markdown,d/cognito_user_pool_signing_certificate.html.markdown,d/cognito_user_pool_clients.html.markdown,d/cognito_user_pool_client.html.markdown,d/cognito_user_groups.html.markdown,d/cognito_user_group.html.markdown,d/cognito_identity_pool.html.markdown,d/codestarconnections_connection.html.markdown,d/codeguruprofiler_profiling_group.html.markdown,d/codecommit_repository.html.markdown,d/codecommit_approval_rule_template.html.markdown,d/codecatalyst_dev_environment.html.markdown,d/codeartifact_repository_endpoint.html.markdown,d/codeartifact_authorization_token.html.markdown,d/cloudwatch_log_groups.html.markdown,d/cloudwatch_log_group.html.markdown,d/cloudwatch_log_data_protection_policy_document.html.markdown,d/cloudwatch_event_source.html.markdown,d/cloudwatch_event_connection.html.markdown,d/cloudwatch_event_bus.html.markdown,d/cloudtrail_service_account.html.markdown,d/cloudhsm_v2_cluster.html.markdown,d/cloudfront_response_headers_policy.html.markdown,d/cloudfront_realtime_log_config.html.markdown,d/cloudfront_origin_request_policy.html.markdown,d/cloudfront_origin_access_identity.html.markdown,d/cloudfront_origin_access_identities.html.markdown,d/cloudfront_log_delivery_canonical_user_id.html.markdown,d/cloudfront_function.html.markdown,d/cloudfront_distribution.html.markdown,d/cloudfront_cache_policy.html.markdown,d/cloudformation_type.html.markdown,d/cloudformation_stack.html.markdown,d/cloudformation_export.html.markdown,d/cloudcontrolapi_resource.html.markdown,d/ce_tags.html.markdown,d/ce_cost_category.html.markdown,d/canonical_user_id.html.markdown,d/caller_identity.html.markdown,d/budgets_budget.html.markdown,d/billing_service_account.html.markdown,d/bedrock_foundation_models.html.markdown,d/bedrock_foundation_model.html.markdown,d/bedrock_custom_models.html.markdown,d/bedrock_custom_model.html.markdown,d/batch_scheduling_policy.html.markdown,d/batch_job_queue.html.markdown,d/batch_job_definition.html.markdown,d/batch_compute_environment.html.markdown,d/backup_vault.html.markdown,d/backup_selection.html.markdown,d/backup_report_plan.html.markdown,d/backup_plan.html.markdown,d/backup_framework.html.markdown,d/availability_zones.html.markdown,d/availability_zone.html.markdown,d/autoscaling_groups.html.markdown,d/autoscaling_group.html.markdown,d/auditmanager_framework.html.markdown,d/auditmanager_control.html.markdown,d/athena_named_query.html.markdown,d/arn.html.markdown,d/apprunner_hosted_zone_id.html.markdown,d/appmesh_virtual_service.html.markdown,d/appmesh_virtual_router.html.markdown,d/appmesh_virtual_node.html.markdown,d/appmesh_virtual_gateway.html.markdown,d/appmesh_route.html.markdown,d/appmesh_mesh.html.markdown,d/appmesh_gateway_route.html.markdown,d/appintegrations_event_integration.html.markdown,d/appconfig_environments.html.markdown,d/appconfig_environment.html.markdown,d/appconfig_configuration_profiles.html.markdown,d/appconfig_configuration_profile.html.markdown,d/apigatewayv2_vpc_link.html.markdown,d/apigatewayv2_export.html.markdown,d/apigatewayv2_apis.html.markdown,d/apigatewayv2_api.html.markdown,d/api_gateway_vpc_link.html.markdown,d/api_gateway_sdk.html.markdown,d/api_gateway_rest_api.html.markdown,d/api_gateway_resource.html.markdown,d/api_gateway_export.html.markdown,d/api_gateway_domain_name.html.markdown,d/api_gateway_authorizers.html.markdown,d/api_gateway_authorizer.html.markdown,d/api_gateway_api_key.html.markdown,d/ami_ids.html.markdown,d/ami.html.markdown,d/acmpca_certificate_authority.html.markdown,d/acmpca_certificate.html.markdown,d/acm_certificate.html.markdown --- website/docs/cdktf/python/d/eip.html.markdown | 9 +- .../cdktf/python/d/iam_policy.html.markdown | 3 +- .../d/identitystore_groups.html.markdown | 58 +++++ .../organizations_organization.html.markdown | 3 +- .../python/d/vpc_dhcp_options.html.markdown | 3 +- .../python/functions/arn_build.html.markdown | 4 +- .../python/functions/arn_parse.html.markdown | 4 +- .../trim_iam_role_path.html.markdown | 4 +- website/docs/cdktf/python/index.html.markdown | 4 +- .../cdktf/python/r/amplify_app.html.markdown | 4 +- .../python/r/autoscaling_group.html.markdown | 4 +- .../python/r/bedrockagent_agent.html.markdown | 182 +++++++++++++++ ...rockagent_agent_action_group.html.markdown | 129 +++++++++++ .../r/bedrockagent_agent_alias.html.markdown | 154 +++++++++++++ .../r/cloudwatch_event_rule.html.markdown | 3 +- .../python/r/codebuild_project.html.markdown | 14 +- .../r/dms_replication_task.html.markdown | 3 +- website/docs/cdktf/python/r/eip.html.markdown | 3 +- .../python/r/eip_domain_name.html.markdown | 71 ++++++ ...lasticache_replication_group.html.markdown | 8 +- .../r/fsx_openzfs_file_system.html.markdown | 3 +- .../cdktf/python/r/glue_job.html.markdown | 4 +- .../cdktf/python/r/iam_policy.html.markdown | 3 +- .../python/r/imagebuilder_image.html.markdown | 23 +- website/docs/cdktf/python/r/lb.html.markdown | 71 +++--- .../python/r/mwaa_environment.html.markdown | 4 +- .../r/organizations_account.html.markdown | 3 +- .../organizations_organization.html.markdown | 3 +- .../r/signer_signing_profile.html.markdown | 36 ++- .../python/r/transfer_connector.html.markdown | 3 +- .../verifiedpermissions_policy.html.markdown | 106 +++++++++ .../python/r/vpc_dhcp_options.html.markdown | 4 +- .../python/r/vpc_ipam_pool.html.markdown | 3 +- .../docs/cdktf/typescript/d/eip.html.markdown | 9 +- .../typescript/d/iam_policy.html.markdown | 3 +- .../d/identitystore_groups.html.markdown | 65 ++++++ .../organizations_organization.html.markdown | 3 +- .../d/vpc_dhcp_options.html.markdown | 3 +- .../functions/arn_build.html.markdown | 4 +- .../functions/arn_parse.html.markdown | 4 +- .../trim_iam_role_path.html.markdown | 4 +- .../docs/cdktf/typescript/index.html.markdown | 4 +- .../typescript/r/amplify_app.html.markdown | 4 +- .../r/autoscaling_group.html.markdown | 4 +- .../r/bedrockagent_agent.html.markdown | 209 ++++++++++++++++++ ...rockagent_agent_action_group.html.markdown | 143 ++++++++++++ .../r/bedrockagent_agent_alias.html.markdown | 192 ++++++++++++++++ .../r/cloudwatch_event_rule.html.markdown | 3 +- .../r/codebuild_project.html.markdown | 14 +- .../r/dms_replication_task.html.markdown | 3 +- .../docs/cdktf/typescript/r/eip.html.markdown | 3 +- .../r/eip_domain_name.html.markdown | 74 +++++++ ...lasticache_replication_group.html.markdown | 8 +- .../r/fsx_openzfs_file_system.html.markdown | 3 +- .../cdktf/typescript/r/glue_job.html.markdown | 4 +- .../typescript/r/iam_policy.html.markdown | 3 +- .../r/imagebuilder_image.html.markdown | 23 +- .../docs/cdktf/typescript/r/lb.html.markdown | 71 +++--- .../r/mwaa_environment.html.markdown | 4 +- .../r/organizations_account.html.markdown | 3 +- .../organizations_organization.html.markdown | 3 +- .../r/signer_signing_profile.html.markdown | 36 ++- .../r/transfer_connector.html.markdown | 3 +- .../verifiedpermissions_policy.html.markdown | 119 ++++++++++ .../r/vpc_dhcp_options.html.markdown | 4 +- .../typescript/r/vpc_ipam_pool.html.markdown | 3 +- 66 files changed, 1804 insertions(+), 164 deletions(-) create mode 100644 website/docs/cdktf/python/d/identitystore_groups.html.markdown create mode 100644 website/docs/cdktf/python/r/bedrockagent_agent.html.markdown create mode 100644 website/docs/cdktf/python/r/bedrockagent_agent_action_group.html.markdown create mode 100644 website/docs/cdktf/python/r/bedrockagent_agent_alias.html.markdown create mode 100644 website/docs/cdktf/python/r/eip_domain_name.html.markdown create mode 100644 website/docs/cdktf/python/r/verifiedpermissions_policy.html.markdown create mode 100644 website/docs/cdktf/typescript/d/identitystore_groups.html.markdown create mode 100644 website/docs/cdktf/typescript/r/bedrockagent_agent.html.markdown create mode 100644 website/docs/cdktf/typescript/r/bedrockagent_agent_action_group.html.markdown create mode 100644 website/docs/cdktf/typescript/r/bedrockagent_agent_alias.html.markdown create mode 100644 website/docs/cdktf/typescript/r/eip_domain_name.html.markdown create mode 100644 website/docs/cdktf/typescript/r/verifiedpermissions_policy.html.markdown diff --git a/website/docs/cdktf/python/d/eip.html.markdown b/website/docs/cdktf/python/d/eip.html.markdown index 5d39d00cf471..ac6264aadf53 100644 --- a/website/docs/cdktf/python/d/eip.html.markdown +++ b/website/docs/cdktf/python/d/eip.html.markdown @@ -112,6 +112,9 @@ Elastic IP whose data will be exported as attributes. This data source exports the following attributes in addition to the arguments above: * `association_id` - ID representing the association of the address with an instance in a VPC. +* `carrier_ip` - Carrier IP address. +* `customer_owned_ip` - Customer Owned IP. +* `customer_owned_ipv4_pool` - The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) * `domain` - Whether the address is for use in EC2-Classic (standard) or in a VPC (vpc). * `id` - If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address. * `instance_id` - ID of the instance that the address is associated with (if any). @@ -119,12 +122,10 @@ This data source exports the following attributes in addition to the arguments a * `network_interface_owner_id` - The ID of the AWS account that owns the network interface. * `private_ip` - Private IP address associated with the Elastic IP address. * `private_dns` - Private DNS associated with the Elastic IP address. +* `ptr_record` - The DNS pointer (PTR) record for the IP address. * `public_ip` - Public IP address of Elastic IP. * `public_dns` - Public DNS associated with the Elastic IP address. * `public_ipv4_pool` - ID of an address pool. -* `carrier_ip` - Carrier IP address. -* `customer_owned_ipv4_pool` - The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) -* `customer_owned_ip` - Customer Owned IP. * `tags` - Key-value map of tags associated with Elastic IP. ~> **Note:** The data source computes the `public_dns` and `private_dns` attributes according to the [VPC DNS Guide](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-hostnames) as they are not available with the EC2 API. @@ -135,4 +136,4 @@ This data source exports the following attributes in addition to the arguments a - `read` - (Default `20m`) - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/d/iam_policy.html.markdown b/website/docs/cdktf/python/d/iam_policy.html.markdown index d65f706a0156..3546a97d2b06 100644 --- a/website/docs/cdktf/python/d/iam_policy.html.markdown +++ b/website/docs/cdktf/python/d/iam_policy.html.markdown @@ -68,10 +68,11 @@ class MyConvertedCode(TerraformStack): This data source exports the following attributes in addition to the arguments above: * `arn` - ARN of the policy. +* `attachment_count` - Number of entities (users, groups, and roles) that the policy is attached to. * `path` - Path to the policy. * `description` - Description of the policy. * `policy` - Policy document of the policy. * `policy_id` - Policy's ID. * `tags` - Key-value mapping of tags for the IAM Policy. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/d/identitystore_groups.html.markdown b/website/docs/cdktf/python/d/identitystore_groups.html.markdown new file mode 100644 index 000000000000..d5522253d4d5 --- /dev/null +++ b/website/docs/cdktf/python/d/identitystore_groups.html.markdown @@ -0,0 +1,58 @@ +--- +subcategory: "SSO Identity Store" +layout: "aws" +page_title: "AWS: aws_identitystore_groups" +description: |- + Terraform data source for managing an AWS SSO Identity Store Groups. +--- + + + +# Data Source: aws_identitystore_groups + +Terraform data source for managing an AWS SSO Identity Store Groups. + +## Example Usage + +### Basic Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import Fn, TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import DataAwsIdentitystoreGroups +from imports.aws.data_aws_ssoadmin_instances import DataAwsSsoadminInstances +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + example = DataAwsSsoadminInstances(self, "example") + data_aws_identitystore_groups_example = DataAwsIdentitystoreGroups(self, "example_1", + identity_store_id=Fn.lookup_nested(example.identity_store_ids, ["0"]) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + data_aws_identitystore_groups_example.override_logical_id("example") +``` + +## Argument Reference + +The following arguments are required: + +* `identity_store_id` - (Required) Identity Store ID associated with the Single Sign-On (SSO) Instance. + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `groups` - List of Identity Store Groups + * `group_id` - Identifier of the group in the Identity Store. + * `description` - Description of the specified group. + * `display_name` - Group's display name. + * `external_ids` - List of identifiers issued to this resource by an external identity provider. + * `id` - Identifier issued to this resource by an external identity provider. + * `issuer` - Issuer for an external identifier. + + \ No newline at end of file diff --git a/website/docs/cdktf/python/d/organizations_organization.html.markdown b/website/docs/cdktf/python/d/organizations_organization.html.markdown index b0fafe061a7b..a55770af1c68 100644 --- a/website/docs/cdktf/python/d/organizations_organization.html.markdown +++ b/website/docs/cdktf/python/d/organizations_organization.html.markdown @@ -96,6 +96,7 @@ This data source exports the following attributes in addition to the arguments a * `master_account_arn` - ARN of the account that is designated as the master account for the organization. * `master_account_email` - The email address that is associated with the AWS account that is designated as the master account for the organization. * `master_account_id` - Unique identifier (ID) of the master account of an organization. +* `master_account_name` - Name of the master account of an organization. ### Master Account or Delegated Administrator Attribute Reference @@ -123,4 +124,4 @@ If the account is the master account or a delegated administrator for the organi * `name` - The name of the policy type * `status` - The status of the policy type as it relates to the associated root - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/d/vpc_dhcp_options.html.markdown b/website/docs/cdktf/python/d/vpc_dhcp_options.html.markdown index 745261d77210..d019aaa3a12f 100644 --- a/website/docs/cdktf/python/d/vpc_dhcp_options.html.markdown +++ b/website/docs/cdktf/python/d/vpc_dhcp_options.html.markdown @@ -80,6 +80,7 @@ This data source exports the following attributes in addition to the arguments a * `domain_name` - Suffix domain name to used when resolving non Fully Qualified Domain NamesE.g., the `search` value in the `/etc/resolv.conf` file. * `domain_name_servers` - List of name servers. * `id` - EC2 DHCP Options ID +* `ipv6_address_preferred_lease_time` - How frequently, in seconds, a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. * `netbios_name_servers` - List of NETBIOS name servers. * `netbios_node_type` - NetBIOS node type (1, 2, 4, or 8). For more information about these node types, see [RFC 2132](http://www.ietf.org/rfc/rfc2132.txt). * `ntp_servers` - List of NTP servers. @@ -92,4 +93,4 @@ This data source exports the following attributes in addition to the arguments a - `read` - (Default `20m`) - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/functions/arn_build.html.markdown b/website/docs/cdktf/python/functions/arn_build.html.markdown index d94af54cd4ce..a4a357af6acd 100644 --- a/website/docs/cdktf/python/functions/arn_build.html.markdown +++ b/website/docs/cdktf/python/functions/arn_build.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: arn_build -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Builds an ARN from its constituent parts. @@ -39,4 +39,4 @@ arn_build(partition string, service string, region string, account_id string, re 1. `account_id` (String) AWS account identifier. 1. `resource` (String) Resource section, typically composed of a resource type and identifier. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/functions/arn_parse.html.markdown b/website/docs/cdktf/python/functions/arn_parse.html.markdown index c5c632e54de6..3bab50e15c75 100644 --- a/website/docs/cdktf/python/functions/arn_parse.html.markdown +++ b/website/docs/cdktf/python/functions/arn_parse.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: arn_parse -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Parses an ARN into its constituent parts. @@ -42,4 +42,4 @@ arn_parse(arn string) object 1. `arn` (String) ARN (Amazon Resource Name) to parse. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/functions/trim_iam_role_path.html.markdown b/website/docs/cdktf/python/functions/trim_iam_role_path.html.markdown index 5da39173e679..8d341a59ccf7 100644 --- a/website/docs/cdktf/python/functions/trim_iam_role_path.html.markdown +++ b/website/docs/cdktf/python/functions/trim_iam_role_path.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: trim_iam_role_path -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Trims the path prefix from an IAM role Amazon Resource Name (ARN). This function can be used when services require role ARNs to be passed without a path. @@ -36,4 +36,4 @@ trim_iam_role_path(arn string) string 1. `arn` (String) IAM role Amazon Resource Name (ARN). - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/index.html.markdown b/website/docs/cdktf/python/index.html.markdown index b51568ea168e..2f42df87e3b4 100644 --- a/website/docs/cdktf/python/index.html.markdown +++ b/website/docs/cdktf/python/index.html.markdown @@ -13,7 +13,7 @@ Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS. You must configure the provider with the proper credentials before you can use it. -Use the navigation to the left to read about the available resources. There are currently 1356 resources and 556 data sources available in the provider. +Use the navigation to the left to read about the available resources. There are currently 1358 resources and 556 data sources available in the provider. To learn the basics of Terraform using this provider, follow the hands-on [get started tutorials](https://learn.hashicorp.com/tutorials/terraform/infrastructure-as-code?in=terraform/aws-get-started&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS). Interact with AWS services, @@ -804,4 +804,4 @@ Approaches differ per authentication providers: There used to be no better way to get account ID out of the API when using the federated account until `sts:GetCallerIdentity` was introduced. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/amplify_app.html.markdown b/website/docs/cdktf/python/r/amplify_app.html.markdown index 402bc3b35d96..4c8980757fe3 100644 --- a/website/docs/cdktf/python/r/amplify_app.html.markdown +++ b/website/docs/cdktf/python/r/amplify_app.html.markdown @@ -186,7 +186,7 @@ class MyConvertedCode(TerraformStack): This resource supports the following arguments: * `name` - (Required) Name for an Amplify app. -* `access_token` - (Optional) Personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. +* `access_token` - (Optional) Personal access token for a third-party source control system for an Amplify app. This token must have write access to the relevant repo to create a webhook and a read-only deploy key for the Amplify project. The token is not stored, so after applying this attribute can be removed and the setup token deleted. * `auto_branch_creation_config` - (Optional) Automated branch creation configuration for an Amplify app. An `auto_branch_creation_config` block is documented below. * `auto_branch_creation_patterns` - (Optional) Automated branch creation glob patterns for an Amplify app. * `basic_auth_credentials` - (Optional) Credentials for basic authorization for an Amplify app. @@ -269,4 +269,4 @@ Using `terraform import`, import Amplify App using Amplify App ID (appId). For e App ID can be obtained from App ARN (e.g., `arn:aws:amplify:us-east-1:12345678:apps/d2ypk4k47z8u6`). - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/autoscaling_group.html.markdown b/website/docs/cdktf/python/r/autoscaling_group.html.markdown index e9e66b330260..9d8c69032842 100644 --- a/website/docs/cdktf/python/r/autoscaling_group.html.markdown +++ b/website/docs/cdktf/python/r/autoscaling_group.html.markdown @@ -762,6 +762,8 @@ This configuration block supports the following: - `min_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`. - `skip_matching` - (Optional) Replace instances that already have your desired configuration. Defaults to `false`. - `auto_rollback` - (Optional) Automatically rollback if instance refresh fails. Defaults to `false`. This option may only be set to `true` when specifying a `launch_template` or `mixed_instances_policy`. + - `alarm_specification` - (Optional) Alarm Specification for Instance Refresh. + - `alarms` - (Required) List of Cloudwatch alarms. If any of these alarms goes into ALARM state, Instance Refresh is failed. - `scale_in_protected_instances` - (Optional) Behavior when encountering instances protected from scale in are found. Available behaviors are `Refresh`, `Ignore`, and `Wait`. Default is `Ignore`. - `standby_instances` - (Optional) Behavior when encountering instances in the `Standby` state in are found. Available behaviors are `Terminate`, `Ignore`, and `Wait`. Default is `Ignore`. - `triggers` - (Optional) Set of additional property names that will trigger an Instance Refresh. A refresh will always be triggered by a change in any of `launch_configuration`, `launch_template`, or `mixed_instances_policy`. @@ -931,4 +933,4 @@ Using `terraform import`, import Auto Scaling Groups using the `name`. For examp % terraform import aws_autoscaling_group.web web-asg ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/bedrockagent_agent.html.markdown b/website/docs/cdktf/python/r/bedrockagent_agent.html.markdown new file mode 100644 index 000000000000..bb0dfcf5a028 --- /dev/null +++ b/website/docs/cdktf/python/r/bedrockagent_agent.html.markdown @@ -0,0 +1,182 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent. +--- + + +# Resource: aws_bedrockagent_agent + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent. + +## Example Usage + +### Basic Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import Token, TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgent +from imports.aws.data_aws_caller_identity import DataAwsCallerIdentity +from imports.aws.data_aws_iam_policy_document import DataAwsIamPolicyDocument +from imports.aws.data_aws_region import DataAwsRegion +from imports.aws.iam_role import IamRole +from imports.aws.iam_role_policy import IamRolePolicy +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + current = DataAwsCallerIdentity(self, "current") + data_aws_region_current = DataAwsRegion(self, "current_1") + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + data_aws_region_current.override_logical_id("current") + example_agent_permissions = DataAwsIamPolicyDocument(self, "example_agent_permissions", + statement=[DataAwsIamPolicyDocumentStatement( + actions=["bedrock:InvokeModel"], + resources=["arn:aws:bedrock:${" + data_aws_region_current.name + "}::foundation-model/anthropic.claude-v2" + ] + ) + ] + ) + example_agent_trust = DataAwsIamPolicyDocument(self, "example_agent_trust", + statement=[DataAwsIamPolicyDocumentStatement( + actions=["sts:AssumeRole"], + condition=[DataAwsIamPolicyDocumentStatementCondition( + test="StringEquals", + values=[Token.as_string(current.account_id)], + variable="aws:SourceAccount" + ), DataAwsIamPolicyDocumentStatementCondition( + test="ArnLike", + values=["arn:aws:bedrock:${" + data_aws_region_current.name + "}:${" + current.account_id + "}:agent/*" + ], + variable="AWS:SourceArn" + ) + ], + principals=[DataAwsIamPolicyDocumentStatementPrincipals( + identifiers=["bedrock.amazonaws.com"], + type="Service" + ) + ] + ) + ] + ) + example = IamRole(self, "example", + assume_role_policy=Token.as_string(example_agent_trust.json), + name_prefix="AmazonBedrockExecutionRoleForAgents_" + ) + aws_iam_role_policy_example = IamRolePolicy(self, "example_5", + policy=Token.as_string(example_agent_permissions.json), + role=example.id + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + aws_iam_role_policy_example.override_logical_id("example") + BedrockagentAgent(self, "test", + agent_name="my-agent-name", + agent_resource_role_arn=example.arn, + foundation_model="anthropic.claude-v2", + idle_session_ttl_in_seconds=500 + ) +``` + +## Argument Reference + +The following arguments are required: + +* `agent_name` - (Required) Name for the agent. +* `agent_resource_role_arn` - (Required) ARN of the Role for the agent. +* `foundation_model` - (Required) Foundation model for the agent to use. + +The following arguments are optional: + +* `customer_encryption_key_arn` - (Optional) ARN of customer manager key to use for encryption. +* `description` - (Optional) Description of the agent. +* `idle_session_ttl_in_seconds` - (Optional) TTL in seconds for the agent to idle. +* `instruction` - (Optional) Instructions to tell agent what it should do. +* `prompt_override_configuration` (Optional) Prompt Override Configuration +* `tags` - (Optional) Key-value tags for the place index. 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. + +### prompt_override_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `prompt_configurations` - (Required) List of prompt configurations. + +The following arguments are optional: + +* `override_lambda` - (Optional) ARN of Lambda to use when parsing the raw foundation model output. + +### prompt_configurations + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `base_prompt_template` - (Required) Prompt template to replace default. +* `parser_mode` - (Required) DEFAULT or OVERRIDDEN to control if the `override_lambda` is used. +* `prompt_creation_mode` - (Required) DEFAULT or OVERRIDDEN to control if the default or provided `base_prompt_template` is used, +* `prompt_state` - (Required) ENABLED or DISABLED to allow the agent to carry out the step in `prompt_type`. +* `prompt_type` - (Required) The step this prompt applies to. PRE_PROCESSING | ORCHESTRATION | POST_PROCESSING | KNOWLEDGE_BASE_RESPONSE_GENERATION +* `inference_configuration` - (Required) Configures inference for the agent + +### inference_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `max_length` - (Required) Maximum number of tokens in the response between 0 and 4096. +* `stop_sequences` - (Required) List of stop sequences that cause the model to stop generating the response. +* `temperature` - (Required) Likelihood of model selecting higher-probability options when generating a response. +* `top_k` - (Required) Defines the number of most-likely candidates the model chooses the next token from. +* `top_p` - (Required) Defines the number of most-likely candidates the model chooses the next token from. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `agent_arn` - ARN of the Agent. +* `agent_id` - ID of the Agent. +* `agent_version` - Version of the Agent. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent using the `example_id_arg`. For example: + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgent +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + BedrockagentAgent.generate_config_for_import(self, "example", "abcdef1234") +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent using the `abcdef1234`. For example: + +```console +% terraform import aws_bedrockagent_agent.example abcdef1234 +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/bedrockagent_agent_action_group.html.markdown b/website/docs/cdktf/python/r/bedrockagent_agent_action_group.html.markdown new file mode 100644 index 000000000000..33ee43fa3520 --- /dev/null +++ b/website/docs/cdktf/python/r/bedrockagent_agent_action_group.html.markdown @@ -0,0 +1,129 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent_action_group" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Action Group. +--- + + +# Resource: aws_bedrockagent_agent_action_group + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Action Group. + +## Example Usage + +### Basic Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgentActionGroup +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + BedrockagentAgentActionGroup(self, "example", + action_group_executor=[{ + "lambda_": "arn:aws:lambda:us-east-1:123456789012:function:example-function" + } + ], + action_group_name="example", + agent_id="ABDJFOWER1", + agent_version="DRAFT", + api_schema=[{ + "s3": [{ + "s3_bucket_name": "example-bucket", + "s3_object_key": "path/to/schema.json" + } + ] + } + ], + skip_resource_in_use_check=True + ) +``` + +## Argument Reference + +The following arguments are required: + +* `action_group_name` - (Required) Name of the Agent Action Group. +* `agent_id` - (Required) Id of the Agent for the Action Group. +* `agent_version` - (Required) Version of the Agent to attach the Action Group to. +* `action_group_executor` - (Required) Configuration of the executor for the Action Group. +* `api_schema` - (Required) Configuration of the API Schema for the Action Group. + +### action_group_executor + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `lambda` - (Required) ARN of the Lambda that defines the business logic for the action group. + +### api_schema + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are optional: + +* `payload` - (Optional) YAML or JSON OpenAPI Schema. +* `s3` - (Optional) Configuration of S3 schema location + +### s3 + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are optional: + +* `s3_bucket_name` - (Required) The S3 bucket name that contains the OpenAPI Schema. +* `s3_object_key` - (Required) The S3 Object Key for the OpenAPI Schema in the S3 Bucket. + +The following arguments are optional: + +* `action_group_state` - (Optional) `ENABLED` or `DISABLED` +* `description` - (Optional) Description of the Agent Action Group. +* `skip_resource_in_use_check` - (Optional) Set to true to skip the in-use check when deleting. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent Action Group using the `ABDJFOWER1,HSKTNKANI4,DRAFT`. For example: + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgentActionGroup +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + BedrockagentAgentActionGroup.generate_config_for_import(self, "example", "ABDJFOWER1,HSKTNKANI4,DRAFT") +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent Action Group using the `example_id_arg`. For example: + +```console +% terraform import aws_bedrockagent_agent_action_group.example ABDJFOWER1,HSKTNKANI4,DRAFT +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/bedrockagent_agent_alias.html.markdown b/website/docs/cdktf/python/r/bedrockagent_agent_alias.html.markdown new file mode 100644 index 000000000000..e842bdb9ece9 --- /dev/null +++ b/website/docs/cdktf/python/r/bedrockagent_agent_alias.html.markdown @@ -0,0 +1,154 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent_alias" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Alias. +--- + + +# Resource: aws_bedrockagent_agent_alias + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Alias. + +## Example Usage + +### Basic Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import Token, TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgent, BedrockagentAgentAlias +from imports.aws.data_aws_caller_identity import DataAwsCallerIdentity +from imports.aws.data_aws_iam_policy_document import DataAwsIamPolicyDocument +from imports.aws.data_aws_region import DataAwsRegion +from imports.aws.iam_role import IamRole +from imports.aws.iam_role_policy import IamRolePolicy +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + current = DataAwsCallerIdentity(self, "current") + data_aws_region_current = DataAwsRegion(self, "current_1") + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + data_aws_region_current.override_logical_id("current") + example_agent_permissions = DataAwsIamPolicyDocument(self, "example_agent_permissions", + statement=[DataAwsIamPolicyDocumentStatement( + actions=["bedrock:InvokeModel"], + resources=["arn:aws:bedrock:${" + data_aws_region_current.name + "}::foundation-model/anthropic.claude-v2" + ] + ) + ] + ) + example_agent_trust = DataAwsIamPolicyDocument(self, "example_agent_trust", + statement=[DataAwsIamPolicyDocumentStatement( + actions=["sts:AssumeRole"], + condition=[DataAwsIamPolicyDocumentStatementCondition( + test="StringEquals", + values=[Token.as_string(current.account_id)], + variable="aws:SourceAccount" + ), DataAwsIamPolicyDocumentStatementCondition( + test="ArnLike", + values=["arn:aws:bedrock:${" + data_aws_region_current.name + "}:${" + current.account_id + "}:agent/*" + ], + variable="AWS:SourceArn" + ) + ], + principals=[DataAwsIamPolicyDocumentStatementPrincipals( + identifiers=["bedrock.amazonaws.com"], + type="Service" + ) + ] + ) + ] + ) + example = IamRole(self, "example", + assume_role_policy=Token.as_string(example_agent_trust.json), + name_prefix="AmazonBedrockExecutionRoleForAgents_" + ) + aws_iam_role_policy_example = IamRolePolicy(self, "example_5", + policy=Token.as_string(example_agent_permissions.json), + role=example.id + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + aws_iam_role_policy_example.override_logical_id("example") + test = BedrockagentAgent(self, "test", + agent_name="my-agent-name", + agent_resource_role_arn=example.arn, + foundation_model="anthropic.claude-v2", + idle_ttl=500 + ) + aws_bedrockagent_agent_alias_example = BedrockagentAgentAlias(self, "example_7", + agent_alias_name="my-agent-alias", + agent_id=test.agent_id, + description="Test ALias" + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + aws_bedrockagent_agent_alias_example.override_logical_id("example") +``` + +## Argument Reference + +The following arguments are required: + +* `agent_alias_name` - (Required) Name of the alias. +* `agent_id` - (Required) Identifier of the agent to create an alias for. +* `tags` - (Optional) Key-value tags for the place index. 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. + +The following arguments are optional: + +* `description` - (Optional) Description of the alias of the agent. +* `routing_configuration` - (Optional) Routing configuration of the alias + +### routing_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `agent_version` - (Required) Version of the agent the alias routes to. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `agent_alias_arn` - ARN of the Agent Alias. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent Alias using the `ABCDE12345,FGHIJ67890`. For example: + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import BedrockagentAgentAlias +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + BedrockagentAgentAlias.generate_config_for_import(self, "example", "ABCDE12345,FGHIJ67890") +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent Alias using the `AGENT_ID,ALIAS_ID`. For example: + +```console +% terraform import aws_bedrockagent_agent_alias.example AGENT_ID,ALIAS_ID +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/cloudwatch_event_rule.html.markdown b/website/docs/cdktf/python/r/cloudwatch_event_rule.html.markdown index 7b2b9ca4d522..9b0423dcee5a 100644 --- a/website/docs/cdktf/python/r/cloudwatch_event_rule.html.markdown +++ b/website/docs/cdktf/python/r/cloudwatch_event_rule.html.markdown @@ -68,6 +68,7 @@ This resource supports the following arguments: * `event_bus_name` - (Optional) The name or ARN of the event bus to associate with this rule. If you omit this, the `default` event bus is used. * `event_pattern` - (Optional) The event pattern described a JSON object. At least one of `schedule_expression` or `event_pattern` is required. See full documentation of [Events and Event Patterns in EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) for details. **Note**: The event pattern size is 2048 by default but it is adjustable up to 4096 characters by submitting a service quota increase request. See [Amazon EventBridge quotas](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-quota.html) for details. +* `force_destroy` - (Optional) Used to delete managed rules created by AWS. Defaults to `false`. * `description` - (Optional) The description of the rule. * `role_arn` - (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation. * `is_enabled` - (Optional, **Deprecated** Use `state` instead) Whether the rule should be enabled. @@ -116,4 +117,4 @@ Using `terraform import`, import EventBridge Rules using the `event_bus_name/rul % terraform import aws_cloudwatch_event_rule.console example-event-bus/capture-console-sign-in ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/codebuild_project.html.markdown b/website/docs/cdktf/python/r/codebuild_project.html.markdown index c23a962c629d..2283795513e8 100644 --- a/website/docs/cdktf/python/r/codebuild_project.html.markdown +++ b/website/docs/cdktf/python/r/codebuild_project.html.markdown @@ -328,14 +328,14 @@ See [ProjectFileSystemLocation](https://docs.aws.amazon.com/codebuild/latest/API * `git_submodules_config` - (Optional) Configuration block. Detailed below. * `insecure_ssl` - (Optional) Ignore SSL warnings when connecting to source control. * `location` - (Optional) Location of the source code from git or s3. -* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when your source provider is `GITHUB`, `BITBUCKET`, or `GITHUB_ENTERPRISE`. -* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is `GITHUB`, `GITHUB_ENTERPRISE`, or `BITBUCKET`. `build_status_config` blocks are documented below. +* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. +* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `build_status_config` blocks are documented below. * `source_identifier` - (Required) An identifier for this project source. The identifier can only contain alphanumeric characters and underscores, and must be less than 128 characters in length. -* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET` or `S3`. +* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`. #### secondary_sources: git_submodules_config -This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`. +This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`. * `fetch_submodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project. @@ -356,13 +356,13 @@ This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_EN * `git_submodules_config` - (Optional) Configuration block. Detailed below. * `insecure_ssl` - (Optional) Ignore SSL warnings when connecting to source control. * `location` - (Optional) Location of the source code from git or s3. -* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when the `type` is `BITBUCKET` or `GITHUB`. +* `report_build_status` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. * `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `build_status_config` blocks are documented below. * `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`. #### source: git_submodules_config -This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`. +This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`. * `fetch_submodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project. @@ -412,4 +412,4 @@ Using `terraform import`, import CodeBuild Project using the `name`. For example % terraform import aws_codebuild_project.name project-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/dms_replication_task.html.markdown b/website/docs/cdktf/python/r/dms_replication_task.html.markdown index 96f615f447ed..188fc2d88cf1 100644 --- a/website/docs/cdktf/python/r/dms_replication_task.html.markdown +++ b/website/docs/cdktf/python/r/dms_replication_task.html.markdown @@ -59,6 +59,7 @@ This resource supports the following arguments: - Cannot contain two consecutive hyphens. * `replication_task_settings` - (Optional) An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html). +* `resource_identifier` - (Optional) A friendly name for the resource identifier at the end of the EndpointArn response parameter that is returned in the created Endpoint object. * `source_endpoint_arn` - (Required) The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint. * `start_replication_task` - (Optional) Whether to run or stop the replication task. * `table_mappings` - (Required) An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html) @@ -98,4 +99,4 @@ Using `terraform import`, import replication tasks using the `replication_task_i % terraform import aws_dms_replication_task.test test-dms-replication-task-tf ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/eip.html.markdown b/website/docs/cdktf/python/r/eip.html.markdown index 4577cb3f0263..c86f77a3ec3d 100644 --- a/website/docs/cdktf/python/r/eip.html.markdown +++ b/website/docs/cdktf/python/r/eip.html.markdown @@ -167,6 +167,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - Contains the EIP allocation ID. * `private_dns` - The Private DNS associated with the Elastic IP address (if in VPC). * `private_ip` - Contains the private IP address (if in VPC). +* `ptr_record` - The DNS pointer (PTR) record for the IP address. * `public_dns` - Public DNS associated with the Elastic IP address. * `public_ip` - Contains the public IP address. * `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). @@ -208,4 +209,4 @@ Using `terraform import`, import EIPs in a VPC using their Allocation ID. For ex [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AssociateAddress.html - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/eip_domain_name.html.markdown b/website/docs/cdktf/python/r/eip_domain_name.html.markdown new file mode 100644 index 000000000000..057339efee44 --- /dev/null +++ b/website/docs/cdktf/python/r/eip_domain_name.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "EC2 (Elastic Compute Cloud)" +layout: "aws" +page_title: "AWS: aws_eip_domain_name" +description: |- + Assigns a static reverse DNS record to an Elastic IP addresses +--- + + + +# Resource: aws_eip_domain_name + +Assigns a static reverse DNS record to an Elastic IP addresses. See [Using reverse DNS for email applications](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#Using_Elastic_Addressing_Reverse_DNS). + +## Example Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import Token, TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws.eip import Eip +from imports.aws.eip_domain_name import EipDomainName +from imports.aws.route53_record import Route53Record +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + example = Eip(self, "example", + domain="vpc" + ) + aws_route53_record_example = Route53Record(self, "example_1", + name="reverse", + records=[example.public_ip], + type="A", + zone_id=main.zone_id + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + aws_route53_record_example.override_logical_id("example") + aws_eip_domain_name_example = EipDomainName(self, "example_2", + allocation_id=example.allocation_id, + domain_name=Token.as_string(aws_route53_record_example.fqdn) + ) + # This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match. + aws_eip_domain_name_example.override_logical_id("example") +``` + +## Argument Reference + +This resource supports the following arguments: + +* `allocation_id` - (Required) The allocation ID. +* `domain_name` - (Required) The domain name to modify for the IP address. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `ptr_record` - The DNS pointer (PTR) record for the IP address. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +- `create` - (Default `10m`) +- `update` - (Default `10m`) +- `delete` - (Default `10m`) + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/elasticache_replication_group.html.markdown b/website/docs/cdktf/python/r/elasticache_replication_group.html.markdown index df79515496a0..a7843c19f3fb 100644 --- a/website/docs/cdktf/python/r/elasticache_replication_group.html.markdown +++ b/website/docs/cdktf/python/r/elasticache_replication_group.html.markdown @@ -301,6 +301,12 @@ The following arguments are optional: * `subnet_group_name` - (Optional) Name of the cache subnet group to be used for the replication group. * `tags` - (Optional) Map of tags to assign to the resource. Adding tags to this resource will add or overwrite any existing tags on the clusters in the replication group and not to the group itself. 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. * `transit_encryption_enabled` - (Optional) Whether to enable encryption in transit. + Changing this argument with an `engine_version` < `7.0.5` will force a replacement. + Engine versions prior to `7.0.5` only allow this transit encryption to be configured during creation of the replication group. +* `transit_encryption_mode` - (Optional) A setting that enables clients to migrate to in-transit encryption with no downtime. + Valid values are `preferred` and `required`. + When enabling encryption on an existing replication group, this must first be set to `preferred` before setting it to `required` in a subsequent apply. + See the `TransitEncryptionMode` field in the [`CreateReplicationGroup` API documentation](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateReplicationGroup.html) for additional details. * `user_group_ids` - (Optional) User Group ID to associate with the replication group. Only a maximum of one (1) user group ID is valid. **NOTE:** This argument _is_ a set because the AWS specification allows for multiple IDs. However, in practice, AWS only allows a maximum size of one. ### Log Delivery Configuration @@ -359,4 +365,4 @@ Using `terraform import`, import ElastiCache Replication Groups using the `repli % terraform import aws_elasticache_replication_group.my_replication_group replication-group-1 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/fsx_openzfs_file_system.html.markdown b/website/docs/cdktf/python/r/fsx_openzfs_file_system.html.markdown index a320b9feb0fe..fe26f31ae500 100644 --- a/website/docs/cdktf/python/r/fsx_openzfs_file_system.html.markdown +++ b/website/docs/cdktf/python/r/fsx_openzfs_file_system.html.markdown @@ -95,6 +95,7 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - Amazon Resource Name of the file system. * `dns_name` - DNS name for the file system, e.g., `fs-12345678.fsx.us-west-2.amazonaws.com` +* `endpoint_ip_address` - IP address of the endpoint that is used to access data or to manage the file system. * `id` - Identifier of the file system, e.g., `fs-12345678` * `network_interface_ids` - Set of Elastic Network Interface identifiers from which the file system is accessible The first network interface returned is the primary network interface. * `root_volume_id` - Identifier of the root volume, e.g., `fsvol-12345678` @@ -161,4 +162,4 @@ class MyConvertedCode(TerraformStack): ) ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/glue_job.html.markdown b/website/docs/cdktf/python/r/glue_job.html.markdown index 0391548120da..d373aa0a5cee 100644 --- a/website/docs/cdktf/python/r/glue_job.html.markdown +++ b/website/docs/cdktf/python/r/glue_job.html.markdown @@ -175,6 +175,8 @@ This resource supports the following arguments: * For the Standard worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker. * For the G.1X worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and provides 1 executor per worker. Recommended for memory-intensive jobs. * For the G.2X worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and provides 1 executor per worker. Recommended for memory-intensive jobs. + * For the G.4X worker type, each worker maps to 4 DPU (16 vCPUs, 64 GB of memory) with 256GB disk (approximately 235GB free), and provides 1 executor per worker. Recommended for memory-intensive jobs. Only available for Glue version 3.0. Available AWS Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm). + * For the G.8X worker type, each worker maps to 8 DPU (32 vCPUs, 128 GB of memory) with 512GB disk (approximately 487GB free), and provides 1 executor per worker. Recommended for memory-intensive jobs. Only available for Glue version 3.0. Available AWS Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm). * For the G.025X worker type, each worker maps to 0.25 DPU (2 vCPU, 4GB of memory, 64 GB disk), and provides 1 executor per worker. Recommended for low volume streaming jobs. Only available for Glue version 3.0. * For the Z.2X worker type, each worker maps to 2 M-DPU (8vCPU, 64 GB of m emory, 128 GB disk), and provides up to 8 Ray workers based on the autoscaler. * `number_of_workers` - (Optional) The number of workers of a defined workerType that are allocated when a job runs. @@ -227,4 +229,4 @@ Using `terraform import`, import Glue Jobs using `name`. For example: % terraform import aws_glue_job.MyJob MyJob ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/iam_policy.html.markdown b/website/docs/cdktf/python/r/iam_policy.html.markdown index 625ad07c882c..828626423e57 100644 --- a/website/docs/cdktf/python/r/iam_policy.html.markdown +++ b/website/docs/cdktf/python/r/iam_policy.html.markdown @@ -61,6 +61,7 @@ This resource supports the following arguments: This resource exports the following attributes in addition to the arguments above: * `arn` - ARN assigned by AWS to this policy. +* `attachment_count` - Number of entities (users, groups, and roles) that the policy is attached to. * `id` - ARN assigned by AWS to this policy. * `policy_id` - Policy's ID. * `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). @@ -90,4 +91,4 @@ Using `terraform import`, import IAM Policies using the `arn`. For example: % terraform import aws_iam_policy.administrator arn:aws:iam::123456789012:policy/UsersManageOwnCredentials ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/imagebuilder_image.html.markdown b/website/docs/cdktf/python/r/imagebuilder_image.html.markdown index a064cbf3219c..0ca0ce44a5b8 100644 --- a/website/docs/cdktf/python/r/imagebuilder_image.html.markdown +++ b/website/docs/cdktf/python/r/imagebuilder_image.html.markdown @@ -44,9 +44,11 @@ The following arguments are optional: * `container_recipe_arn` - (Optional) - Amazon Resource Name (ARN) of the container recipe. * `distribution_configuration_arn` - (Optional) Amazon Resource Name (ARN) of the Image Builder Distribution Configuration. * `enhanced_image_metadata_enabled` - (Optional) Whether additional information about the image being created is collected. Defaults to `true`. +* `execution_role` - (Optional) Amazon Resource Name (ARN) of the service-linked role to be used by Image Builder to [execute workflows](https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-image-workflows.html). * `image_recipe_arn` - (Optional) Amazon Resource Name (ARN) of the image recipe. * `image_tests_configuration` - (Optional) Configuration block with image tests configuration. Detailed below. * `image_scanning_configuration` - (Optional) Configuration block with image scanning configuration. Detailed below. +* `workflow` - (Optional) Configuration block with the workflow configuration. Detailed below. * `tags` - (Optional) Key-value map of resource tags for the Image Builder Image. 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. ### image_tests_configuration @@ -70,6 +72,25 @@ The following arguments are optional: * `repository_name` - (Optional) The name of the container repository that Amazon Inspector scans to identify findings for your container images. * `container_tags` - (Optional) Set of tags for Image Builder to apply to the output container image that that Amazon Inspector scans. +### workflow + +The following arguments are required: + +* `workflow_arn` - (Required) Amazon Resource Name (ARN) of the Image Builder Workflow. + +The following arguments are optional: + +* `on_failure` - (Optional) The action to take if the workflow fails. Must be one of `CONTINUE` or `ABORT`. +* `parallel_group` - (Optional) The parallel group in which to run a test Workflow. +* `parameter` - (Optional) Configuration block for the workflow parameters. Detailed below. + +### parameter + +The following arguments are required: + +* `name` - (Required) The name of the Workflow parameter. +* `value` - (Required) The value of the Workflow parameter. + ## Attribute Reference This resource exports the following attributes in addition to the arguments above: @@ -122,4 +143,4 @@ Using `terraform import`, import `aws_imagebuilder_image` resources using the Am % terraform import aws_imagebuilder_image.example arn:aws:imagebuilder:us-east-1:123456789012:image/example/1.0.0/1 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/lb.html.markdown b/website/docs/cdktf/python/r/lb.html.markdown index 17f07b1139dc..94c3bbbb4857 100644 --- a/website/docs/cdktf/python/r/lb.html.markdown +++ b/website/docs/cdktf/python/r/lb.html.markdown @@ -138,64 +138,63 @@ class MyConvertedCode(TerraformStack): This resource supports the following arguments: -* `access_logs` - (Optional) An Access Logs block. Access Logs documented below. -* `connection_logs` - (Optional) A Connection Logs block. Connection Logs documented below. Only valid for Load Balancers of type `application`. -* `customer_owned_ipv4_pool` - (Optional) The ID of the customer owned ipv4 pool to use for this load balancer. -* `desync_mitigation_mode` - (Optional) Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`. -* `dns_record_client_routing_policy` - (Optional) Indicates how traffic is distributed among the load balancer Availability Zones. Possible values are `any_availability_zone` (default), `availability_zone_affinity`, or `partial_availability_zone_affinity`. See [Availability Zone DNS affinity](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity) for additional details. Only valid for `network` type load balancers. -* `drop_invalid_header_fields` - (Optional) Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`. +* `access_logs` - (Optional) Access Logs block. See below. +* `connection_logs` - (Optional) Connection Logs block. See below. Only valid for Load Balancers of type `application`. +* `client_keep_alive` - (Optional) Client keep alive value in seconds. The valid range is 60-604800 seconds. The default is 3600 seconds. +* `customer_owned_ipv4_pool` - (Optional) ID of the customer owned ipv4 pool to use for this load balancer. +* `desync_mitigation_mode` - (Optional) How the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`. +* `dns_record_client_routing_policy` - (Optional) How traffic is distributed among the load balancer Availability Zones. Possible values are `any_availability_zone` (default), `availability_zone_affinity`, or `partial_availability_zone_affinity`. See [Availability Zone DNS affinity](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity) for additional details. Only valid for `network` type load balancers. +* `drop_invalid_header_fields` - (Optional) Whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`. * `enable_cross_zone_load_balancing` - (Optional) If true, cross-zone load balancing of the load balancer will be enabled. For `network` and `gateway` type load balancers, this feature is disabled by default (`false`). For `application` load balancer this feature is always enabled (`true`) and cannot be disabled. Defaults to `false`. * `enable_deletion_protection` - (Optional) If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. Defaults to `false`. -* `enable_http2` - (Optional) Indicates whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`. -* `enable_tls_version_and_cipher_suite_headers` - (Optional) Indicates whether the two headers (`x-amzn-tls-version` and `x-amzn-tls-cipher-suite`), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. Only valid for Load Balancers of type `application`. Defaults to `false` -* `enable_xff_client_port` - (Optional) Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in `application` load balancers. Defaults to `false`. -* `enable_waf_fail_open` - (Optional) Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`. -* `enforce_security_group_inbound_rules_on_private_link_traffic` - (Optional) Indicates whether inbound security group rules are enforced for traffic originating from a PrivateLink. Only valid for Load Balancers of type `network`. The possible values are `on` and `off`. -* `idle_timeout` - (Optional) The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60. +* `enable_http2` - (Optional) Whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`. +* `enable_tls_version_and_cipher_suite_headers` - (Optional) Whether the two headers (`x-amzn-tls-version` and `x-amzn-tls-cipher-suite`), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. Only valid for Load Balancers of type `application`. Defaults to `false` +* `enable_xff_client_port` - (Optional) Whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in `application` load balancers. Defaults to `false`. +* `enable_waf_fail_open` - (Optional) Whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`. +* `enforce_security_group_inbound_rules_on_private_link_traffic` - (Optional) Whether inbound security group rules are enforced for traffic originating from a PrivateLink. Only valid for Load Balancers of type `network`. The possible values are `on` and `off`. +* `idle_timeout` - (Optional) Time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60. * `internal` - (Optional) If true, the LB will be internal. Defaults to `false`. -* `ip_address_type` - (Optional) The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`. -* `load_balancer_type` - (Optional) The type of load balancer to create. Possible values are `application`, `gateway`, or `network`. The default value is `application`. -* `name` - (Optional) The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters, -must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified, -Terraform will autogenerate a name beginning with `tf-lb`. +* `ip_address_type` - (Optional) Type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`. +* `load_balancer_type` - (Optional) Type of load balancer to create. Possible values are `application`, `gateway`, or `network`. The default value is `application`. +* `name` - (Optional) Name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified, Terraform will autogenerate a name beginning with `tf-lb`. * `name_prefix` - (Optional) Creates a unique name beginning with the specified prefix. Conflicts with `name`. -* `security_groups` - (Optional) A list of security group IDs to assign to the LB. Only valid for Load Balancers of type `application` or `network`. For load balancers of type `network` security groups cannot be added if none are currently present, and cannot all be removed once added. If either of these conditions are met, this will force a recreation of the resource. -* `preserve_host_header` - (Optional) Indicates whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. Defaults to `false`. -* `subnet_mapping` - (Optional) A subnet mapping block as documented below. For Load Balancers of type `network` subnet mappings can only be added. -* `subnets` - (Optional) A list of subnet IDs to attach to the LB. For Load Balancers of type `network` subnets can only be added (see [Availability Zones](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#availability-zones)), deleting a subnet for load balancers of type `network` will force a recreation of the resource. -* `tags` - (Optional) A map of tags to assign to the resource. 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. +* `security_groups` - (Optional) List of security group IDs to assign to the LB. Only valid for Load Balancers of type `application` or `network`. For load balancers of type `network` security groups cannot be added if none are currently present, and cannot all be removed once added. If either of these conditions are met, this will force a recreation of the resource. +* `preserve_host_header` - (Optional) Whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. Defaults to `false`. +* `subnet_mapping` - (Optional) Subnet mapping block. See below. For Load Balancers of type `network` subnet mappings can only be added. +* `subnets` - (Optional) List of subnet IDs to attach to the LB. For Load Balancers of type `network` subnets can only be added (see [Availability Zones](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#availability-zones)), deleting a subnet for load balancers of type `network` will force a recreation of the resource. +* `tags` - (Optional) Map of tags to assign to the resource. 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. * `xff_header_processing_mode` - (Optional) Determines how the load balancer modifies the `X-Forwarded-For` header in the HTTP request before sending the request to the target. The possible values are `append`, `preserve`, and `remove`. Only valid for Load Balancers of type `application`. The default is `append`. ### access_logs -* `bucket` - (Required) The S3 bucket name to store the logs in. +* `bucket` - (Required) S3 bucket name to store the logs in. * `enabled` - (Optional) Boolean to enable / disable `access_logs`. Defaults to `false`, even when `bucket` is specified. -* `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured. +* `prefix` - (Optional) S3 bucket prefix. Logs are stored in the root if not configured. ### connection_logs -* `bucket` - (Required) The S3 bucket name to store the logs in. +* `bucket` - (Required) S3 bucket name to store the logs in. * `enabled` - (Optional) Boolean to enable / disable `connection_logs`. Defaults to `false`, even when `bucket` is specified. -* `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured. +* `prefix` - (Optional) S3 bucket prefix. Logs are stored in the root if not configured. ### subnet_mapping * `subnet_id` - (Required) ID of the subnet of which to attach to the load balancer. You can specify only one subnet per Availability Zone. -* `allocation_id` - (Optional) The allocation ID of the Elastic IP address for an internet-facing load balancer. -* `ipv6_address` - (Optional) The IPv6 address. You associate IPv6 CIDR blocks with your VPC and choose the subnets where you launch both internet-facing and internal Application Load Balancers or Network Load Balancers. -* `private_ipv4_address` - (Optional) The private IPv4 address for an internal load balancer. +* `allocation_id` - (Optional) Allocation ID of the Elastic IP address for an internet-facing load balancer. +* `ipv6_address` - (Optional) IPv6 address. You associate IPv6 CIDR blocks with your VPC and choose the subnets where you launch both internet-facing and internal Application Load Balancers or Network Load Balancers. +* `private_ipv4_address` - (Optional) Private IPv4 address for an internal load balancer. ## Attribute Reference This resource exports the following attributes in addition to the arguments above: -* `arn` - The ARN of the load balancer (matches `id`). -* `arn_suffix` - The ARN suffix for use with CloudWatch Metrics. -* `dns_name` - The DNS name of the load balancer. -* `id` - The ARN of the load balancer (matches `arn`). +* `arn` - ARN of the load balancer (matches `id`). +* `arn_suffix` - ARN suffix for use with CloudWatch Metrics. +* `dns_name` - DNS name of the load balancer. +* `id` - ARN of the load balancer (matches `arn`). * `subnet_mapping.*.outpost_id` - ID of the Outpost containing the load balancer. -* `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). -* `zone_id` - The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). +* `tags_all` - 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). +* `zone_id` - Canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). ## Timeouts @@ -230,4 +229,4 @@ Using `terraform import`, import LBs using their ARN. For example: % terraform import aws_lb.bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/mwaa_environment.html.markdown b/website/docs/cdktf/python/r/mwaa_environment.html.markdown index e8f08c9b6c86..5c1c61893808 100644 --- a/website/docs/cdktf/python/r/mwaa_environment.html.markdown +++ b/website/docs/cdktf/python/r/mwaa_environment.html.markdown @@ -209,11 +209,13 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The ARN of the MWAA Environment * `created_at` - The Created At date of the MWAA Environment +* `database_vpc_endpoint_service` - The VPC endpoint for the environment's Amazon RDS database * `logging_configuration[0].[0].cloud_watch_log_group_arn` - Provides the ARN for the CloudWatch group where the logs will be published * `service_role_arn` - The Service Role ARN of the Amazon MWAA Environment * `status` - The status of the Amazon MWAA Environment * `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). * `webserver_url` - The webserver URL of the MWAA Environment +* `webserver_vpc_endpoint_service` - The VPC endpoint for the environment's web server ## Timeouts @@ -248,4 +250,4 @@ Using `terraform import`, import MWAA Environment using `Name`. For example: % terraform import aws_mwaa_environment.example MyAirflowEnvironment ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/organizations_account.html.markdown b/website/docs/cdktf/python/r/organizations_account.html.markdown index 8e446e0b0ac7..7b87c080f87d 100644 --- a/website/docs/cdktf/python/r/organizations_account.html.markdown +++ b/website/docs/cdktf/python/r/organizations_account.html.markdown @@ -59,6 +59,7 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The ARN for this account. * `govcloud_id` - ID for a GovCloud account created with the account. * `id` - The AWS account id +* `status` - The status of the account in the organization. * `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). ## Import @@ -111,4 +112,4 @@ class MyConvertedCode(TerraformStack): ) ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/organizations_organization.html.markdown b/website/docs/cdktf/python/r/organizations_organization.html.markdown index de6fcdfa7399..09352fd9901a 100644 --- a/website/docs/cdktf/python/r/organizations_organization.html.markdown +++ b/website/docs/cdktf/python/r/organizations_organization.html.markdown @@ -60,6 +60,7 @@ This resource exports the following attributes in addition to the arguments abov * `master_account_arn` - ARN of the master account * `master_account_email` - Email address of the master account * `master_account_id` - Identifier of the master account +* `master_account_name` - Name of the master account * `non_master_accounts` - List of organization accounts excluding the master account. For a list including the master account, see the `accounts` attribute. All elements have these attributes: * `arn` - ARN of the account * `email` - Email of the account @@ -99,4 +100,4 @@ Using `terraform import`, import the AWS organization using the `id`. For exampl % terraform import aws_organizations_organization.my_org o-1234567 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/signer_signing_profile.html.markdown b/website/docs/cdktf/python/r/signer_signing_profile.html.markdown index 38514053b465..837987deec6e 100644 --- a/website/docs/cdktf/python/r/signer_signing_profile.html.markdown +++ b/website/docs/cdktf/python/r/signer_signing_profile.html.markdown @@ -45,12 +45,26 @@ class MyConvertedCode(TerraformStack): ## Argument Reference -* `platform_id` - (Required) The ID of the platform that is used by the target signing profile. -* `name` - (Optional) A unique signing profile name. By default generated by Terraform. Signing profile names are immutable and cannot be reused after canceled. -* `name_prefix` - (Optional) A signing profile name prefix. Terraform will generate a unique suffix. Conflicts with `name`. -* `signature_validity_period` - (Optional) The validity period for a signing job. +* `platform_id` - (Required, Forces new resource) The ID of the platform that is used by the target signing profile. +* `name` - (Optional, Forces new resource) A unique signing profile name. By default generated by Terraform. Signing profile names are immutable and cannot be reused after canceled. +* `name_prefix` - (Optional, Forces new resource) A signing profile name prefix. Terraform will generate a unique suffix. Conflicts with `name`. +* `signature_validity_period` - (Optional, Forces new resource) The validity period for a signing job. See [`signature_validity_period` Block](#signature_validity_period-block) below for details. +* `signing_material` - (Optional, Forces new resource) The AWS Certificate Manager certificate that will be used to sign code with the new signing profile. See [`signing_material` Block](#signing_material-block) below for details. * `tags` - (Optional) A list of tags associated with the signing profile. 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. +### `signature_validity_period` Block + +The `signature_validity_period` configuration block supports the following arguments: + +* `type` - (Required, Forces new resource) The time unit for signature validity. Valid values: `DAYS`, `MONTHS`, `YEARS`. +* `value` - (Required, Forces new resource) The numerical value of the time unit for signature validity. + +### `signing_material` Block + +The `signing_material` configuration block supports the following arguments: + +* `certificate_arn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the certificates that is used to sign your code. + ## Attribute Reference This resource exports the following attributes in addition to the arguments above: @@ -58,11 +72,19 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The Amazon Resource Name (ARN) for the signing profile. * `name` - The name of the target signing profile. * `platform_display_name` - A human-readable name for the signing platform associated with the signing profile. -* `revocation_record` - Revocation information for a signing profile. +* `revocation_record` - Revocation information for a signing profile. See [`revocation_record` Block](#revocation_record-block) below for details. * `status` - The status of the target signing profile. -* `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). * `version` - The current version of the signing profile. * `version_arn` - The signing profile ARN, including the profile version. +* `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). + +### `revocation_record` Block + +The `revocation_record` configuration block supports the following attributes: + +* `revocation_effective_from` - The time when revocation becomes effective. +* `revoked_at` - The time when the signing profile was revoked. +* `revoked_by` - The identity of the revoker. ## Import @@ -89,4 +111,4 @@ Using `terraform import`, import Signer signing profiles using the `name`. For e % terraform import aws_signer_signing_profile.test_signer_signing_profile test_sp_DdW3Mk1foYL88fajut4mTVFGpuwfd4ACO6ANL0D1uIj7lrn8adK ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/transfer_connector.html.markdown b/website/docs/cdktf/python/r/transfer_connector.html.markdown index 996c2350e69f..3ace72ccff7c 100644 --- a/website/docs/cdktf/python/r/transfer_connector.html.markdown +++ b/website/docs/cdktf/python/r/transfer_connector.html.markdown @@ -75,6 +75,7 @@ This resource supports the following arguments: * `access_role` - (Required) The IAM Role which provides read and write access to the parent directory of the file location mentioned in the StartFileTransfer request. * `as2_config` - (Optional) Either SFTP or AS2 is configured.The parameters to configure for the connector object. Fields documented below. * `logging_role` - (Optional) The IAM Role which is required for allowing the connector to turn on CloudWatch logging for Amazon S3 events. +* `security_policy_name` - (Optional) Name of the security policy for the connector. * `sftp_config` - (Optional) Either SFTP or AS2 is configured.The parameters to configure for the connector object. Fields documented below. * `url` - (Required) The URL of the partners AS2 endpoint or SFTP endpoint. * `tags` - (Optional) A map of tags to assign to the resource. 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. @@ -127,4 +128,4 @@ Using `terraform import`, import Transfer AS2 Connector using the `connector_id` % terraform import aws_transfer_connector.example c-4221a88afd5f4362a ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/verifiedpermissions_policy.html.markdown b/website/docs/cdktf/python/r/verifiedpermissions_policy.html.markdown new file mode 100644 index 000000000000..efa02693b0a8 --- /dev/null +++ b/website/docs/cdktf/python/r/verifiedpermissions_policy.html.markdown @@ -0,0 +1,106 @@ +--- +subcategory: "Verified Permissions" +layout: "aws" +page_title: "AWS: aws_verifiedpermissions_policy" +description: |- + Terraform resource for managing an AWS Verified Permissions Policy. +--- + + + +# Resource: aws_verifiedpermissions_policy + +Terraform resource for managing an AWS Verified Permissions Policy. + +## Example Usage + +### Basic Usage + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import VerifiedpermissionsPolicy +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + VerifiedpermissionsPolicy(self, "test", + definition=[{ + "static": [{ + "statement": "permit (principal, action == Action::\\\"view\\\", resource in Album:: \\\"test_album\\\");" + } + ] + } + ], + policy_store_id=aws_verifiedpermissions_policy_store_test.id + ) +``` + +## Argument Reference + +The following arguments are required: + +* `policy_store_id` - (Required) The Policy Store ID of the policy store. +* `definition`- (Required) The definition of the policy. See [Definition](#definition) below. + +The following arguments are optional: + +* `optional_arg` - (Optional) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +### Definition + +* `static` - (Optional) The static policy statement. See [Static](#static) below. +* `template_linked` - (Optional) The template linked policy. See [Template Linked](#template-linked) below. + +#### Static + +* `description` - (Optional) The description of the static policy. +* `statement` - (Required) The statement of the static policy. + +#### Template Linked + +* `policy_template_id` - (Required) The ID of the template. +* `principal` - (Optional) The principal of the template linked policy. + * `entity_id` - (Required) The entity ID of the principal. + * `entity_type` - (Required) The entity type of the principal. +* `resource` - (Optional) The resource of the template linked policy. + * `entity_id` - (Required) The entity ID of the resource. + * `entity_type` - (Required) The entity type of the resource. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `arn` - ARN of the Policy. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. +* `example_attribute` - Concise description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Verified Permissions Policy using the `policy_id,policy_store_id`. For example: + +```python +# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +from constructs import Construct +from cdktf import TerraformStack +# +# Provider bindings are generated by running `cdktf get`. +# See https://cdk.tf/provider-generation for more details. +# +from imports.aws. import VerifiedpermissionsPolicy +class MyConvertedCode(TerraformStack): + def __init__(self, scope, name): + super().__init__(scope, name) + VerifiedpermissionsPolicy.generate_config_for_import(self, "example", "policy-id-12345678,policy-store-id-12345678") +``` + +Using `terraform import`, import Verified Permissions Policy using the `policy_id,policy_store_id`. For example: + +```console +% terraform import aws_verifiedpermissions_policy.example policy-id-12345678,policy-store-id-12345678 +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/vpc_dhcp_options.html.markdown b/website/docs/cdktf/python/r/vpc_dhcp_options.html.markdown index 40a12d2c33e7..e5be0a80a23f 100644 --- a/website/docs/cdktf/python/r/vpc_dhcp_options.html.markdown +++ b/website/docs/cdktf/python/r/vpc_dhcp_options.html.markdown @@ -50,6 +50,7 @@ class MyConvertedCode(TerraformStack): VpcDhcpOptions(self, "foo", domain_name="service.consul", domain_name_servers=["127.0.0.1", "10.0.0.2"], + ipv6_address_preferred_lease_time=Token.as_string(1440), netbios_name_servers=["127.0.0.1"], netbios_node_type=Token.as_string(2), ntp_servers=["127.0.0.1"], @@ -65,6 +66,7 @@ This resource supports the following arguments: * `domain_name` - (Optional) the suffix domain name to use by default when resolving non Fully Qualified Domain Names. In other words, this is what ends up being the `search` value in the `/etc/resolv.conf` file. * `domain_name_servers` - (Optional) List of name servers to configure in `/etc/resolv.conf`. If you want to use the default AWS nameservers you should set this to `AmazonProvidedDNS`. +* `ipv6_address_preferred_lease_time` - (Optional) How frequently, in seconds, a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. Acceptable values are between 140 and 2147483647 (approximately 68 years). If no value is entered, the default lease time is 140 seconds. If you use long-term addressing for EC2 instances, you can increase the lease time and avoid frequent lease renewal requests. Lease renewal typically occurs when half of the lease time has elapsed. * `ntp_servers` - (Optional) List of NTP servers to configure. * `netbios_name_servers` - (Optional) List of NETBIOS name servers. * `netbios_node_type` - (Optional) The NetBIOS node type (1, 2, 4, or 8). AWS recommends to specify 2 since broadcast and multicast are not supported in their network. For more information about these node types, see [RFC 2132](http://www.ietf.org/rfc/rfc2132.txt). @@ -115,4 +117,4 @@ Using `terraform import`, import VPC DHCP Options using the DHCP Options `id`. F % terraform import aws_vpc_dhcp_options.my_options dopt-d9070ebb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/python/r/vpc_ipam_pool.html.markdown b/website/docs/cdktf/python/r/vpc_ipam_pool.html.markdown index d4fc6a824967..384af42a4f96 100644 --- a/website/docs/cdktf/python/r/vpc_ipam_pool.html.markdown +++ b/website/docs/cdktf/python/r/vpc_ipam_pool.html.markdown @@ -102,6 +102,7 @@ This resource supports the following arguments: * `auto_import` - (Optional) If you include this argument, IPAM automatically imports any VPCs you have in your scope that fall within the CIDR range in the pool. * `aws_service` - (Optional) Limits which AWS service the pool can be used in. Only useable on public scopes. Valid Values: `ec2`. +* `cascade` - (Optional) Enables you to quickly delete an IPAM pool and all resources within that pool, including provisioned CIDRs, allocations, and other pools. * `description` - (Optional) A description for the IPAM pool. * `ipam_scope_id` - (Required) The ID of the scope in which you would like to create the IPAM pool. * `locale` - (Optional) The locale in which you would like to create the IPAM pool. Locale is the Region where you want to make an IPAM pool available for allocations. You can only create pools with locales that match the operating Regions of the IPAM. You can only create VPCs from a pool whose locale matches the VPC's Region. Possible values: Any AWS region, such as `us-east-1`. @@ -144,4 +145,4 @@ Using `terraform import`, import IPAMs using the IPAM pool `id`. For example: % terraform import aws_vpc_ipam_pool.example ipam-pool-0958f95207d978e1e ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/eip.html.markdown b/website/docs/cdktf/typescript/d/eip.html.markdown index dba1e7463cac..3bf523e30613 100644 --- a/website/docs/cdktf/typescript/d/eip.html.markdown +++ b/website/docs/cdktf/typescript/d/eip.html.markdown @@ -125,6 +125,9 @@ Elastic IP whose data will be exported as attributes. This data source exports the following attributes in addition to the arguments above: * `associationId` - ID representing the association of the address with an instance in a VPC. +* `carrierIp` - Carrier IP address. +* `customerOwnedIp` - Customer Owned IP. +* `customerOwnedIpv4Pool` - The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) * `domain` - Whether the address is for use in EC2-Classic (standard) or in a VPC (vpc). * `id` - If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address. * `instanceId` - ID of the instance that the address is associated with (if any). @@ -132,12 +135,10 @@ This data source exports the following attributes in addition to the arguments a * `networkInterfaceOwnerId` - The ID of the AWS account that owns the network interface. * `privateIp` - Private IP address associated with the Elastic IP address. * `privateDns` - Private DNS associated with the Elastic IP address. +* `ptrRecord` - The DNS pointer (PTR) record for the IP address. * `publicIp` - Public IP address of Elastic IP. * `publicDns` - Public DNS associated with the Elastic IP address. * `publicIpv4Pool` - ID of an address pool. -* `carrierIp` - Carrier IP address. -* `customerOwnedIpv4Pool` - The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) -* `customerOwnedIp` - Customer Owned IP. * `tags` - Key-value map of tags associated with Elastic IP. ~> **Note:** The data source computes the `publicDns` and `privateDns` attributes according to the [VPC DNS Guide](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-hostnames) as they are not available with the EC2 API. @@ -148,4 +149,4 @@ This data source exports the following attributes in addition to the arguments a - `read` - (Default `20m`) - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/iam_policy.html.markdown b/website/docs/cdktf/typescript/d/iam_policy.html.markdown index b81761829ac5..f70fdfc045f2 100644 --- a/website/docs/cdktf/typescript/d/iam_policy.html.markdown +++ b/website/docs/cdktf/typescript/d/iam_policy.html.markdown @@ -74,10 +74,11 @@ class MyConvertedCode extends TerraformStack { This data source exports the following attributes in addition to the arguments above: * `arn` - ARN of the policy. +* `attachmentCount` - Number of entities (users, groups, and roles) that the policy is attached to. * `path` - Path to the policy. * `description` - Description of the policy. * `policy` - Policy document of the policy. * `policyId` - Policy's ID. * `tags` - Key-value mapping of tags for the IAM Policy. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/identitystore_groups.html.markdown b/website/docs/cdktf/typescript/d/identitystore_groups.html.markdown new file mode 100644 index 000000000000..8cc426d97579 --- /dev/null +++ b/website/docs/cdktf/typescript/d/identitystore_groups.html.markdown @@ -0,0 +1,65 @@ +--- +subcategory: "SSO Identity Store" +layout: "aws" +page_title: "AWS: aws_identitystore_groups" +description: |- + Terraform data source for managing an AWS SSO Identity Store Groups. +--- + + + +# Data Source: aws_identitystore_groups + +Terraform data source for managing an AWS SSO Identity Store Groups. + +## Example Usage + +### Basic Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { Fn, TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { DataAwsIdentitystoreGroups } from "./.gen/providers/aws/"; +import { DataAwsSsoadminInstances } from "./.gen/providers/aws/data-aws-ssoadmin-instances"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + const example = new DataAwsSsoadminInstances(this, "example", {}); + const dataAwsIdentitystoreGroupsExample = new DataAwsIdentitystoreGroups( + this, + "example_1", + { + identity_store_id: Fn.lookupNested(example.identityStoreIds, ["0"]), + } + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + dataAwsIdentitystoreGroupsExample.overrideLogicalId("example"); + } +} + +``` + +## Argument Reference + +The following arguments are required: + +* `identityStoreId` - (Required) Identity Store ID associated with the Single Sign-On (SSO) Instance. + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `groups` - List of Identity Store Groups + * `groupId` - Identifier of the group in the Identity Store. + * `description` - Description of the specified group. + * `displayName` - Group's display name. + * `externalIds` - List of identifiers issued to this resource by an external identity provider. + * `id` - Identifier issued to this resource by an external identity provider. + * `issuer` - Issuer for an external identifier. + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/organizations_organization.html.markdown b/website/docs/cdktf/typescript/d/organizations_organization.html.markdown index 805edfb447fc..61754010e851 100644 --- a/website/docs/cdktf/typescript/d/organizations_organization.html.markdown +++ b/website/docs/cdktf/typescript/d/organizations_organization.html.markdown @@ -113,6 +113,7 @@ This data source exports the following attributes in addition to the arguments a * `masterAccountArn` - ARN of the account that is designated as the master account for the organization. * `masterAccountEmail` - The email address that is associated with the AWS account that is designated as the master account for the organization. * `masterAccountId` - Unique identifier (ID) of the master account of an organization. +* `masterAccountName` - Name of the master account of an organization. ### Master Account or Delegated Administrator Attribute Reference @@ -140,4 +141,4 @@ If the account is the master account or a delegated administrator for the organi * `name` - The name of the policy type * `status` - The status of the policy type as it relates to the associated root - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/d/vpc_dhcp_options.html.markdown b/website/docs/cdktf/typescript/d/vpc_dhcp_options.html.markdown index 5a5c927ccdcb..ee8af8832b59 100644 --- a/website/docs/cdktf/typescript/d/vpc_dhcp_options.html.markdown +++ b/website/docs/cdktf/typescript/d/vpc_dhcp_options.html.markdown @@ -88,6 +88,7 @@ This data source exports the following attributes in addition to the arguments a * `domainName` - Suffix domain name to used when resolving non Fully Qualified Domain NamesE.g., the `search` value in the `/etc/resolv.conf` file. * `domainNameServers` - List of name servers. * `id` - EC2 DHCP Options ID +* `ipv6AddressPreferredLeaseTime` - How frequently, in seconds, a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. * `netbiosNameServers` - List of NETBIOS name servers. * `netbiosNodeType` - NetBIOS node type (1, 2, 4, or 8). For more information about these node types, see [RFC 2132](http://www.ietf.org/rfc/rfc2132.txt). * `ntpServers` - List of NTP servers. @@ -100,4 +101,4 @@ This data source exports the following attributes in addition to the arguments a - `read` - (Default `20m`) - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/functions/arn_build.html.markdown b/website/docs/cdktf/typescript/functions/arn_build.html.markdown index d916fb143c59..8e16360374d5 100644 --- a/website/docs/cdktf/typescript/functions/arn_build.html.markdown +++ b/website/docs/cdktf/typescript/functions/arn_build.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: arn_build -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Builds an ARN from its constituent parts. @@ -39,4 +39,4 @@ arn_build(partition string, service string, region string, account_id string, re 1. `accountId` (String) AWS account identifier. 1. `resource` (String) Resource section, typically composed of a resource type and identifier. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/functions/arn_parse.html.markdown b/website/docs/cdktf/typescript/functions/arn_parse.html.markdown index c5c632e54de6..3bab50e15c75 100644 --- a/website/docs/cdktf/typescript/functions/arn_parse.html.markdown +++ b/website/docs/cdktf/typescript/functions/arn_parse.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: arn_parse -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Parses an ARN into its constituent parts. @@ -42,4 +42,4 @@ arn_parse(arn string) object 1. `arn` (String) ARN (Amazon Resource Name) to parse. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/functions/trim_iam_role_path.html.markdown b/website/docs/cdktf/typescript/functions/trim_iam_role_path.html.markdown index 5da39173e679..8d341a59ccf7 100644 --- a/website/docs/cdktf/typescript/functions/trim_iam_role_path.html.markdown +++ b/website/docs/cdktf/typescript/functions/trim_iam_role_path.html.markdown @@ -10,7 +10,7 @@ description: |- # Function: trim_iam_role_path -~> Provider-defined function support is in technical preview and offered without compatibility promises until Terraform 1.8 is generally available. +~> Provider-defined functions are supported in Terraform 1.8 and later. Trims the path prefix from an IAM role Amazon Resource Name (ARN). This function can be used when services require role ARNs to be passed without a path. @@ -36,4 +36,4 @@ trim_iam_role_path(arn string) string 1. `arn` (String) IAM role Amazon Resource Name (ARN). - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/index.html.markdown b/website/docs/cdktf/typescript/index.html.markdown index 4c1033d172e9..c60a882711ab 100644 --- a/website/docs/cdktf/typescript/index.html.markdown +++ b/website/docs/cdktf/typescript/index.html.markdown @@ -13,7 +13,7 @@ Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS. You must configure the provider with the proper credentials before you can use it. -Use the navigation to the left to read about the available resources. There are currently 1356 resources and 556 data sources available in the provider. +Use the navigation to the left to read about the available resources. There are currently 1358 resources and 556 data sources available in the provider. To learn the basics of Terraform using this provider, follow the hands-on [get started tutorials](https://learn.hashicorp.com/tutorials/terraform/infrastructure-as-code?in=terraform/aws-get-started&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS). Interact with AWS services, @@ -846,4 +846,4 @@ Approaches differ per authentication providers: There used to be no better way to get account ID out of the API when using the federated account until `sts:GetCallerIdentity` was introduced. - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/amplify_app.html.markdown b/website/docs/cdktf/typescript/r/amplify_app.html.markdown index bd4ee5876e16..a17e255a65ae 100644 --- a/website/docs/cdktf/typescript/r/amplify_app.html.markdown +++ b/website/docs/cdktf/typescript/r/amplify_app.html.markdown @@ -208,7 +208,7 @@ class MyConvertedCode extends TerraformStack { This resource supports the following arguments: * `name` - (Required) Name for an Amplify app. -* `accessToken` - (Optional) Personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. +* `accessToken` - (Optional) Personal access token for a third-party source control system for an Amplify app. This token must have write access to the relevant repo to create a webhook and a read-only deploy key for the Amplify project. The token is not stored, so after applying this attribute can be removed and the setup token deleted. * `autoBranchCreationConfig` - (Optional) Automated branch creation configuration for an Amplify app. An `autoBranchCreationConfig` block is documented below. * `autoBranchCreationPatterns` - (Optional) Automated branch creation glob patterns for an Amplify app. * `basicAuthCredentials` - (Optional) Credentials for basic authorization for an Amplify app. @@ -294,4 +294,4 @@ Using `terraform import`, import Amplify App using Amplify App ID (appId). For e App ID can be obtained from App ARN (e.g., `arn:aws:amplify:us-east-1:12345678:apps/d2ypk4k47z8u6`). - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/autoscaling_group.html.markdown b/website/docs/cdktf/typescript/r/autoscaling_group.html.markdown index cea9b94991c6..941e43aaf0bb 100644 --- a/website/docs/cdktf/typescript/r/autoscaling_group.html.markdown +++ b/website/docs/cdktf/typescript/r/autoscaling_group.html.markdown @@ -817,6 +817,8 @@ This configuration block supports the following: - `minHealthyPercentage` - (Optional) Amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`. - `skipMatching` - (Optional) Replace instances that already have your desired configuration. Defaults to `false`. - `autoRollback` - (Optional) Automatically rollback if instance refresh fails. Defaults to `false`. This option may only be set to `true` when specifying a `launchTemplate` or `mixedInstancesPolicy`. + - `alarmSpecification` - (Optional) Alarm Specification for Instance Refresh. + - `alarms` - (Required) List of Cloudwatch alarms. If any of these alarms goes into ALARM state, Instance Refresh is failed. - `scaleInProtectedInstances` - (Optional) Behavior when encountering instances protected from scale in are found. Available behaviors are `Refresh`, `Ignore`, and `Wait`. Default is `Ignore`. - `standbyInstances` - (Optional) Behavior when encountering instances in the `Standby` state in are found. Available behaviors are `Terminate`, `Ignore`, and `Wait`. Default is `Ignore`. - `triggers` - (Optional) Set of additional property names that will trigger an Instance Refresh. A refresh will always be triggered by a change in any of `launchConfiguration`, `launchTemplate`, or `mixedInstancesPolicy`. @@ -989,4 +991,4 @@ Using `terraform import`, import Auto Scaling Groups using the `name`. For examp % terraform import aws_autoscaling_group.web web-asg ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/bedrockagent_agent.html.markdown b/website/docs/cdktf/typescript/r/bedrockagent_agent.html.markdown new file mode 100644 index 000000000000..70d3ed220bdf --- /dev/null +++ b/website/docs/cdktf/typescript/r/bedrockagent_agent.html.markdown @@ -0,0 +1,209 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent. +--- + + +# Resource: aws_bedrockagent_agent + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent. + +## Example Usage + +### Basic Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { Token, TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { BedrockagentAgent } from "./.gen/providers/aws/"; +import { DataAwsCallerIdentity } from "./.gen/providers/aws/data-aws-caller-identity"; +import { DataAwsIamPolicyDocument } from "./.gen/providers/aws/data-aws-iam-policy-document"; +import { DataAwsRegion } from "./.gen/providers/aws/data-aws-region"; +import { IamRole } from "./.gen/providers/aws/iam-role"; +import { IamRolePolicy } from "./.gen/providers/aws/iam-role-policy"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + const current = new DataAwsCallerIdentity(this, "current", {}); + const dataAwsRegionCurrent = new DataAwsRegion(this, "current_1", {}); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + dataAwsRegionCurrent.overrideLogicalId("current"); + const exampleAgentPermissions = new DataAwsIamPolicyDocument( + this, + "example_agent_permissions", + { + statement: [ + { + actions: ["bedrock:InvokeModel"], + resources: [ + "arn:aws:bedrock:${" + + dataAwsRegionCurrent.name + + "}::foundation-model/anthropic.claude-v2", + ], + }, + ], + } + ); + const exampleAgentTrust = new DataAwsIamPolicyDocument( + this, + "example_agent_trust", + { + statement: [ + { + actions: ["sts:AssumeRole"], + condition: [ + { + test: "StringEquals", + values: [Token.asString(current.accountId)], + variable: "aws:SourceAccount", + }, + { + test: "ArnLike", + values: [ + "arn:aws:bedrock:${" + + dataAwsRegionCurrent.name + + "}:${" + + current.accountId + + "}:agent/*", + ], + variable: "AWS:SourceArn", + }, + ], + principals: [ + { + identifiers: ["bedrock.amazonaws.com"], + type: "Service", + }, + ], + }, + ], + } + ); + const example = new IamRole(this, "example", { + assumeRolePolicy: Token.asString(exampleAgentTrust.json), + namePrefix: "AmazonBedrockExecutionRoleForAgents_", + }); + const awsIamRolePolicyExample = new IamRolePolicy(this, "example_5", { + policy: Token.asString(exampleAgentPermissions.json), + role: example.id, + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + awsIamRolePolicyExample.overrideLogicalId("example"); + new BedrockagentAgent(this, "test", { + agent_name: "my-agent-name", + agent_resource_role_arn: example.arn, + foundation_model: "anthropic.claude-v2", + idle_session_ttl_in_seconds: 500, + }); + } +} + +``` + +## Argument Reference + +The following arguments are required: + +* `agent_name` - (Required) Name for the agent. +* `agent_resource_role_arn` - (Required) ARN of the Role for the agent. +* `foundation_model` - (Required) Foundation model for the agent to use. + +The following arguments are optional: + +* `customer_encryption_key_arn` - (Optional) ARN of customer manager key to use for encryption. +* `description` - (Optional) Description of the agent. +* `idleSessionTtlInSeconds` - (Optional) TTL in seconds for the agent to idle. +* `instruction` - (Optional) Instructions to tell agent what it should do. +* `prompt_override_configuration` (Optional) Prompt Override Configuration +* `tags` - (Optional) Key-value tags for the place index. If configured with a provider [`defaultTags` 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. + +### prompt_override_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `prompt_configurations` - (Required) List of prompt configurations. + +The following arguments are optional: + +* `override_lambda` - (Optional) ARN of Lambda to use when parsing the raw foundation model output. + +### prompt_configurations + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `base_prompt_template` - (Required) Prompt template to replace default. +* `parser_mode` - (Required) DEFAULT or OVERRIDDEN to control if the `override_lambda` is used. +* `prompt_creation_mode` - (Required) DEFAULT or OVERRIDDEN to control if the default or provided `base_prompt_template` is used, +* `prompt_state` - (Required) ENABLED or DISABLED to allow the agent to carry out the step in `prompt_type`. +* `prompt_type` - (Required) The step this prompt applies to. PRE_PROCESSING | ORCHESTRATION | POST_PROCESSING | KNOWLEDGE_BASE_RESPONSE_GENERATION +* `inference_configuration` - (Required) Configures inference for the agent + +### inference_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `maxLength` - (Required) Maximum number of tokens in the response between 0 and 4096. +* `stop_sequences` - (Required) List of stop sequences that cause the model to stop generating the response. +* `temperature` - (Required) Likelihood of model selecting higher-probability options when generating a response. +* `top_k` - (Required) Defines the number of most-likely candidates the model chooses the next token from. +* `top_p` - (Required) Defines the number of most-likely candidates the model chooses the next token from. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `agent_arn` - ARN of the Agent. +* `agent_id` - ID of the Agent. +* `agentVersion` - Version of the Agent. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent using the `example_id_arg`. For example: + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { BedrockagentAgent } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + BedrockagentAgent.generateConfigForImport(this, "example", "abcdef1234"); + } +} + +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent using the `abcdef1234`. For example: + +```console +% terraform import aws_bedrockagent_agent.example abcdef1234 +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/bedrockagent_agent_action_group.html.markdown b/website/docs/cdktf/typescript/r/bedrockagent_agent_action_group.html.markdown new file mode 100644 index 000000000000..e985cb93a87a --- /dev/null +++ b/website/docs/cdktf/typescript/r/bedrockagent_agent_action_group.html.markdown @@ -0,0 +1,143 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent_action_group" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Action Group. +--- + + +# Resource: aws_bedrockagent_agent_action_group + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Action Group. + +## Example Usage + +### Basic Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { BedrockagentAgentActionGroup } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + new BedrockagentAgentActionGroup(this, "example", { + action_group_executor: [ + { + lambda: + "arn:aws:lambda:us-east-1:123456789012:function:example-function", + }, + ], + action_group_name: "example", + agent_id: "ABDJFOWER1", + agent_version: "DRAFT", + api_schema: [ + { + s3: [ + { + s3_bucket_name: "example-bucket", + s3_object_key: "path/to/schema.json", + }, + ], + }, + ], + skip_resource_in_use_check: true, + }); + } +} + +``` + +## Argument Reference + +The following arguments are required: + +* `action_group_name` - (Required) Name of the Agent Action Group. +* `agent_id` - (Required) Id of the Agent for the Action Group. +* `agentVersion` - (Required) Version of the Agent to attach the Action Group to. +* `action_group_executor` - (Required) Configuration of the executor for the Action Group. +* `api_schema` - (Required) Configuration of the API Schema for the Action Group. + +### action_group_executor + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `lambda` - (Required) ARN of the Lambda that defines the business logic for the action group. + +### api_schema + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are optional: + +* `payload` - (Optional) YAML or JSON OpenAPI Schema. +* `s3` - (Optional) Configuration of S3 schema location + +### s3 + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are optional: + +* `s3BucketName` - (Required) The S3 bucket name that contains the OpenAPI Schema. +* `s3ObjectKey` - (Required) The S3 Object Key for the OpenAPI Schema in the S3 Bucket. + +The following arguments are optional: + +* `action_group_state` - (Optional) `ENABLED` or `DISABLED` +* `description` - (Optional) Description of the Agent Action Group. +* `skip_resource_in_use_check` - (Optional) Set to true to skip the in-use check when deleting. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent Action Group using the `ABDJFOWER1,HSKTNKANI4,DRAFT`. For example: + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { BedrockagentAgentActionGroup } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + BedrockagentAgentActionGroup.generateConfigForImport( + this, + "example", + "ABDJFOWER1,HSKTNKANI4,DRAFT" + ); + } +} + +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent Action Group using the `example_id_arg`. For example: + +```console +% terraform import aws_bedrockagent_agent_action_group.example ABDJFOWER1,HSKTNKANI4,DRAFT +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/bedrockagent_agent_alias.html.markdown b/website/docs/cdktf/typescript/r/bedrockagent_agent_alias.html.markdown new file mode 100644 index 000000000000..c9f66ee55cf7 --- /dev/null +++ b/website/docs/cdktf/typescript/r/bedrockagent_agent_alias.html.markdown @@ -0,0 +1,192 @@ +--- +subcategory: "Agents for Amazon Bedrock" +layout: "aws" +page_title: "AWS: aws_bedrockagent_agent_alias" +description: |- + Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Alias. +--- + + +# Resource: aws_bedrockagent_agent_alias + +Terraform resource for managing an AWS Agents for Amazon Bedrock Agent Alias. + +## Example Usage + +### Basic Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { Token, TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { + BedrockagentAgent, + BedrockagentAgentAlias, +} from "./.gen/providers/aws/"; +import { DataAwsCallerIdentity } from "./.gen/providers/aws/data-aws-caller-identity"; +import { DataAwsIamPolicyDocument } from "./.gen/providers/aws/data-aws-iam-policy-document"; +import { DataAwsRegion } from "./.gen/providers/aws/data-aws-region"; +import { IamRole } from "./.gen/providers/aws/iam-role"; +import { IamRolePolicy } from "./.gen/providers/aws/iam-role-policy"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + const current = new DataAwsCallerIdentity(this, "current", {}); + const dataAwsRegionCurrent = new DataAwsRegion(this, "current_1", {}); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + dataAwsRegionCurrent.overrideLogicalId("current"); + const exampleAgentPermissions = new DataAwsIamPolicyDocument( + this, + "example_agent_permissions", + { + statement: [ + { + actions: ["bedrock:InvokeModel"], + resources: [ + "arn:aws:bedrock:${" + + dataAwsRegionCurrent.name + + "}::foundation-model/anthropic.claude-v2", + ], + }, + ], + } + ); + const exampleAgentTrust = new DataAwsIamPolicyDocument( + this, + "example_agent_trust", + { + statement: [ + { + actions: ["sts:AssumeRole"], + condition: [ + { + test: "StringEquals", + values: [Token.asString(current.accountId)], + variable: "aws:SourceAccount", + }, + { + test: "ArnLike", + values: [ + "arn:aws:bedrock:${" + + dataAwsRegionCurrent.name + + "}:${" + + current.accountId + + "}:agent/*", + ], + variable: "AWS:SourceArn", + }, + ], + principals: [ + { + identifiers: ["bedrock.amazonaws.com"], + type: "Service", + }, + ], + }, + ], + } + ); + const example = new IamRole(this, "example", { + assumeRolePolicy: Token.asString(exampleAgentTrust.json), + namePrefix: "AmazonBedrockExecutionRoleForAgents_", + }); + const awsIamRolePolicyExample = new IamRolePolicy(this, "example_5", { + policy: Token.asString(exampleAgentPermissions.json), + role: example.id, + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + awsIamRolePolicyExample.overrideLogicalId("example"); + const test = new BedrockagentAgent(this, "test", { + agent_name: "my-agent-name", + agent_resource_role_arn: example.arn, + foundation_model: "anthropic.claude-v2", + idle_ttl: 500, + }); + const awsBedrockagentAgentAliasExample = new BedrockagentAgentAlias( + this, + "example_7", + { + agent_alias_name: "my-agent-alias", + agent_id: test.agentId, + description: "Test ALias", + } + ); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + awsBedrockagentAgentAliasExample.overrideLogicalId("example"); + } +} + +``` + +## Argument Reference + +The following arguments are required: + +* `agent_alias_name` - (Required) Name of the alias. +* `agent_id` - (Required) Identifier of the agent to create an alias for. +* `tags` - (Optional) Key-value tags for the place index. If configured with a provider [`defaultTags` 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. + +The following arguments are optional: + +* `description` - (Optional) Description of the alias of the agent. +* `routingConfiguration` - (Optional) Routing configuration of the alias + +### routing_configuration + +This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). + +The following arguments are required: + +* `agentVersion` - (Required) Version of the agent the alias routes to. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `agent_alias_arn` - ARN of the Agent Alias. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +* `create` - (Default `5m`) +* `update` - (Default `5m`) +* `delete` - (Default `5m`) + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent Alias using the `ABCDE12345,FGHIJ67890`. For example: + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { BedrockagentAgentAlias } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + BedrockagentAgentAlias.generateConfigForImport( + this, + "example", + "ABCDE12345,FGHIJ67890" + ); + } +} + +``` + +Using `terraform import`, import Agents for Amazon Bedrock Agent Alias using the `AGENT_ID,ALIAS_ID`. For example: + +```console +% terraform import aws_bedrockagent_agent_alias.example AGENT_ID,ALIAS_ID +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/cloudwatch_event_rule.html.markdown b/website/docs/cdktf/typescript/r/cloudwatch_event_rule.html.markdown index 4c5084c48c53..7347aa59cfc2 100644 --- a/website/docs/cdktf/typescript/r/cloudwatch_event_rule.html.markdown +++ b/website/docs/cdktf/typescript/r/cloudwatch_event_rule.html.markdown @@ -68,6 +68,7 @@ This resource supports the following arguments: * `eventBusName` - (Optional) The name or ARN of the event bus to associate with this rule. If you omit this, the `default` event bus is used. * `eventPattern` - (Optional) The event pattern described a JSON object. At least one of `scheduleExpression` or `eventPattern` is required. See full documentation of [Events and Event Patterns in EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html) for details. **Note**: The event pattern size is 2048 by default but it is adjustable up to 4096 characters by submitting a service quota increase request. See [Amazon EventBridge quotas](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-quota.html) for details. +* `forceDestroy` - (Optional) Used to delete managed rules created by AWS. Defaults to `false`. * `description` - (Optional) The description of the rule. * `roleArn` - (Optional) The Amazon Resource Name (ARN) associated with the role that is used for target invocation. * `isEnabled` - (Optional, **Deprecated** Use `state` instead) Whether the rule should be enabled. @@ -123,4 +124,4 @@ Using `terraform import`, import EventBridge Rules using the `event_bus_name/rul % terraform import aws_cloudwatch_event_rule.console example-event-bus/capture-console-sign-in ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/codebuild_project.html.markdown b/website/docs/cdktf/typescript/r/codebuild_project.html.markdown index 91964ba46d94..8a276e272e62 100644 --- a/website/docs/cdktf/typescript/r/codebuild_project.html.markdown +++ b/website/docs/cdktf/typescript/r/codebuild_project.html.markdown @@ -357,14 +357,14 @@ See [ProjectFileSystemLocation](https://docs.aws.amazon.com/codebuild/latest/API * `gitSubmodulesConfig` - (Optional) Configuration block. Detailed below. * `insecureSsl` - (Optional) Ignore SSL warnings when connecting to source control. * `location` - (Optional) Location of the source code from git or s3. -* `reportBuildStatus` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when your source provider is `GITHUB`, `BITBUCKET`, or `GITHUB_ENTERPRISE`. -* `buildStatusConfig` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is `GITHUB`, `GITHUB_ENTERPRISE`, or `BITBUCKET`. `buildStatusConfig` blocks are documented below. +* `reportBuildStatus` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. +* `buildStatusConfig` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `buildStatusConfig` blocks are documented below. * `sourceIdentifier` - (Required) An identifier for this project source. The identifier can only contain alphanumeric characters and underscores, and must be less than 128 characters in length. -* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET` or `S3`. +* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`. #### secondary_sources: git_submodules_config -This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`. +This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`. * `fetchSubmodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project. @@ -385,13 +385,13 @@ This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_EN * `gitSubmodulesConfig` - (Optional) Configuration block. Detailed below. * `insecureSsl` - (Optional) Ignore SSL warnings when connecting to source control. * `location` - (Optional) Location of the source code from git or s3. -* `reportBuildStatus` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is only valid when the `type` is `BITBUCKET` or `GITHUB`. +* `reportBuildStatus` - (Optional) Whether to report the status of a build's start and finish to your source provider. This option is valid only when your source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. * `buildStatusConfig` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket. `buildStatusConfig` blocks are documented below. * `type` - (Required) Type of repository that contains the source code to be built. Valid values: `BITBUCKET`, `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, `GITLAB_SELF_MANAGED`, `NO_SOURCE`, `S3`. #### source: git_submodules_config -This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`. +This block is only valid when the `type` is `CODECOMMIT`, `GITHUB`, `GITHUB_ENTERPRISE`, `GITLAB`, or `GITLAB_SELF_MANAGED`. * `fetchSubmodules` - (Required) Whether to fetch Git submodules for the AWS CodeBuild build project. @@ -444,4 +444,4 @@ Using `terraform import`, import CodeBuild Project using the `name`. For example % terraform import aws_codebuild_project.name project-name ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/dms_replication_task.html.markdown b/website/docs/cdktf/typescript/r/dms_replication_task.html.markdown index 8bc530a7bb35..99ec8f5933c0 100644 --- a/website/docs/cdktf/typescript/r/dms_replication_task.html.markdown +++ b/website/docs/cdktf/typescript/r/dms_replication_task.html.markdown @@ -64,6 +64,7 @@ This resource supports the following arguments: - Cannot contain two consecutive hyphens. * `replicationTaskSettings` - (Optional) An escaped JSON string that contains the task settings. For a complete list of task settings, see [Task Settings for AWS Database Migration Service Tasks](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html). +* `resourceIdentifier` - (Optional) A friendly name for the resource identifier at the end of the EndpointArn response parameter that is returned in the created Endpoint object. * `sourceEndpointArn` - (Required) The Amazon Resource Name (ARN) string that uniquely identifies the source endpoint. * `startReplicationTask` - (Optional) Whether to run or stop the replication task. * `tableMappings` - (Required) An escaped JSON string that contains the table mappings. For information on table mapping see [Using Table Mapping with an AWS Database Migration Service Task to Select and Filter Data](http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TableMapping.html) @@ -110,4 +111,4 @@ Using `terraform import`, import replication tasks using the `replicationTaskId` % terraform import aws_dms_replication_task.test test-dms-replication-task-tf ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/eip.html.markdown b/website/docs/cdktf/typescript/r/eip.html.markdown index 5de08f7deaaa..aebb1acad1d1 100644 --- a/website/docs/cdktf/typescript/r/eip.html.markdown +++ b/website/docs/cdktf/typescript/r/eip.html.markdown @@ -179,6 +179,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - Contains the EIP allocation ID. * `privateDns` - The Private DNS associated with the Elastic IP address (if in VPC). * `privateIp` - Contains the private IP address (if in VPC). +* `ptrRecord` - The DNS pointer (PTR) record for the IP address. * `publicDns` - Public DNS associated with the Elastic IP address. * `publicIp` - Contains the public IP address. * `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). @@ -223,4 +224,4 @@ Using `terraform import`, import EIPs in a VPC using their Allocation ID. For ex [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_AssociateAddress.html - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/eip_domain_name.html.markdown b/website/docs/cdktf/typescript/r/eip_domain_name.html.markdown new file mode 100644 index 000000000000..35a1d7a47397 --- /dev/null +++ b/website/docs/cdktf/typescript/r/eip_domain_name.html.markdown @@ -0,0 +1,74 @@ +--- +subcategory: "EC2 (Elastic Compute Cloud)" +layout: "aws" +page_title: "AWS: aws_eip_domain_name" +description: |- + Assigns a static reverse DNS record to an Elastic IP addresses +--- + + + +# Resource: aws_eip_domain_name + +Assigns a static reverse DNS record to an Elastic IP addresses. See [Using reverse DNS for email applications](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#Using_Elastic_Addressing_Reverse_DNS). + +## Example Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { Token, TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { Eip } from "./.gen/providers/aws/eip"; +import { EipDomainName } from "./.gen/providers/aws/eip-domain-name"; +import { Route53Record } from "./.gen/providers/aws/route53-record"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + const example = new Eip(this, "example", { + domain: "vpc", + }); + const awsRoute53RecordExample = new Route53Record(this, "example_1", { + name: "reverse", + records: [example.publicIp], + type: "A", + zoneId: main.zoneId, + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + awsRoute53RecordExample.overrideLogicalId("example"); + const awsEipDomainNameExample = new EipDomainName(this, "example_2", { + allocationId: example.allocationId, + domainName: Token.asString(awsRoute53RecordExample.fqdn), + }); + /*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/ + awsEipDomainNameExample.overrideLogicalId("example"); + } +} + +``` + +## Argument Reference + +This resource supports the following arguments: + +* `allocationId` - (Required) The allocation ID. +* `domainName` - (Required) The domain name to modify for the IP address. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `ptrRecord` - The DNS pointer (PTR) record for the IP address. + +## Timeouts + +[Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): + +- `create` - (Default `10m`) +- `update` - (Default `10m`) +- `delete` - (Default `10m`) + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/elasticache_replication_group.html.markdown b/website/docs/cdktf/typescript/r/elasticache_replication_group.html.markdown index 13e84dcb461c..3182d2683f16 100644 --- a/website/docs/cdktf/typescript/r/elasticache_replication_group.html.markdown +++ b/website/docs/cdktf/typescript/r/elasticache_replication_group.html.markdown @@ -322,6 +322,12 @@ The following arguments are optional: * `subnetGroupName` - (Optional) Name of the cache subnet group to be used for the replication group. * `tags` - (Optional) Map of tags to assign to the resource. Adding tags to this resource will add or overwrite any existing tags on the clusters in the replication group and not to the group itself. If configured with a provider [`defaultTags` 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. * `transitEncryptionEnabled` - (Optional) Whether to enable encryption in transit. + Changing this argument with an `engineVersion` < `7.0.5` will force a replacement. + Engine versions prior to `7.0.5` only allow this transit encryption to be configured during creation of the replication group. +* `transit_encryption_mode` - (Optional) A setting that enables clients to migrate to in-transit encryption with no downtime. + Valid values are `preferred` and `required`. + When enabling encryption on an existing replication group, this must first be set to `preferred` before setting it to `required` in a subsequent apply. + See the `TransitEncryptionMode` field in the [`CreateReplicationGroup` API documentation](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateReplicationGroup.html) for additional details. * `userGroupIds` - (Optional) User Group ID to associate with the replication group. Only a maximum of one (1) user group ID is valid. **NOTE:** This argument _is_ a set because the AWS specification allows for multiple IDs. However, in practice, AWS only allows a maximum size of one. ### Log Delivery Configuration @@ -387,4 +393,4 @@ Using `terraform import`, import ElastiCache Replication Groups using the `repli % terraform import aws_elasticache_replication_group.my_replication_group replication-group-1 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/fsx_openzfs_file_system.html.markdown b/website/docs/cdktf/typescript/r/fsx_openzfs_file_system.html.markdown index 67a98b8bb506..5cb275c48441 100644 --- a/website/docs/cdktf/typescript/r/fsx_openzfs_file_system.html.markdown +++ b/website/docs/cdktf/typescript/r/fsx_openzfs_file_system.html.markdown @@ -98,6 +98,7 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - Amazon Resource Name of the file system. * `dnsName` - DNS name for the file system, e.g., `fs-12345678.fsx.us-west-2.amazonaws.com` +* `endpointIpAddress` - IP address of the endpoint that is used to access data or to manage the file system. * `id` - Identifier of the file system, e.g., `fs-12345678` * `networkInterfaceIds` - Set of Elastic Network Interface identifiers from which the file system is accessible The first network interface returned is the primary network interface. * `rootVolumeId` - Identifier of the root volume, e.g., `fsvol-12345678` @@ -178,4 +179,4 @@ class MyConvertedCode extends TerraformStack { ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/glue_job.html.markdown b/website/docs/cdktf/typescript/r/glue_job.html.markdown index febda61ffc30..821fdd842f98 100644 --- a/website/docs/cdktf/typescript/r/glue_job.html.markdown +++ b/website/docs/cdktf/typescript/r/glue_job.html.markdown @@ -197,6 +197,8 @@ This resource supports the following arguments: * For the Standard worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker. * For the G.1X worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and provides 1 executor per worker. Recommended for memory-intensive jobs. * For the G.2X worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and provides 1 executor per worker. Recommended for memory-intensive jobs. + * For the G.4X worker type, each worker maps to 4 DPU (16 vCPUs, 64 GB of memory) with 256GB disk (approximately 235GB free), and provides 1 executor per worker. Recommended for memory-intensive jobs. Only available for Glue version 3.0. Available AWS Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm). + * For the G.8X worker type, each worker maps to 8 DPU (32 vCPUs, 128 GB of memory) with 512GB disk (approximately 487GB free), and provides 1 executor per worker. Recommended for memory-intensive jobs. Only available for Glue version 3.0. Available AWS Regions: US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm). * For the G.025X worker type, each worker maps to 0.25 DPU (2 vCPU, 4GB of memory, 64 GB disk), and provides 1 executor per worker. Recommended for low volume streaming jobs. Only available for Glue version 3.0. * For the Z.2X worker type, each worker maps to 2 M-DPU (8vCPU, 64 GB of m emory, 128 GB disk), and provides up to 8 Ray workers based on the autoscaler. * `numberOfWorkers` - (Optional) The number of workers of a defined workerType that are allocated when a job runs. @@ -252,4 +254,4 @@ Using `terraform import`, import Glue Jobs using `name`. For example: % terraform import aws_glue_job.MyJob MyJob ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/iam_policy.html.markdown b/website/docs/cdktf/typescript/r/iam_policy.html.markdown index f5eb655b25aa..9d4b8fa71c26 100644 --- a/website/docs/cdktf/typescript/r/iam_policy.html.markdown +++ b/website/docs/cdktf/typescript/r/iam_policy.html.markdown @@ -66,6 +66,7 @@ This resource supports the following arguments: This resource exports the following attributes in addition to the arguments above: * `arn` - ARN assigned by AWS to this policy. +* `attachmentCount` - Number of entities (users, groups, and roles) that the policy is attached to. * `id` - ARN assigned by AWS to this policy. * `policyId` - Policy's ID. * `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). @@ -102,4 +103,4 @@ Using `terraform import`, import IAM Policies using the `arn`. For example: % terraform import aws_iam_policy.administrator arn:aws:iam::123456789012:policy/UsersManageOwnCredentials ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/imagebuilder_image.html.markdown b/website/docs/cdktf/typescript/r/imagebuilder_image.html.markdown index 355d87169682..164958d34b1f 100644 --- a/website/docs/cdktf/typescript/r/imagebuilder_image.html.markdown +++ b/website/docs/cdktf/typescript/r/imagebuilder_image.html.markdown @@ -51,9 +51,11 @@ The following arguments are optional: * `containerRecipeArn` - (Optional) - Amazon Resource Name (ARN) of the container recipe. * `distributionConfigurationArn` - (Optional) Amazon Resource Name (ARN) of the Image Builder Distribution Configuration. * `enhancedImageMetadataEnabled` - (Optional) Whether additional information about the image being created is collected. Defaults to `true`. +* `executionRole` - (Optional) Amazon Resource Name (ARN) of the service-linked role to be used by Image Builder to [execute workflows](https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-image-workflows.html). * `imageRecipeArn` - (Optional) Amazon Resource Name (ARN) of the image recipe. * `imageTestsConfiguration` - (Optional) Configuration block with image tests configuration. Detailed below. * `imageScanningConfiguration` - (Optional) Configuration block with image scanning configuration. Detailed below. +* `workflow` - (Optional) Configuration block with the workflow configuration. Detailed below. * `tags` - (Optional) Key-value map of resource tags for the Image Builder Image. If configured with a provider [`defaultTags` 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. ### image_tests_configuration @@ -77,6 +79,25 @@ The following arguments are optional: * `repositoryName` - (Optional) The name of the container repository that Amazon Inspector scans to identify findings for your container images. * `containerTags` - (Optional) Set of tags for Image Builder to apply to the output container image that that Amazon Inspector scans. +### workflow + +The following arguments are required: + +* `workflowArn` - (Required) Amazon Resource Name (ARN) of the Image Builder Workflow. + +The following arguments are optional: + +* `onFailure` - (Optional) The action to take if the workflow fails. Must be one of `CONTINUE` or `ABORT`. +* `parallelGroup` - (Optional) The parallel group in which to run a test Workflow. +* `parameter` - (Optional) Configuration block for the workflow parameters. Detailed below. + +### parameter + +The following arguments are required: + +* `name` - (Required) The name of the Workflow parameter. +* `value` - (Required) The value of the Workflow parameter. + ## Attribute Reference This resource exports the following attributes in addition to the arguments above: @@ -136,4 +157,4 @@ Using `terraform import`, import `aws_imagebuilder_image` resources using the Am % terraform import aws_imagebuilder_image.example arn:aws:imagebuilder:us-east-1:123456789012:image/example/1.0.0/1 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/lb.html.markdown b/website/docs/cdktf/typescript/r/lb.html.markdown index 3dc48253d01e..20cd4e9aeb0a 100644 --- a/website/docs/cdktf/typescript/r/lb.html.markdown +++ b/website/docs/cdktf/typescript/r/lb.html.markdown @@ -158,64 +158,63 @@ class MyConvertedCode extends TerraformStack { This resource supports the following arguments: -* `accessLogs` - (Optional) An Access Logs block. Access Logs documented below. -* `connectionLogs` - (Optional) A Connection Logs block. Connection Logs documented below. Only valid for Load Balancers of type `application`. -* `customerOwnedIpv4Pool` - (Optional) The ID of the customer owned ipv4 pool to use for this load balancer. -* `desyncMitigationMode` - (Optional) Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`. -* `dnsRecordClientRoutingPolicy` - (Optional) Indicates how traffic is distributed among the load balancer Availability Zones. Possible values are `any_availability_zone` (default), `availability_zone_affinity`, or `partial_availability_zone_affinity`. See [Availability Zone DNS affinity](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity) for additional details. Only valid for `network` type load balancers. -* `dropInvalidHeaderFields` - (Optional) Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`. +* `accessLogs` - (Optional) Access Logs block. See below. +* `connectionLogs` - (Optional) Connection Logs block. See below. Only valid for Load Balancers of type `application`. +* `clientKeepAlive` - (Optional) Client keep alive value in seconds. The valid range is 60-604800 seconds. The default is 3600 seconds. +* `customerOwnedIpv4Pool` - (Optional) ID of the customer owned ipv4 pool to use for this load balancer. +* `desyncMitigationMode` - (Optional) How the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`. +* `dnsRecordClientRoutingPolicy` - (Optional) How traffic is distributed among the load balancer Availability Zones. Possible values are `any_availability_zone` (default), `availability_zone_affinity`, or `partial_availability_zone_affinity`. See [Availability Zone DNS affinity](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#zonal-dns-affinity) for additional details. Only valid for `network` type load balancers. +* `dropInvalidHeaderFields` - (Optional) Whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`. * `enableCrossZoneLoadBalancing` - (Optional) If true, cross-zone load balancing of the load balancer will be enabled. For `network` and `gateway` type load balancers, this feature is disabled by default (`false`). For `application` load balancer this feature is always enabled (`true`) and cannot be disabled. Defaults to `false`. * `enableDeletionProtection` - (Optional) If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. Defaults to `false`. -* `enableHttp2` - (Optional) Indicates whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`. -* `enableTlsVersionAndCipherSuiteHeaders` - (Optional) Indicates whether the two headers (`x-amzn-tls-version` and `x-amzn-tls-cipher-suite`), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. Only valid for Load Balancers of type `application`. Defaults to `false` -* `enableXffClientPort` - (Optional) Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in `application` load balancers. Defaults to `false`. -* `enableWafFailOpen` - (Optional) Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`. -* `enforceSecurityGroupInboundRulesOnPrivateLinkTraffic` - (Optional) Indicates whether inbound security group rules are enforced for traffic originating from a PrivateLink. Only valid for Load Balancers of type `network`. The possible values are `on` and `off`. -* `idleTimeout` - (Optional) The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60. +* `enableHttp2` - (Optional) Whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`. +* `enableTlsVersionAndCipherSuiteHeaders` - (Optional) Whether the two headers (`x-amzn-tls-version` and `x-amzn-tls-cipher-suite`), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target. Only valid for Load Balancers of type `application`. Defaults to `false` +* `enableXffClientPort` - (Optional) Whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in `application` load balancers. Defaults to `false`. +* `enableWafFailOpen` - (Optional) Whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`. +* `enforceSecurityGroupInboundRulesOnPrivateLinkTraffic` - (Optional) Whether inbound security group rules are enforced for traffic originating from a PrivateLink. Only valid for Load Balancers of type `network`. The possible values are `on` and `off`. +* `idleTimeout` - (Optional) Time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60. * `internal` - (Optional) If true, the LB will be internal. Defaults to `false`. -* `ipAddressType` - (Optional) The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`. -* `loadBalancerType` - (Optional) The type of load balancer to create. Possible values are `application`, `gateway`, or `network`. The default value is `application`. -* `name` - (Optional) The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters, -must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified, -Terraform will autogenerate a name beginning with `tf-lb`. +* `ipAddressType` - (Optional) Type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`. +* `loadBalancerType` - (Optional) Type of load balancer to create. Possible values are `application`, `gateway`, or `network`. The default value is `application`. +* `name` - (Optional) Name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified, Terraform will autogenerate a name beginning with `tf-lb`. * `namePrefix` - (Optional) Creates a unique name beginning with the specified prefix. Conflicts with `name`. -* `securityGroups` - (Optional) A list of security group IDs to assign to the LB. Only valid for Load Balancers of type `application` or `network`. For load balancers of type `network` security groups cannot be added if none are currently present, and cannot all be removed once added. If either of these conditions are met, this will force a recreation of the resource. -* `preserveHostHeader` - (Optional) Indicates whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. Defaults to `false`. -* `subnetMapping` - (Optional) A subnet mapping block as documented below. For Load Balancers of type `network` subnet mappings can only be added. -* `subnets` - (Optional) A list of subnet IDs to attach to the LB. For Load Balancers of type `network` subnets can only be added (see [Availability Zones](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#availability-zones)), deleting a subnet for load balancers of type `network` will force a recreation of the resource. -* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`defaultTags` 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. +* `securityGroups` - (Optional) List of security group IDs to assign to the LB. Only valid for Load Balancers of type `application` or `network`. For load balancers of type `network` security groups cannot be added if none are currently present, and cannot all be removed once added. If either of these conditions are met, this will force a recreation of the resource. +* `preserveHostHeader` - (Optional) Whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. Defaults to `false`. +* `subnetMapping` - (Optional) Subnet mapping block. See below. For Load Balancers of type `network` subnet mappings can only be added. +* `subnets` - (Optional) List of subnet IDs to attach to the LB. For Load Balancers of type `network` subnets can only be added (see [Availability Zones](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#availability-zones)), deleting a subnet for load balancers of type `network` will force a recreation of the resource. +* `tags` - (Optional) Map of tags to assign to the resource. If configured with a provider [`defaultTags` 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. * `xffHeaderProcessingMode` - (Optional) Determines how the load balancer modifies the `X-Forwarded-For` header in the HTTP request before sending the request to the target. The possible values are `append`, `preserve`, and `remove`. Only valid for Load Balancers of type `application`. The default is `append`. ### access_logs -* `bucket` - (Required) The S3 bucket name to store the logs in. +* `bucket` - (Required) S3 bucket name to store the logs in. * `enabled` - (Optional) Boolean to enable / disable `accessLogs`. Defaults to `false`, even when `bucket` is specified. -* `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured. +* `prefix` - (Optional) S3 bucket prefix. Logs are stored in the root if not configured. ### connection_logs -* `bucket` - (Required) The S3 bucket name to store the logs in. +* `bucket` - (Required) S3 bucket name to store the logs in. * `enabled` - (Optional) Boolean to enable / disable `connectionLogs`. Defaults to `false`, even when `bucket` is specified. -* `prefix` - (Optional) The S3 bucket prefix. Logs are stored in the root if not configured. +* `prefix` - (Optional) S3 bucket prefix. Logs are stored in the root if not configured. ### subnet_mapping * `subnetId` - (Required) ID of the subnet of which to attach to the load balancer. You can specify only one subnet per Availability Zone. -* `allocationId` - (Optional) The allocation ID of the Elastic IP address for an internet-facing load balancer. -* `ipv6Address` - (Optional) The IPv6 address. You associate IPv6 CIDR blocks with your VPC and choose the subnets where you launch both internet-facing and internal Application Load Balancers or Network Load Balancers. -* `privateIpv4Address` - (Optional) The private IPv4 address for an internal load balancer. +* `allocationId` - (Optional) Allocation ID of the Elastic IP address for an internet-facing load balancer. +* `ipv6Address` - (Optional) IPv6 address. You associate IPv6 CIDR blocks with your VPC and choose the subnets where you launch both internet-facing and internal Application Load Balancers or Network Load Balancers. +* `privateIpv4Address` - (Optional) Private IPv4 address for an internal load balancer. ## Attribute Reference This resource exports the following attributes in addition to the arguments above: -* `arn` - The ARN of the load balancer (matches `id`). -* `arnSuffix` - The ARN suffix for use with CloudWatch Metrics. -* `dnsName` - The DNS name of the load balancer. -* `id` - The ARN of the load balancer (matches `arn`). +* `arn` - ARN of the load balancer (matches `id`). +* `arnSuffix` - ARN suffix for use with CloudWatch Metrics. +* `dnsName` - DNS name of the load balancer. +* `id` - ARN of the load balancer (matches `arn`). * `subnet_mapping.*.outpost_id` - ID of the Outpost containing the load balancer. -* `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). -* `zoneId` - The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). +* `tagsAll` - Map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `zoneId` - Canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record). ## Timeouts @@ -257,4 +256,4 @@ Using `terraform import`, import LBs using their ARN. For example: % terraform import aws_lb.bar arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/mwaa_environment.html.markdown b/website/docs/cdktf/typescript/r/mwaa_environment.html.markdown index 0fa1a369d411..fae3c144c29f 100644 --- a/website/docs/cdktf/typescript/r/mwaa_environment.html.markdown +++ b/website/docs/cdktf/typescript/r/mwaa_environment.html.markdown @@ -221,11 +221,13 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The ARN of the MWAA Environment * `createdAt` - The Created At date of the MWAA Environment +* `databaseVpcEndpointService` - The VPC endpoint for the environment's Amazon RDS database * `logging_configuration[0].[0].cloud_watch_log_group_arn` - Provides the ARN for the CloudWatch group where the logs will be published * `serviceRoleArn` - The Service Role ARN of the Amazon MWAA Environment * `status` - The status of the Amazon MWAA Environment * `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). * `webserverUrl` - The webserver URL of the MWAA Environment +* `webserverVpcEndpointService` - The VPC endpoint for the environment's web server ## Timeouts @@ -267,4 +269,4 @@ Using `terraform import`, import MWAA Environment using `Name`. For example: % terraform import aws_mwaa_environment.example MyAirflowEnvironment ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/organizations_account.html.markdown b/website/docs/cdktf/typescript/r/organizations_account.html.markdown index 5d7da05141aa..01756cebf68e 100644 --- a/website/docs/cdktf/typescript/r/organizations_account.html.markdown +++ b/website/docs/cdktf/typescript/r/organizations_account.html.markdown @@ -62,6 +62,7 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The ARN for this account. * `govcloudId` - ID for a GovCloud account created with the account. * `id` - The AWS account id +* `status` - The status of the account in the organization. * `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ## Import @@ -123,4 +124,4 @@ class MyConvertedCode extends TerraformStack { ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/organizations_organization.html.markdown b/website/docs/cdktf/typescript/r/organizations_organization.html.markdown index 31c9179cb190..db4252ead579 100644 --- a/website/docs/cdktf/typescript/r/organizations_organization.html.markdown +++ b/website/docs/cdktf/typescript/r/organizations_organization.html.markdown @@ -65,6 +65,7 @@ This resource exports the following attributes in addition to the arguments abov * `masterAccountArn` - ARN of the master account * `masterAccountEmail` - Email address of the master account * `masterAccountId` - Identifier of the master account +* `masterAccountName` - Name of the master account * `nonMasterAccounts` - List of organization accounts excluding the master account. For a list including the master account, see the `accounts` attribute. All elements have these attributes: * `arn` - ARN of the account * `email` - Email of the account @@ -111,4 +112,4 @@ Using `terraform import`, import the AWS organization using the `id`. For exampl % terraform import aws_organizations_organization.my_org o-1234567 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/signer_signing_profile.html.markdown b/website/docs/cdktf/typescript/r/signer_signing_profile.html.markdown index a537a5e8dc24..43c7103df1a4 100644 --- a/website/docs/cdktf/typescript/r/signer_signing_profile.html.markdown +++ b/website/docs/cdktf/typescript/r/signer_signing_profile.html.markdown @@ -48,12 +48,26 @@ class MyConvertedCode extends TerraformStack { ## Argument Reference -* `platformId` - (Required) The ID of the platform that is used by the target signing profile. -* `name` - (Optional) A unique signing profile name. By default generated by Terraform. Signing profile names are immutable and cannot be reused after canceled. -* `namePrefix` - (Optional) A signing profile name prefix. Terraform will generate a unique suffix. Conflicts with `name`. -* `signatureValidityPeriod` - (Optional) The validity period for a signing job. +* `platformId` - (Required, Forces new resource) The ID of the platform that is used by the target signing profile. +* `name` - (Optional, Forces new resource) A unique signing profile name. By default generated by Terraform. Signing profile names are immutable and cannot be reused after canceled. +* `namePrefix` - (Optional, Forces new resource) A signing profile name prefix. Terraform will generate a unique suffix. Conflicts with `name`. +* `signatureValidityPeriod` - (Optional, Forces new resource) The validity period for a signing job. See [`signatureValidityPeriod` Block](#signature_validity_period-block) below for details. +* `signingMaterial` - (Optional, Forces new resource) The AWS Certificate Manager certificate that will be used to sign code with the new signing profile. See [`signingMaterial` Block](#signing_material-block) below for details. * `tags` - (Optional) A list of tags associated with the signing profile. If configured with a provider [`defaultTags` 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. +### `signatureValidityPeriod` Block + +The `signatureValidityPeriod` configuration block supports the following arguments: + +* `type` - (Required, Forces new resource) The time unit for signature validity. Valid values: `DAYS`, `MONTHS`, `YEARS`. +* `value` - (Required, Forces new resource) The numerical value of the time unit for signature validity. + +### `signingMaterial` Block + +The `signingMaterial` configuration block supports the following arguments: + +* `certificateArn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the certificates that is used to sign your code. + ## Attribute Reference This resource exports the following attributes in addition to the arguments above: @@ -61,11 +75,19 @@ This resource exports the following attributes in addition to the arguments abov * `arn` - The Amazon Resource Name (ARN) for the signing profile. * `name` - The name of the target signing profile. * `platformDisplayName` - A human-readable name for the signing platform associated with the signing profile. -* `revocationRecord` - Revocation information for a signing profile. +* `revocationRecord` - Revocation information for a signing profile. See [`revocationRecord` Block](#revocation_record-block) below for details. * `status` - The status of the target signing profile. -* `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). * `version` - The current version of the signing profile. * `versionArn` - The signing profile ARN, including the profile version. +* `tagsAll` - A map of tags assigned to the resource, including those inherited from the provider [`defaultTags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). + +### `revocationRecord` Block + +The `revocationRecord` configuration block supports the following attributes: + +* `revocation_effective_from` - The time when revocation becomes effective. +* `revoked_at` - The time when the signing profile was revoked. +* `revoked_by` - The identity of the revoker. ## Import @@ -99,4 +121,4 @@ Using `terraform import`, import Signer signing profiles using the `name`. For e % terraform import aws_signer_signing_profile.test_signer_signing_profile test_sp_DdW3Mk1foYL88fajut4mTVFGpuwfd4ACO6ANL0D1uIj7lrn8adK ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/transfer_connector.html.markdown b/website/docs/cdktf/typescript/r/transfer_connector.html.markdown index 3a02df10a475..ac7d0e03fbc7 100644 --- a/website/docs/cdktf/typescript/r/transfer_connector.html.markdown +++ b/website/docs/cdktf/typescript/r/transfer_connector.html.markdown @@ -81,6 +81,7 @@ This resource supports the following arguments: * `accessRole` - (Required) The IAM Role which provides read and write access to the parent directory of the file location mentioned in the StartFileTransfer request. * `as2Config` - (Optional) Either SFTP or AS2 is configured.The parameters to configure for the connector object. Fields documented below. * `loggingRole` - (Optional) The IAM Role which is required for allowing the connector to turn on CloudWatch logging for Amazon S3 events. +* `securityPolicyName` - (Optional) Name of the security policy for the connector. * `sftpConfig` - (Optional) Either SFTP or AS2 is configured.The parameters to configure for the connector object. Fields documented below. * `url` - (Required) The URL of the partners AS2 endpoint or SFTP endpoint. * `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`defaultTags` 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. @@ -140,4 +141,4 @@ Using `terraform import`, import Transfer AS2 Connector using the `connectorId`. % terraform import aws_transfer_connector.example c-4221a88afd5f4362a ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/verifiedpermissions_policy.html.markdown b/website/docs/cdktf/typescript/r/verifiedpermissions_policy.html.markdown new file mode 100644 index 000000000000..5d5cb910d6bd --- /dev/null +++ b/website/docs/cdktf/typescript/r/verifiedpermissions_policy.html.markdown @@ -0,0 +1,119 @@ +--- +subcategory: "Verified Permissions" +layout: "aws" +page_title: "AWS: aws_verifiedpermissions_policy" +description: |- + Terraform resource for managing an AWS Verified Permissions Policy. +--- + + + +# Resource: aws_verifiedpermissions_policy + +Terraform resource for managing an AWS Verified Permissions Policy. + +## Example Usage + +### Basic Usage + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { VerifiedpermissionsPolicy } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + new VerifiedpermissionsPolicy(this, "test", { + definition: [ + { + static: [ + { + statement: + 'permit (principal, action == Action::\\"view\\", resource in Album:: \\"test_album\\");', + }, + ], + }, + ], + policy_store_id: awsVerifiedpermissionsPolicyStoreTest.id, + }); + } +} + +``` + +## Argument Reference + +The following arguments are required: + +* `policyStoreId` - (Required) The Policy Store ID of the policy store. +* `definition`- (Required) The definition of the policy. See [Definition](#definition) below. + +The following arguments are optional: + +* `optional_arg` - (Optional) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +### Definition + +* `static` - (Optional) The static policy statement. See [Static](#static) below. +* `template_linked` - (Optional) The template linked policy. See [Template Linked](#template-linked) below. + +#### Static + +* `description` - (Optional) The description of the static policy. +* `statement` - (Required) The statement of the static policy. + +#### Template Linked + +* `policyTemplateId` - (Required) The ID of the template. +* `principal` - (Optional) The principal of the template linked policy. + * `entityId` - (Required) The entity ID of the principal. + * `entity_type` - (Required) The entity type of the principal. +* `resource` - (Optional) The resource of the template linked policy. + * `entityId` - (Required) The entity ID of the resource. + * `entity_type` - (Required) The entity type of the resource. + +## Attribute Reference + +This resource exports the following attributes in addition to the arguments above: + +* `arn` - ARN of the Policy. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. +* `example_attribute` - Concise description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information. + +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Verified Permissions Policy using the `policy_id,policy_store_id`. For example: + +```typescript +// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug +import { Construct } from "constructs"; +import { TerraformStack } from "cdktf"; +/* + * Provider bindings are generated by running `cdktf get`. + * See https://cdk.tf/provider-generation for more details. + */ +import { VerifiedpermissionsPolicy } from "./.gen/providers/aws/"; +class MyConvertedCode extends TerraformStack { + constructor(scope: Construct, name: string) { + super(scope, name); + VerifiedpermissionsPolicy.generateConfigForImport( + this, + "example", + "policy-id-12345678,policy-store-id-12345678" + ); + } +} + +``` + +Using `terraform import`, import Verified Permissions Policy using the `policy_id,policy_store_id`. For example: + +```console +% terraform import aws_verifiedpermissions_policy.example policy-id-12345678,policy-store-id-12345678 +``` + + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/vpc_dhcp_options.html.markdown b/website/docs/cdktf/typescript/r/vpc_dhcp_options.html.markdown index 278dfd19fad6..9ae5d6fba92b 100644 --- a/website/docs/cdktf/typescript/r/vpc_dhcp_options.html.markdown +++ b/website/docs/cdktf/typescript/r/vpc_dhcp_options.html.markdown @@ -53,6 +53,7 @@ class MyConvertedCode extends TerraformStack { new VpcDhcpOptions(this, "foo", { domainName: "service.consul", domainNameServers: ["127.0.0.1", "10.0.0.2"], + ipv6AddressPreferredLeaseTime: Token.asString(1440), netbiosNameServers: ["127.0.0.1"], netbiosNodeType: Token.asString(2), ntpServers: ["127.0.0.1"], @@ -71,6 +72,7 @@ This resource supports the following arguments: * `domainName` - (Optional) the suffix domain name to use by default when resolving non Fully Qualified Domain Names. In other words, this is what ends up being the `search` value in the `/etc/resolv.conf` file. * `domainNameServers` - (Optional) List of name servers to configure in `/etc/resolv.conf`. If you want to use the default AWS nameservers you should set this to `AmazonProvidedDNS`. +* `ipv6AddressPreferredLeaseTime` - (Optional) How frequently, in seconds, a running instance with an IPv6 assigned to it goes through DHCPv6 lease renewal. Acceptable values are between 140 and 2147483647 (approximately 68 years). If no value is entered, the default lease time is 140 seconds. If you use long-term addressing for EC2 instances, you can increase the lease time and avoid frequent lease renewal requests. Lease renewal typically occurs when half of the lease time has elapsed. * `ntpServers` - (Optional) List of NTP servers to configure. * `netbiosNameServers` - (Optional) List of NETBIOS name servers. * `netbiosNodeType` - (Optional) The NetBIOS node type (1, 2, 4, or 8). AWS recommends to specify 2 since broadcast and multicast are not supported in their network. For more information about these node types, see [RFC 2132](http://www.ietf.org/rfc/rfc2132.txt). @@ -124,4 +126,4 @@ Using `terraform import`, import VPC DHCP Options using the DHCP Options `id`. F % terraform import aws_vpc_dhcp_options.my_options dopt-d9070ebb ``` - \ No newline at end of file + \ No newline at end of file diff --git a/website/docs/cdktf/typescript/r/vpc_ipam_pool.html.markdown b/website/docs/cdktf/typescript/r/vpc_ipam_pool.html.markdown index 2ff9a86842ea..68797b5af169 100644 --- a/website/docs/cdktf/typescript/r/vpc_ipam_pool.html.markdown +++ b/website/docs/cdktf/typescript/r/vpc_ipam_pool.html.markdown @@ -110,6 +110,7 @@ This resource supports the following arguments: * `autoImport` - (Optional) If you include this argument, IPAM automatically imports any VPCs you have in your scope that fall within the CIDR range in the pool. * `awsService` - (Optional) Limits which AWS service the pool can be used in. Only useable on public scopes. Valid Values: `ec2`. +* `cascade` - (Optional) Enables you to quickly delete an IPAM pool and all resources within that pool, including provisioned CIDRs, allocations, and other pools. * `description` - (Optional) A description for the IPAM pool. * `ipamScopeId` - (Required) The ID of the scope in which you would like to create the IPAM pool. * `locale` - (Optional) The locale in which you would like to create the IPAM pool. Locale is the Region where you want to make an IPAM pool available for allocations. You can only create pools with locales that match the operating Regions of the IPAM. You can only create VPCs from a pool whose locale matches the VPC's Region. Possible values: Any AWS region, such as `us-east-1`. @@ -159,4 +160,4 @@ Using `terraform import`, import IPAMs using the IPAM pool `id`. For example: % terraform import aws_vpc_ipam_pool.example ipam-pool-0958f95207d978e1e ``` - \ No newline at end of file + \ No newline at end of file From cf011c3f0e02eea879c5c0cf78fcd15d62dddf9e Mon Sep 17 00:00:00 2001 From: changelogbot Date: Mon, 22 Apr 2024 11:38:05 +0000 Subject: [PATCH 038/137] Update CHANGELOG.md for #37029 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63dba978b83d..85c3ba7bdeb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,13 @@ FEATURES: * **New Resource:** `aws_bedrockagent_agent` ([#36851](https://github.com/hashicorp/terraform-provider-aws/issues/36851)) * **New Resource:** `aws_bedrockagent_agent_action_group` ([#36935](https://github.com/hashicorp/terraform-provider-aws/issues/36935)) * **New Resource:** `aws_bedrockagent_agent_alias` ([#36905](https://github.com/hashicorp/terraform-provider-aws/issues/36905)) +* **New Resource:** `aws_verifiedpermissions_policy` ([#35413](https://github.com/hashicorp/terraform-provider-aws/issues/35413)) ENHANCEMENTS: * resource/aws_elasticache_replication_group: Add `transit_encryption_mode` argument ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) * resource/aws_elasticache_replication_group: Changes to the `transit_encryption_enabled` argument can now be done in-place for engine versions > `7.0.5` ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) +* resource/aws_kinesis_firehose_delivery_stream: Add `snowflake_configuration` argument ([#36646](https://github.com/hashicorp/terraform-provider-aws/issues/36646)) BUG FIXES: From f9dd1ef5c60a94c154323cdb26eeed4fec0b4ba9 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 08:29:13 -0400 Subject: [PATCH 039/137] Add 'TestAccAPIGatewayResource_withSleep'. --- internal/service/apigateway/resource_test.go | 50 ++++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/internal/service/apigateway/resource_test.go b/internal/service/apigateway/resource_test.go index 5cb2fbf41c5b..83430888a5a8 100644 --- a/internal/service/apigateway/resource_test.go +++ b/internal/service/apigateway/resource_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "testing" + "time" "github.com/aws/aws-sdk-go-v2/service/apigateway" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" @@ -111,6 +112,37 @@ func TestAccAPIGatewayResource_disappears(t *testing.T) { }) } +// https://github.com/hashicorp/terraform-provider-aws/issues/37007. +func TestAccAPIGatewayResource_withSleep(t *testing.T) { + ctx := acctest.Context(t) + var conf apigateway.GetResourceOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_api_gateway_resource.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckAPIGatewayTypeEDGE(t) }, + ErrorCheck: acctest.ErrorCheck(t, names.APIGatewayServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckResourceDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccResourceConfig_base(rName), + Check: resource.ComposeTestCheckFunc( + acctest.CheckSleep(t, 10*time.Second), + ), + }, + { + Config: testAccResourceConfig_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckResourceExists(ctx, resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "path", "/test"), + resource.TestCheckResourceAttr(resourceName, "path_part", "test"), + ), + }, + }, + }) +} + func testAccCheckResourceExists(ctx context.Context, n string, v *apigateway.GetResourceOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -169,30 +201,30 @@ func testAccResourceImportStateIdFunc(resourceName string) resource.ImportStateI } } -func testAccResourceConfig_basic(rName string) string { +func testAccResourceConfig_base(rName string) string { return fmt.Sprintf(` resource "aws_api_gateway_rest_api" "test" { - name = "%s" + name = %[1]q +} +`, rName) } +func testAccResourceConfig_basic(rName string) string { + return acctest.ConfigCompose(testAccResourceConfig_base(rName), ` resource "aws_api_gateway_resource" "test" { rest_api_id = aws_api_gateway_rest_api.test.id parent_id = aws_api_gateway_rest_api.test.root_resource_id path_part = "test" } -`, rName) +`) } func testAccResourceConfig_updatePathPart(rName string) string { - return fmt.Sprintf(` -resource "aws_api_gateway_rest_api" "test" { - name = "%s" -} - + return acctest.ConfigCompose(testAccResourceConfig_base(rName), ` resource "aws_api_gateway_resource" "test" { rest_api_id = aws_api_gateway_rest_api.test.id parent_id = aws_api_gateway_rest_api.test.root_resource_id path_part = "test_changed" } -`, rName) +`) } From e78fd80ec42f507f6ccd2bb6d88a74d09d07e52d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 08:29:22 -0400 Subject: [PATCH 040/137] Acceptance test output: % make testacc TESTARGS='-run=TestAccAPIGatewayResource_' PKG=apigateway ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.2 test ./internal/service/apigateway/... -v -count 1 -parallel 20 -run=TestAccAPIGatewayResource_ -timeout 360m === RUN TestAccAPIGatewayResource_basic === PAUSE TestAccAPIGatewayResource_basic === RUN TestAccAPIGatewayResource_update === PAUSE TestAccAPIGatewayResource_update === RUN TestAccAPIGatewayResource_disappears === PAUSE TestAccAPIGatewayResource_disappears === RUN TestAccAPIGatewayResource_withSleep === PAUSE TestAccAPIGatewayResource_withSleep === CONT TestAccAPIGatewayResource_basic === CONT TestAccAPIGatewayResource_disappears === CONT TestAccAPIGatewayResource_withSleep === CONT TestAccAPIGatewayResource_update --- PASS: TestAccAPIGatewayResource_basic (24.50s) --- PASS: TestAccAPIGatewayResource_disappears (61.87s) --- PASS: TestAccAPIGatewayResource_withSleep (93.56s) --- PASS: TestAccAPIGatewayResource_update (124.28s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/apigateway 134.632s From 9c3e9d98f046488f58a00cb4b01a2bd06cb39fb1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:31:49 -0400 Subject: [PATCH 041/137] build(deps): bump github.com/aws/aws-sdk-go in /.ci/providerlint (#37032) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.51.24 to 1.51.25. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.24...v1.51.25) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .ci/providerlint/go.mod | 2 +- .ci/providerlint/go.sum | 4 ++-- .ci/providerlint/vendor/modules.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/providerlint/go.mod b/.ci/providerlint/go.mod index e28d8d126111..cc198a4e4d97 100644 --- a/.ci/providerlint/go.mod +++ b/.ci/providerlint/go.mod @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint go 1.22 require ( - github.com/aws/aws-sdk-go v1.51.24 + github.com/aws/aws-sdk-go v1.51.25 github.com/bflad/tfproviderlint v0.29.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 golang.org/x/tools v0.13.0 diff --git a/.ci/providerlint/go.sum b/.ci/providerlint/go.sum index 69cd34dfa05c..c548e16a77a9 100644 --- a/.ci/providerlint/go.sum +++ b/.ci/providerlint/go.sum @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/aws/aws-sdk-go v1.51.24 h1:nwL5MaommPkwb7Ixk24eWkdx5HY4of1gD10kFFVAl6A= -github.com/aws/aws-sdk-go v1.51.24/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.25 h1:DjTT8mtmsachhV6yrXR8+yhnG6120dazr720nopRsls= +github.com/aws/aws-sdk-go v1.51.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow= diff --git a/.ci/providerlint/vendor/modules.txt b/.ci/providerlint/vendor/modules.txt index b2585bd5c365..d45e3117051d 100644 --- a/.ci/providerlint/vendor/modules.txt +++ b/.ci/providerlint/vendor/modules.txt @@ -28,7 +28,7 @@ github.com/agext/levenshtein # github.com/apparentlymart/go-textseg/v15 v15.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v15/textseg -# github.com/aws/aws-sdk-go v1.51.24 +# github.com/aws/aws-sdk-go v1.51.25 ## explicit; go 1.19 github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/endpoints From 112265ff17629fa82443933f0be3ed408d938861 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:32:04 -0400 Subject: [PATCH 042/137] build(deps): bump the aws-sdk-go group with 2 updates (#37031) Bumps the aws-sdk-go group with 2 updates: [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) and [github.com/aws/aws-sdk-go-v2/service/internetmonitor](https://github.com/aws/aws-sdk-go-v2). Updates `github.com/aws/aws-sdk-go` from 1.51.24 to 1.51.25 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.24...v1.51.25) Updates `github.com/aws/aws-sdk-go-v2/service/internetmonitor` from 1.13.0 to 1.14.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.14.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/internetmonitor dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index bf2251733161..c28905da16a7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.2 github.com/YakDriver/go-version v0.1.0 github.com/YakDriver/regexache v0.23.0 - github.com/aws/aws-sdk-go v1.51.24 + github.com/aws/aws-sdk-go v1.51.25 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/config v1.27.11 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 @@ -94,7 +94,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/iam v1.32.0 github.com/aws/aws-sdk-go-v2/service/identitystore v1.23.5 github.com/aws/aws-sdk-go-v2/service/inspector2 v1.24.4 - github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0 + github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0 github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5 github.com/aws/aws-sdk-go-v2/service/kafka v1.31.3 github.com/aws/aws-sdk-go-v2/service/kendra v1.50.1 diff --git a/go.sum b/go.sum index 76ab48f31e2f..7094bb13a273 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.51.24 h1:nwL5MaommPkwb7Ixk24eWkdx5HY4of1gD10kFFVAl6A= -github.com/aws/aws-sdk-go v1.51.24/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.25 h1:DjTT8mtmsachhV6yrXR8+yhnG6120dazr720nopRsls= +github.com/aws/aws-sdk-go v1.51.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -218,8 +218,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/g github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 h1:f9RyWNtS8oH7cZlbn+/JNPpjUk5+5fLd5lM9M0i49Ys= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5/go.mod h1:h5CoMZV2VF297/VLhRhO1WF+XYWOzXo+4HsObA4HjBQ= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0 h1:AnbQdsKqNM5yxpWsJFH69cTuQvCAhF1jlA6mWGcNqbM= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0/go.mod h1:71th0isZef+quIOFAqbzFzV67NFkCpMhqogzqPCFSUE= +github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0 h1:6qjUIJWzm5CCOs/F2ZjC5TY/fmy+Ed6P9rJGXJjDg04= +github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0/go.mod h1:71th0isZef+quIOFAqbzFzV67NFkCpMhqogzqPCFSUE= github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5 h1:g5m7QODn5LRm9gWyL2AZl1De7QQQnNEeb5g1o3qmHio= github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5/go.mod h1:DWOHVe8yf0vrA6DStGG7FQ6GslgVPZljr13WjO3eGo0= github.com/aws/aws-sdk-go-v2/service/kafka v1.31.3 h1:B5/wxR5V2LIUKU7B6vS7RvP2GZg8Dn65NxmaeLgfOGk= From 38c5ed8f2ce1561239ce640fcf581be2122e982b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:32:43 -0400 Subject: [PATCH 043/137] build(deps): bump actions/checkout from 4.1.2 to 4.1.3 (#37033) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9bb56186c3b09b4f86b1c65136769dd318469633...1d96c772d19495a3b5c517cd2bc0cb401ea0529f) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/acctest-terraform-lint.yml | 4 ++-- .github/workflows/changelog_misspell.yml | 2 +- .github/workflows/copyright.yml | 2 +- .github/workflows/dependencies.yml | 2 +- .github/workflows/documentation.yml | 6 +++--- .github/workflows/examples.yml | 4 ++-- .github/workflows/gen-teamcity.yml | 2 +- .github/workflows/generate_changelog.yml | 2 +- .github/workflows/golangci-lint.yml | 4 ++-- .github/workflows/goreleaser-ci.yml | 6 +++--- .github/workflows/library_versions.yml | 4 ++-- .github/workflows/milestone.yml | 2 +- .github/workflows/mkdocs.yml | 2 +- .github/workflows/provider.yml | 18 +++++++++--------- .github/workflows/providerlint.yml | 2 +- .github/workflows/pull_request_target.yml | 4 ++-- .github/workflows/release.yml | 6 +++--- .github/workflows/resource-counts.yml | 2 +- .github/workflows/semgrep-ci.yml | 14 +++++++------- .github/workflows/skaff.yml | 2 +- .github/workflows/snapshot.yml | 2 +- .github/workflows/website.yml | 14 +++++++------- .github/workflows/workflow-lint.yml | 2 +- .github/workflows/yamllint.yml | 2 +- 24 files changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/acctest-terraform-lint.yml b/.github/workflows/acctest-terraform-lint.yml index 8dcd065b0f08..be333dd75a40 100644 --- a/.github/workflows/acctest-terraform-lint.yml +++ b/.github/workflows/acctest-terraform-lint.yml @@ -17,7 +17,7 @@ jobs: terrafmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -45,7 +45,7 @@ jobs: TEST_FILES_PARTITION: '\./internal/service/${{ matrix.path }}.*/.*_test\.go' steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/changelog_misspell.yml b/.github/workflows/changelog_misspell.yml index 601eff4bbeeb..a0ac4ccf6d70 100644 --- a/.github/workflows/changelog_misspell.yml +++ b/.github/workflows/changelog_misspell.yml @@ -14,7 +14,7 @@ jobs: misspell: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 86df15935297..7f2d8a7ed31b 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -19,7 +19,7 @@ jobs: name: add headers check runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 70fd17e0d11b..4475e50fbc52 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -70,7 +70,7 @@ jobs: name: go mod runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: .go-version diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 0db983d5fc7c..1937da06d858 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,7 +17,7 @@ jobs: env: UV_THREADPOOL_SIZE: 128 steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: YakDriver/md-check-links@7450f426b758f0bf97f99ceb1aadcf57640a9ede # v2.0.6 with: use-quiet-mode: 'yes' @@ -30,14 +30,14 @@ jobs: markdown-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0 with: args: 'docs' misspell: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 671428e54557..23ff12ec45aa 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -18,7 +18,7 @@ jobs: tflint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 @@ -67,7 +67,7 @@ jobs: env: TF_IN_AUTOMATION: "1" steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 diff --git a/.github/workflows/gen-teamcity.yml b/.github/workflows/gen-teamcity.yml index 5dc7e73fb284..4a14c7dc5421 100644 --- a/.github/workflows/gen-teamcity.yml +++ b/.github/workflows/gen-teamcity.yml @@ -13,7 +13,7 @@ jobs: name: Validate TeamCity Configuration runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: distribution: adopt diff --git a/.github/workflows/generate_changelog.yml b/.github/workflows/generate_changelog.yml index 9e59cd273d2b..18325a2f6dbd 100644 --- a/.github/workflows/generate_changelog.yml +++ b/.github/workflows/generate_changelog.yml @@ -8,7 +8,7 @@ jobs: if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 02c9b4c4f029..3a35f107ae07 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -21,7 +21,7 @@ jobs: name: 1 of 2 runs-on: [custom, linux, large] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -44,7 +44,7 @@ jobs: needs: [golangci-linta] runs-on: [custom, linux, xl] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/goreleaser-ci.yml b/.github/workflows/goreleaser-ci.yml index efd4a5064006..9776a3d8fbe7 100644 --- a/.github/workflows/goreleaser-ci.yml +++ b/.github/workflows/goreleaser-ci.yml @@ -23,7 +23,7 @@ jobs: outputs: goreleaser: ${{ steps.filter.outputs.goreleaser }} steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: filter with: @@ -37,7 +37,7 @@ jobs: if: ${{ needs.changes.outputs.goreleaser == 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -57,7 +57,7 @@ jobs: # Ref: https://github.com/hashicorp/terraform-provider-aws/issues/8988 runs-on: [custom, linux, small] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/library_versions.yml b/.github/workflows/library_versions.yml index b1b779b686c9..6fe7dd4faad4 100644 --- a/.github/workflows/library_versions.yml +++ b/.github/workflows/library_versions.yml @@ -20,10 +20,10 @@ jobs: found: ${{ steps.diff.outputs.found }} steps: # checkout base ref - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 # checkout pull request head ref - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml index d93afbe18631..dede0ec45d9c 100644 --- a/.github/workflows/milestone.yml +++ b/.github/workflows/milestone.yml @@ -27,7 +27,7 @@ jobs: MILESTONE: ${{ github.event.milestone.number }} steps: - name: 'Checkout Repo' - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - name: 'Remove Prioritized Label' env: diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 297d0662ec86..0a95dfa4b6c1 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout main - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - name: Deploy docs uses: mhausenblas/mkdocs-deploy-gh-pages@d77dd03172e96abbcdb081d8c948224762033653 # 1.26 diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index a45e470ae989..a9544928c543 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -31,7 +31,7 @@ jobs: name: go mod download runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -50,7 +50,7 @@ jobs: needs: [go_mod_download] runs-on: [custom, linux, medium] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 continue-on-error: true id: cache-terraform-plugin-dir @@ -86,7 +86,7 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -118,7 +118,7 @@ jobs: needs: [go_build] runs-on: [custom, linux, xl] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 @@ -147,7 +147,7 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -178,7 +178,7 @@ jobs: needs: [go_build] runs-on: [custom, linux, medium] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 @@ -236,7 +236,7 @@ jobs: needs: [go_build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 continue-on-error: true id: cache-terraform-providers-schema @@ -271,7 +271,7 @@ jobs: needs: [terraform_providers_schema] runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod @@ -302,7 +302,7 @@ jobs: markdown-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0 with: args: "." diff --git a/.github/workflows/providerlint.yml b/.github/workflows/providerlint.yml index c1ca232e4eb4..c99495f7f8be 100644 --- a/.github/workflows/providerlint.yml +++ b/.github/workflows/providerlint.yml @@ -17,7 +17,7 @@ jobs: providerlint: runs-on: [custom, linux, medium] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 3708e50bed37..537c1af9e3f4 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout Repo' - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - name: 'Apply Labels' uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 @@ -186,7 +186,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - name: 'Get Current Milestone Name' id: get-current-milestone diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3db6cd60be2..a7a9b977831c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: release-notes: runs-on: macos-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - name: Generate Release Notes @@ -48,7 +48,7 @@ jobs: outputs: tag: ${{ steps.highest-version-tag.outputs.tag }} steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: # Allow tag to be fetched when ref is a commit fetch-depth: 0 @@ -66,7 +66,7 @@ jobs: if: github.ref_name == needs.highest-version-tag.outputs.tag runs-on: macos-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 ref: main diff --git a/.github/workflows/resource-counts.yml b/.github/workflows/resource-counts.yml index 3bfcb15b5c1a..ba291ebd4ef3 100644 --- a/.github/workflows/resource-counts.yml +++ b/.github/workflows/resource-counts.yml @@ -18,7 +18,7 @@ jobs: installation_retrieval_mode: id installation_retrieval_payload: ${{ secrets.INSTALLATION_ID }} private_key: ${{secrets.APP_PEM }} - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: | touch main.tf cat << EOF > main.tf diff --git a/.github/workflows/semgrep-ci.yml b/.github/workflows/semgrep-ci.yml index c4b53b0fce17..baae01147ca4 100644 --- a/.github/workflows/semgrep-ci.yml +++ b/.github/workflows/semgrep-ci.yml @@ -24,7 +24,7 @@ jobs: container: image: "returntocorp/semgrep:1.52.0" steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: | semgrep --validate \ --config .ci/.semgrep.yml \ @@ -47,7 +47,7 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-caps-aws-ec2.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-caps-aws-ec2.yml @@ -58,7 +58,7 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-configs.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-configs.yml @@ -69,7 +69,7 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-service-name0.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-service-name0.yml @@ -80,7 +80,7 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-service-name1.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-service-name1.yml @@ -91,7 +91,7 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-service-name2.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-service-name2.yml @@ -102,6 +102,6 @@ jobs: image: "returntocorp/semgrep:1.52.0" if: (github.action != 'dependabot[bot]') steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - run: semgrep --validate --config .ci/.semgrep-service-name3.yml - run: semgrep $COMMON_PARAMS --config .ci/.semgrep-service-name3.yml diff --git a/.github/workflows/skaff.yml b/.github/workflows/skaff.yml index a268dba296ff..b1e44ab554fc 100644 --- a/.github/workflows/skaff.yml +++ b/.github/workflows/skaff.yml @@ -15,7 +15,7 @@ jobs: name: Compile skaff runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 2a13f75b542d..88857816cd93 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -9,7 +9,7 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: go.mod diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 406bec9ef161..cf587dac5279 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -20,7 +20,7 @@ jobs: markdown-link-check-a-h-markdown: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: YakDriver/md-check-links@7450f426b758f0bf97f99ceb1aadcf57640a9ede # v2.0.6 name: markdown-link-check website/docs/**/[a-h].markdown with: @@ -36,7 +36,7 @@ jobs: markdown-link-check-i-z-markdown: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: YakDriver/md-check-links@7450f426b758f0bf97f99ceb1aadcf57640a9ede # v2.0.6 name: markdown-link-check website/docs/**/[i-z].markdown with: @@ -52,7 +52,7 @@ jobs: markdown-link-check-md: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: YakDriver/md-check-links@7450f426b758f0bf97f99ceb1aadcf57640a9ede # v2.0.6 name: markdown-link-check website/docs/**/*.md with: @@ -70,7 +70,7 @@ jobs: markdown-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0 with: args: "website/docs" @@ -80,7 +80,7 @@ jobs: misspell: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: .ci/tools/go.mod @@ -96,7 +96,7 @@ jobs: terrafmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: .ci/tools/go.mod @@ -112,7 +112,7 @@ jobs: tflint: runs-on: [custom, linux, xl] steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 with: fetch-depth: 0 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 diff --git a/.github/workflows/workflow-lint.yml b/.github/workflows/workflow-lint.yml index 5deee0b50b47..a6914f2f69ea 100644 --- a/.github/workflows/workflow-lint.yml +++ b/.github/workflows/workflow-lint.yml @@ -12,7 +12,7 @@ jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version-file: .ci/tools/go.mod diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml index d49d69cb86b9..f14659466dd6 100644 --- a/.github/workflows/yamllint.yml +++ b/.github/workflows/yamllint.yml @@ -12,7 +12,7 @@ jobs: yamllint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 - name: Run yamllint uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 with: From c6c1017b036f0ca8a0311a83f18084cd952d7ab6 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 08:54:04 -0400 Subject: [PATCH 044/137] aws_api_gateway_rest_api: Restore pre-v5.45.0 'root_resource_id' logic. --- internal/service/apigateway/rest_api.go | 18 ++++++++++++++- .../apigateway/rest_api_data_source.go | 22 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/internal/service/apigateway/rest_api.go b/internal/service/apigateway/rest_api.go index 4355a471ad2a..19eecf9be8a0 100644 --- a/internal/service/apigateway/rest_api.go +++ b/internal/service/apigateway/rest_api.go @@ -310,7 +310,23 @@ func resourceRestAPIRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("minimum_compression_size", strconv.FormatInt(int64(aws.ToInt32(api.MinimumCompressionSize)), 10)) } d.Set("name", api.Name) - d.Set("root_resource_id", api.RootResourceId) + + input := &apigateway.GetResourcesInput{ + RestApiId: aws.String(d.Id()), + } + + rootResource, err := findResource(ctx, conn, input, func(v *types.Resource) bool { + return aws.ToString(v.Path) == "/" + }) + + switch { + case err == nil: + d.Set("root_resource_id", rootResource.Id) + case tfresource.NotFound(err): + d.Set("root_resource_id", nil) + default: + return sdkdiag.AppendErrorf(diags, "reading API Gateway REST API (%s) root resource: %s", d.Id(), err) + } policy, err := flattenAPIPolicy(api.Policy) if err != nil { diff --git a/internal/service/apigateway/rest_api_data_source.go b/internal/service/apigateway/rest_api_data_source.go index 773bedda1bc3..75b865fcdf5a 100644 --- a/internal/service/apigateway/rest_api_data_source.go +++ b/internal/service/apigateway/rest_api_data_source.go @@ -93,9 +93,9 @@ func dataSourceRestAPIRead(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).APIGatewayClient(ctx) name := d.Get("name") - input := &apigateway.GetRestApisInput{} + inputGRAs := &apigateway.GetRestApisInput{} - match, err := findRestAPI(ctx, conn, input, func(v *types.RestApi) bool { + match, err := findRestAPI(ctx, conn, inputGRAs, func(v *types.RestApi) bool { return aws.ToString(v.Name) == name }) @@ -118,7 +118,23 @@ func dataSourceRestAPIRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("minimum_compression_size", strconv.FormatInt(int64(aws.ToInt32(match.MinimumCompressionSize)), 10)) } d.Set("policy", match.Policy) - d.Set("root_resource_id", match.RootResourceId) + + inputGRs := &apigateway.GetResourcesInput{ + RestApiId: aws.String(d.Id()), + } + + rootResource, err := findResource(ctx, conn, inputGRs, func(v *types.Resource) bool { + return aws.ToString(v.Path) == "/" + }) + + switch { + case err == nil: + d.Set("root_resource_id", rootResource.Id) + case tfresource.NotFound(err): + d.Set("root_resource_id", nil) + default: + return sdkdiag.AppendErrorf(diags, "reading API Gateway REST API (%s) root resource: %s", d.Id(), err) + } setTagsOut(ctx, match.Tags) From 1035f7f4fa7dd317ea9a733628dce610a378a3d7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 10:04:40 -0400 Subject: [PATCH 045/137] Add CHANGELOG entry. --- .changelog/#####.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/#####.txt diff --git a/.changelog/#####.txt b/.changelog/#####.txt new file mode 100644 index 000000000000..1d5a54bb7051 --- /dev/null +++ b/.changelog/#####.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_api_gateway_rest_api: Correct set `root_resource_id` on resource Read +``` \ No newline at end of file From a9363856c5b2a8ffdd6eb1e8807f48b9e11321a1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 10:08:38 -0400 Subject: [PATCH 046/137] Correct CHANGELOG entry file name. --- .changelog/{#####.txt => 37040.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{#####.txt => 37040.txt} (100%) diff --git a/.changelog/#####.txt b/.changelog/37040.txt similarity index 100% rename from .changelog/#####.txt rename to .changelog/37040.txt From 96e87ce9cf37b3c2c225a3cb93fb382d9d832ed5 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Mon, 22 Apr 2024 10:39:21 -0400 Subject: [PATCH 047/137] ci/tools: bump gopatch to v0.4.0 (#37038) This version requires Go 1.22, which the provider is now using. --- .ci/tools/go.mod | 16 ++++++++-------- .ci/tools/go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.ci/tools/go.mod b/.ci/tools/go.mod index 394058acc5b1..5824c02df972 100644 --- a/.ci/tools/go.mod +++ b/.ci/tools/go.mod @@ -12,7 +12,7 @@ require ( github.com/pavius/impi v0.0.3 github.com/rhysd/actionlint v1.6.27 github.com/terraform-linters/tflint v0.50.3 - github.com/uber-go/gopatch v0.3.0 + github.com/uber-go/gopatch v0.4.0 mvdan.cc/gofumpt v0.6.0 ) @@ -296,18 +296,18 @@ require ( go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.21.0 // indirect + golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect - golang.org/x/mod v0.16.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.19.0 // indirect + golang.org/x/tools v0.20.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/.ci/tools/go.sum b/.ci/tools/go.sum index 0cd242193dbe..10e318e0e5c1 100644 --- a/.ci/tools/go.sum +++ b/.ci/tools/go.sum @@ -1143,8 +1143,8 @@ github.com/tomarrell/wrapcheck/v2 v2.8.3 h1:5ov+Cbhlgi7s/a42BprYoxsr73CbdMUTzE3b github.com/tomarrell/wrapcheck/v2 v2.8.3/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/uber-go/gopatch v0.3.0 h1:FxvE6iviCJnzxdGFaUqiGbFVL0jaXQvbmB+dP+mCIYk= -github.com/uber-go/gopatch v0.3.0/go.mod h1:opJolqZo0mz4MtUzHPwLWNY60JKAOgwUY0X8I4BWBr8= +github.com/uber-go/gopatch v0.4.0 h1:1/8EUo6Zk3+gtTHvOUsZs5ysCUlHj3NDjuF59zLXz2k= +github.com/uber-go/gopatch v0.4.0/go.mod h1:TYLhs9ou9BLsCnXM3xONjnuL/XrjUSMADQXyAiqPdhE= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= @@ -1253,8 +1253,8 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1302,8 +1302,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1364,8 +1364,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1409,8 +1409,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1512,8 +1512,8 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1523,8 +1523,8 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1620,8 +1620,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From e32f0fbdee04f693e6968fea5c4d20d107ef7557 Mon Sep 17 00:00:00 2001 From: ph <4127030+ph-l@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:02:13 +0800 Subject: [PATCH 048/137] Add MeshServiceDiscovery to MeshSpec in App Mesh --- internal/service/appmesh/appmesh_test.go | 1 + internal/service/appmesh/flex.go | 18 +++++++ internal/service/appmesh/mesh.go | 15 ++++++ internal/service/appmesh/mesh_test.go | 63 ++++++++++++++++++++++++ 4 files changed, 97 insertions(+) diff --git a/internal/service/appmesh/appmesh_test.go b/internal/service/appmesh/appmesh_test.go index 4f6bf3d3407b..21f7a7fa06ad 100644 --- a/internal/service/appmesh/appmesh_test.go +++ b/internal/service/appmesh/appmesh_test.go @@ -34,6 +34,7 @@ func TestAccAppMesh_serial(t *testing.T) { "basic": testAccMesh_basic, "disappears": testAccMesh_disappears, "egressFilter": testAccMesh_egressFilter, + "serviceDiscovery": testAccMesh_serviceDiscovery, "tags": testAccMesh_tags, "dataSourceBasic": testAccMeshDataSource_basic, "dataSourceMeshOwner": testAccMeshDataSource_meshOwner, diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index 1745247d5383..82ec34d80588 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -563,6 +563,16 @@ func expandMeshSpec(vSpec []interface{}) *appmesh.MeshSpec { } } + if vServiceDiscovery, ok := mSpec["service_discovery"].([]interface{}); ok && len(vServiceDiscovery) > 0 && vServiceDiscovery[0] != nil { + mServiceDiscovery := vServiceDiscovery[0].(map[string]interface{}) + + if vIpPreference, ok := mServiceDiscovery["ip_preference"].(string); ok && vIpPreference != "" { + spec.ServiceDiscovery = &appmesh.MeshServiceDiscovery{ + IpPreference: aws.String(vIpPreference), + } + } + } + return spec } @@ -1545,6 +1555,14 @@ func flattenMeshSpec(spec *appmesh.MeshSpec) []interface{} { } } + if spec.ServiceDiscovery != nil { + mSpec["service_discovery"] = []interface{}{ + map[string]interface{}{ + "ip_preference": aws.StringValue(spec.ServiceDiscovery.IpPreference), + }, + } + } + return []interface{}{mSpec} } diff --git a/internal/service/appmesh/mesh.go b/internal/service/appmesh/mesh.go index 8c979d936910..c8f15685c1b3 100644 --- a/internal/service/appmesh/mesh.go +++ b/internal/service/appmesh/mesh.go @@ -97,6 +97,21 @@ func resourceMeshSpecSchema() *schema.Schema { }, }, }, + "service_discovery": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ip_preference": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(appmesh.IpPreference_Values(), false), + }, + }, + }, + }, }, }, } diff --git a/internal/service/appmesh/mesh_test.go b/internal/service/appmesh/mesh_test.go index bb180cf44b5d..5b2679fd1017 100644 --- a/internal/service/appmesh/mesh_test.go +++ b/internal/service/appmesh/mesh_test.go @@ -120,6 +120,55 @@ func testAccMesh_egressFilter(t *testing.T) { }) } +func testAccMesh_serviceDiscovery(t *testing.T) { + ctx := acctest.Context(t) + var mesh appmesh.MeshData + resourceName := "aws_appmesh_mesh.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, appmesh.EndpointsID) }, + ErrorCheck: acctest.ErrorCheck(t, names.AppMeshServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckMeshDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccMeshConfig_serviceDiscovery(rName, "IPv6_PREFERRED"), + Check: resource.ComposeTestCheckFunc( + testAccCheckMeshExists(ctx, resourceName, &mesh), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.ip_preference", "IPv6_PREFERRED"), + ), + }, + { + Config: testAccMeshConfig_serviceDiscovery(rName, "IPv4_PREFERRED"), + Check: resource.ComposeTestCheckFunc( + testAccCheckMeshExists(ctx, resourceName, &mesh), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.ip_preference", "IPv4_PREFERRED"), + ), + }, + { + Config: testAccMeshConfig_serviceDiscovery(rName, "IPv4_ONLY"), + Check: resource.ComposeTestCheckFunc( + testAccCheckMeshExists(ctx, resourceName, &mesh), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.ip_preference", "IPv4_ONLY"), + ), + }, + { + Config: testAccMeshConfig_serviceDiscovery(rName, "IPv6_ONLY"), + Check: resource.ComposeTestCheckFunc( + testAccCheckMeshExists(ctx, resourceName, &mesh), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.ip_preference", "IPv6_ONLY"), + ), + }, + }, + }) +} + func testAccMesh_tags(t *testing.T) { ctx := acctest.Context(t) var mesh appmesh.MeshData @@ -238,6 +287,20 @@ resource "aws_appmesh_mesh" "test" { `, rName, egressFilterType) } +func testAccMeshConfig_serviceDiscovery(rName, serviceDiscoveryIpPreference string) string { + return fmt.Sprintf(` +resource "aws_appmesh_mesh" "test" { + name = %[1]q + + spec { + service_discovery { + ip_preference = %[2]q + } + } +} +`, rName, serviceDiscoveryIpPreference) +} + func testAccMeshConfig_tags1(rName, tagKey1, tagValue1 string) string { return fmt.Sprintf(` resource "aws_appmesh_mesh" "test" { From dbb04b61f116ff6d37881eacbdb32995b03b15d4 Mon Sep 17 00:00:00 2001 From: ph <4127030+ph-l@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:11:38 +0800 Subject: [PATCH 049/137] Add changelog entry --- .changelog/37042.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37042.txt diff --git a/.changelog/37042.txt b/.changelog/37042.txt new file mode 100644 index 000000000000..8265dec96272 --- /dev/null +++ b/.changelog/37042.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_appmesh_mesh: Add serviceDiscovery object to service mesh specification +``` \ No newline at end of file From 6b05080fa2ad676067cee5fbac08201e39426626 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Mon, 22 Apr 2024 10:52:58 -0700 Subject: [PATCH 050/137] Remove comments; add changelog --- .changelog/36847.txt | 3 +++ internal/service/bcmdataexports/export.go | 1 - internal/service/bcmdataexports/export_test.go | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 .changelog/36847.txt diff --git a/.changelog/36847.txt b/.changelog/36847.txt new file mode 100644 index 000000000000..963ccc763f5b --- /dev/null +++ b/.changelog/36847.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +aws_bcmdataexports_export +``` \ No newline at end of file diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 7240e629a732..da0f65bd610b 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -71,7 +71,6 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, CustomType: fwtypes.NewMapTypeOf[fwtypes.MapValueOf[types.String]](ctx), Optional: true, PlanModifiers: []planmodifier.Map{ - // mapplanmodifier.RequiresReplaceIfConfigured(), mapplanmodifier.UseStateForUnknown(), }, }, diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index 2ea0b3afa7b9..e94a64b93ad3 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -166,7 +166,6 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), - // resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "HOURLY"), resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost FROM COST_AND_USAGE_REPORT"), ), }, @@ -180,7 +179,6 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckExportExists(ctx, resourceName, &export), resource.TestCheckResourceAttr(resourceName, "export.0.name", rName), - // resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.table_configurations.COST_AND_USAGE_REPORT.TIME_GRANULARITY", "DAILY"), resource.TestCheckResourceAttr(resourceName, "export.0.data_query.0.query_statement", "SELECT identity_line_item_id, identity_time_interval, line_item_usage_amount, line_item_unblended_cost, cost_category FROM COST_AND_USAGE_REPORT"), ), }, From e2dcd6c62c874eea69b71af978d414d0ed0c1634 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Mon, 22 Apr 2024 10:55:43 -0700 Subject: [PATCH 051/137] Fix sweeper --- internal/service/bcmdataexports/sweep.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/bcmdataexports/sweep.go b/internal/service/bcmdataexports/sweep.go index 870b7f1e5f42..1c698f3e5193 100644 --- a/internal/service/bcmdataexports/sweep.go +++ b/internal/service/bcmdataexports/sweep.go @@ -16,7 +16,7 @@ import ( ) func RegisterSweepers() { - resource.AddTestSweepers("aws_bcmdataexports", &resource.Sweeper{ + resource.AddTestSweepers("aws_bcmdataexports_export", &resource.Sweeper{ Name: "aws_bcmdataexports_export", F: sweepExports, }) From dfce800d494705a3660203e62e4b10e4948c39c3 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 22 Apr 2024 12:57:54 -0500 Subject: [PATCH 052/137] correct test pattern for EC2 Outposts (#37044) --- .teamcity/components/generated/services_all.kt | 2 +- internal/generate/teamcity/acctest_services.hcl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.teamcity/components/generated/services_all.kt b/.teamcity/components/generated/services_all.kt index 82843a71bf55..5c0383ecca16 100644 --- a/.teamcity/components/generated/services_all.kt +++ b/.teamcity/components/generated/services_all.kt @@ -81,7 +81,7 @@ val services = mapOf( "dynamodb" to ServiceSpec("DynamoDB"), "ec2" to ServiceSpec("EC2 (Elastic Compute Cloud)", vpcLock = true, patternOverride = "TestAccEC2", excludePattern = "TestAccEC2EBS|TestAccEC2Outposts"), "ec2ebs" to ServiceSpec("EBS (EC2)", vpcLock = true, patternOverride = "TestAccEC2EBS", splitPackageRealPackage = "ec2"), - "ec2outposts" to ServiceSpec("Outposts (EC2)", vpcLock = true, patternOverride = "TestAccOutposts", splitPackageRealPackage = "ec2"), + "ec2outposts" to ServiceSpec("Outposts (EC2)", vpcLock = true, patternOverride = "TestAccEC2Outposts", splitPackageRealPackage = "ec2"), "ecr" to ServiceSpec("ECR (Elastic Container Registry)"), "ecrpublic" to ServiceSpec("ECR Public", regionOverride = "us-east-1"), "ecs" to ServiceSpec("ECS (Elastic Container)", vpcLock = true), diff --git a/internal/generate/teamcity/acctest_services.hcl b/internal/generate/teamcity/acctest_services.hcl index d1d0fcd0e152..1c1fa22786c3 100644 --- a/internal/generate/teamcity/acctest_services.hcl +++ b/internal/generate/teamcity/acctest_services.hcl @@ -80,7 +80,7 @@ service "ec2ebs" { service "ec2outposts" { vpc_lock = true - pattern_override = "TestAccOutposts" + pattern_override = "TestAccEC2Outposts" split_package_real_package = "ec2" } From e00916fff8924b1bbbc356d7ea3013616f84d287 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Mon, 22 Apr 2024 11:09:32 -0700 Subject: [PATCH 053/137] Fix markdown --- website/docs/r/bcmdataexports_export.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/r/bcmdataexports_export.html.markdown b/website/docs/r/bcmdataexports_export.html.markdown index ab647b9d9076..094ac1393542 100644 --- a/website/docs/r/bcmdataexports_export.html.markdown +++ b/website/docs/r/bcmdataexports_export.html.markdown @@ -101,8 +101,8 @@ This resource exports the following attributes in addition to the arguments abov [Configuration options](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts): -* `create` - (Default `60m`) -* `update` - (Default `180m`) +* `create` - (Default `30m`) +* `update` - (Default `30m`) ## Import @@ -115,7 +115,7 @@ import { } ``` -Using `terraform import`, import BCM Data Exports Export using the `example_id_arg`. For example: +Using `terraform import`, import BCM Data Exports Export using the `export_arn`. For example: ```console % terraform import aws_bcmdataexports_export.example export-id-12345678 From b448a4816e7f5f104b4c602787f4fe9bc3175fac Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 14:17:41 -0400 Subject: [PATCH 054/137] Fix tfproviderdocs 'import section code block text should contain resource name: aws_globalaccelerator_cross_account_attachment'. --- .../r/globalaccelerator_cross_account_attachment.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown index ea7fea93126f..1f843280598b 100644 --- a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -75,5 +75,5 @@ import { Using `terraform import`, import Global Accelerator Cross Account Attachment using the `example_id_arg`. For example: ```console -% terraform import arn:aws:globalaccelerator::012345678910:attachment/01234567-abcd-8910-efgh-123456789012 +% terraform import aws_globalaccelerator_cross_account_attachment.example arn:aws:globalaccelerator::012345678910:attachment/01234567-abcd-8910-efgh-123456789012 ``` From 7961266c80470214de3cb24e6c7efaf1146fbe33 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 14:19:31 -0400 Subject: [PATCH 055/137] Fix markdown-lint 'MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]'. --- ...obalaccelerator_cross_account_attachment.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown index 1f843280598b..3060be55796b 100644 --- a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -20,7 +20,7 @@ resource "aws_globalaccelerator_cross_account_attachment" "example" { } ``` -### Usage with Optional Arguments +### Usage with Optional Arguments ```terraform resource "aws_globalaccelerator_cross_account_attachment" "example" { @@ -42,16 +42,16 @@ The following arguments are required: The following arguments are optional: * `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator. -* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region`. The `region` field is optional. +* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region`. The `region` field is optional. ## Attribute Reference This resource exports the following attributes in addition to the arguments above: -* `arn` - ARN of the Cross Account Attachment. +* `arn` - ARN of the Cross Account Attachment. * `id` - ID of the Cross Account Attachment. * `created_time` - Creation Time when the Cross Account Attachment. -* `last_modified_time` - Last modified time of the Cross Account Attachment. +* `last_modified_time` - Last modified time of the Cross Account Attachment. ## Timeouts From 3222702c1f4939b79979d2a4a577f6179a80035d Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Mon, 22 Apr 2024 11:37:55 -0700 Subject: [PATCH 056/137] Add PartitionNot usgovcloud --- internal/service/bcmdataexports/export_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/service/bcmdataexports/export_test.go b/internal/service/bcmdataexports/export_test.go index e94a64b93ad3..566ff471a2ad 100644 --- a/internal/service/bcmdataexports/export_test.go +++ b/internal/service/bcmdataexports/export_test.go @@ -35,6 +35,7 @@ func TestAccBCMDataExportsExport_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionNot(t, names.USGovCloudPartitionID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -78,6 +79,7 @@ func TestAccBCMDataExportsExport_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionNot(t, names.USGovCloudPartitionID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -105,6 +107,7 @@ func TestAccBCMDataExportsExport_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionNot(t, names.USGovCloudPartitionID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -156,6 +159,7 @@ func TestAccBCMDataExportsExport_updateTable(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionNot(t, names.USGovCloudPartitionID) }, ErrorCheck: acctest.ErrorCheck(t, names.BCMDataExportsServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, From 174ff98e0b303a892eb14cf25a9c60debe2a3c45 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 15:03:04 -0400 Subject: [PATCH 057/137] 'internal/flex/Set' -> 'internal/types/Set'. --- internal/flex/flex.go | 18 ------------------ internal/service/ssm/document.go | 3 ++- internal/types/set.go | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 internal/types/set.go diff --git a/internal/flex/flex.go b/internal/flex/flex.go index 79407d007a3b..05ba45d9d367 100644 --- a/internal/flex/flex.go +++ b/internal/flex/flex.go @@ -413,24 +413,6 @@ func ResourceIdPartCount(id string) int { return len(idParts) } -type Set[T comparable] []T - -// Difference find the elements in two sets that are not similar. -func (s Set[T]) Difference(ns Set[T]) Set[T] { - m := make(map[T]struct{}) - for _, v := range ns { - m[v] = struct{}{} - } - - var result []T - for _, v := range s { - if _, ok := m[v]; !ok { - result = append(result, v) - } - } - return result -} - // DiffStringMaps returns the set of keys and values that must be created, the set of keys // and values that must be destroyed, and the set of keys and values that are unchanged. func DiffStringMaps(oldMap, newMap map[string]interface{}) (map[string]*string, map[string]*string, map[string]*string) { diff --git a/internal/service/ssm/document.go b/internal/service/ssm/document.go index 425a0bfa4cb6..8efb788b360f 100644 --- a/internal/service/ssm/document.go +++ b/internal/service/ssm/document.go @@ -28,6 +28,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/slices" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + itypes "github.com/hashicorp/terraform-provider-aws/internal/types" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -403,7 +404,7 @@ func resourceDocumentUpdate(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).SSMConn(ctx) if d.HasChange("permissions") { - var oldAccountIDs, newAccountIDs flex.Set[string] + var oldAccountIDs, newAccountIDs itypes.Set[string] o, n := d.GetChange("permissions") if v := o.(map[string]interface{}); len(v) > 0 { diff --git a/internal/types/set.go b/internal/types/set.go new file mode 100644 index 000000000000..c4bb73865e86 --- /dev/null +++ b/internal/types/set.go @@ -0,0 +1,22 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package types + +type Set[T comparable] []T + +// Difference find the elements in two sets that are not similar. +func (s Set[T]) Difference(ns Set[T]) Set[T] { + m := make(map[T]struct{}) + for _, v := range ns { + m[v] = struct{}{} + } + + var result []T + for _, v := range s { + if _, ok := m[v]; !ok { + result = append(result, v) + } + } + return result +} From f2eef3fc61be5859e391912aee9dca76c0fd497b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 15:13:42 -0400 Subject: [PATCH 058/137] Add 'TestSetDifference'. --- internal/types/set_test.go | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 internal/types/set_test.go diff --git a/internal/types/set_test.go b/internal/types/set_test.go new file mode 100644 index 000000000000..ac03701beb32 --- /dev/null +++ b/internal/types/set_test.go @@ -0,0 +1,65 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package types + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" +) + +func TestSetDifference(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + set1 Set[int] + set2 Set[int] + expected Set[int] + }{ + { + name: "nil sets", + expected: nil, + }, + { + name: "empty sets", + set1: Set[int]{}, + set2: Set[int]{}, + expected: nil, + }, + { + name: "no overlap", + set1: Set[int]{1, 3, 5, 7}, + set2: Set[int]{2, 4, 6, 8}, + expected: Set[int]{1, 3, 5, 7}, + }, + { + name: "no overlap swapped", + set1: Set[int]{2, 4, 6, 8}, + set2: Set[int]{1, 3, 5, 7}, + expected: Set[int]{2, 4, 6, 8}, + }, + { + name: "overlap", + set1: Set[int]{1, 2, 3, 4, 5, 7}, + set2: Set[int]{1, 2, 4, 6, 8}, + expected: Set[int]{3, 5, 7}, + }, + } + + for _, testCase := range testCases { + testCase := testCase + + t.Run(testCase.name, func(t *testing.T) { + t.Parallel() + + got := testCase.set1.Difference(testCase.set2) + + if diff := cmp.Diff(got, testCase.expected, cmpopts.SortSlices(func(v1, v2 int) bool { return v1 < v2 })); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + }) + } +} From e2c6a3e2a1e505452cbc43ad94f6d1a362444e3d Mon Sep 17 00:00:00 2001 From: changelogbot Date: Mon, 22 Apr 2024 19:15:35 +0000 Subject: [PATCH 059/137] Update CHANGELOG.md for #36847 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c3ba7bdeb9..f7570381c410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ NOTES: FEATURES: * **New Data Source:** `aws_identitystore_groups` ([#36993](https://github.com/hashicorp/terraform-provider-aws/issues/36993)) +* **New Resource:** `aws_bcmdataexports_export` ([#36847](https://github.com/hashicorp/terraform-provider-aws/issues/36847)) * **New Resource:** `aws_bedrockagent_agent` ([#36851](https://github.com/hashicorp/terraform-provider-aws/issues/36851)) * **New Resource:** `aws_bedrockagent_agent_action_group` ([#36935](https://github.com/hashicorp/terraform-provider-aws/issues/36935)) * **New Resource:** `aws_bedrockagent_agent_alias` ([#36905](https://github.com/hashicorp/terraform-provider-aws/issues/36905)) From aacd972e0e47be54d2470b20dbb65ec3a4a2a7df Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 15:44:17 -0400 Subject: [PATCH 060/137] Complete 'internal/flex/Set' -> 'internal/types/Set'. --- internal/framework/flex/flex.go | 22 ----------- internal/framework/flex/flex_test.go | 59 ---------------------------- internal/framework/flex/set.go | 3 +- internal/framework/flex/set_test.go | 3 +- internal/types/set_test.go | 54 +++++++++++++++++++++++-- 5 files changed, 55 insertions(+), 86 deletions(-) delete mode 100644 internal/framework/flex/flex.go delete mode 100644 internal/framework/flex/flex_test.go diff --git a/internal/framework/flex/flex.go b/internal/framework/flex/flex.go deleted file mode 100644 index c15a5e76b93a..000000000000 --- a/internal/framework/flex/flex.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package flex - -type Set[T comparable] []T - -// Difference find the elements in two sets that are not similar. -func (s Set[T]) Difference(ns Set[T]) Set[T] { - m := make(map[T]struct{}) - for _, v := range ns { - m[v] = struct{}{} - } - - var result []T - for _, v := range s { - if _, ok := m[v]; !ok { - result = append(result, v) - } - } - return result -} diff --git a/internal/framework/flex/flex_test.go b/internal/framework/flex/flex_test.go deleted file mode 100644 index c2143bf8efc9..000000000000 --- a/internal/framework/flex/flex_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package flex - -import ( - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestSet_Difference_strings(t *testing.T) { - t.Parallel() - - type testCase struct { - original Set[string] - new Set[string] - expected Set[string] - } - tests := map[string]testCase{ - "nil": { - original: nil, - new: nil, - expected: nil, - }, - "equal": { - original: Set[string]{"one"}, - new: Set[string]{"one"}, - expected: nil, - }, - "difference": { - original: Set[string]{"one", "two", "four"}, - new: Set[string]{"one", "two", "three"}, - expected: Set[string]{"four"}, - }, - "difference_remove": { - original: Set[string]{"one", "two"}, - new: Set[string]{"one"}, - expected: Set[string]{"two"}, - }, - "difference_add": { - original: Set[string]{"one"}, - new: Set[string]{"one", "two"}, - expected: nil, - }, - } - - for name, test := range tests { - name, test := name, test - t.Run(name, func(t *testing.T) { - t.Parallel() - - got := test.original.Difference(test.new) - if diff := cmp.Diff(got, test.expected); diff != "" { - t.Errorf("unexpected diff (+wanted, -got): %s", diff) - } - }) - } -} diff --git a/internal/framework/flex/set.go b/internal/framework/flex/set.go index f1665577d24d..08b55107ba21 100644 --- a/internal/framework/flex/set.go +++ b/internal/framework/flex/set.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + itypes "github.com/hashicorp/terraform-provider-aws/internal/types" ) func ExpandFrameworkStringSet(ctx context.Context, v basetypes.SetValuable) []*string { @@ -20,7 +21,7 @@ func ExpandFrameworkStringSet(ctx context.Context, v basetypes.SetValuable) []*s return output } -func ExpandFrameworkStringValueSet(ctx context.Context, v basetypes.SetValuable) Set[string] { +func ExpandFrameworkStringValueSet(ctx context.Context, v basetypes.SetValuable) itypes.Set[string] { var output []string must(Expand(ctx, v, &output)) diff --git a/internal/framework/flex/set_test.go b/internal/framework/flex/set_test.go index 9247e2591912..74afc03eb148 100644 --- a/internal/framework/flex/set_test.go +++ b/internal/framework/flex/set_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" + itypes "github.com/hashicorp/terraform-provider-aws/internal/types" ) func TestExpandFrameworkStringSet(t *testing.T) { @@ -68,7 +69,7 @@ func TestExpandFrameworkStringValueSet(t *testing.T) { type testCase struct { input types.Set - expected flex.Set[string] + expected itypes.Set[string] } tests := map[string]testCase{ "null": { diff --git a/internal/types/set_test.go b/internal/types/set_test.go index ac03701beb32..7da36787a667 100644 --- a/internal/types/set_test.go +++ b/internal/types/set_test.go @@ -7,10 +7,9 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" ) -func TestSetDifference(t *testing.T) { +func TestSetDifference_ints(t *testing.T) { t.Parallel() testCases := []struct { @@ -57,7 +56,56 @@ func TestSetDifference(t *testing.T) { got := testCase.set1.Difference(testCase.set2) - if diff := cmp.Diff(got, testCase.expected, cmpopts.SortSlices(func(v1, v2 int) bool { return v1 < v2 })); diff != "" { + if diff := cmp.Diff(got, testCase.expected); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + }) + } +} + +func TestSetDifference_strings(t *testing.T) { + t.Parallel() + + type testCase struct { + original Set[string] + new Set[string] + expected Set[string] + } + tests := map[string]testCase{ + "nil": { + original: nil, + new: nil, + expected: nil, + }, + "equal": { + original: Set[string]{"one"}, + new: Set[string]{"one"}, + expected: nil, + }, + "difference": { + original: Set[string]{"one", "two", "four"}, + new: Set[string]{"one", "two", "three"}, + expected: Set[string]{"four"}, + }, + "difference_remove": { + original: Set[string]{"one", "two"}, + new: Set[string]{"one"}, + expected: Set[string]{"two"}, + }, + "difference_add": { + original: Set[string]{"one"}, + new: Set[string]{"one", "two"}, + expected: nil, + }, + } + + for name, test := range tests { + name, test := name, test + t.Run(name, func(t *testing.T) { + t.Parallel() + + got := test.original.Difference(test.new) + if diff := cmp.Diff(got, test.expected); diff != "" { t.Errorf("unexpected diff (+wanted, -got): %s", diff) } }) From 07f2d61b22ddaa7ae49bb24e6b9541ea9a3a6b36 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 16:26:20 -0400 Subject: [PATCH 061/137] Add 'flex.DiffSlices'. --- internal/flex/flex.go | 23 +++++++++++++++ internal/flex/flex_test.go | 59 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/internal/flex/flex.go b/internal/flex/flex.go index 05ba45d9d367..f03017234382 100644 --- a/internal/flex/flex.go +++ b/internal/flex/flex.go @@ -5,6 +5,7 @@ package flex import ( "fmt" + "slices" "strconv" "strings" "time" @@ -460,3 +461,25 @@ func DiffStringValueMaps(oldMap, newMap map[string]interface{}) (map[string]stri return add, remove, unchanged } + +func DiffSlices[E any](old []E, new []E, eq func(E, E) bool) ([]E, []E, []E) { + // First, we're creating everything we have. + add := new + + // Build the slices of what to remove and what is unchanged. + remove := make([]E, 0) + unchanged := make([]E, 0) + for _, e := range old { + eq := func(v E) bool { return eq(v, e) } + if !slices.ContainsFunc(new, eq) { + // Delete it! + remove = append(remove, e) + } else { + unchanged = append(unchanged, e) + // Already present, so remove from new. + add = slices.DeleteFunc(add, eq) + } + } + + return add, remove, unchanged +} diff --git a/internal/flex/flex_test.go b/internal/flex/flex_test.go index 3e12ee7a5782..e07c7c227db7 100644 --- a/internal/flex/flex_test.go +++ b/internal/flex/flex_test.go @@ -466,3 +466,62 @@ func TestDiffStringValueMaps(t *testing.T) { } } } + +func TestDiffSlices(t *testing.T) { + t.Parallel() + + type x struct { + A string + B int + } + + cases := []struct { + Old, New []x + Create, Remove, Unchanged []x + }{ + // Add + { + Old: []x{{A: "foo", B: 1}}, + New: []x{{A: "foo", B: 1}, {A: "bar", B: 2}}, + Create: []x{{A: "bar", B: 2}}, + Remove: []x{}, + Unchanged: []x{{A: "foo", B: 1}}, + }, + // Modify + { + Old: []x{{A: "foo", B: 1}}, + New: []x{{A: "foo", B: 2}}, + Create: []x{{A: "foo", B: 2}}, + Remove: []x{{A: "foo", B: 1}}, + Unchanged: []x{}, + }, + // Overlap + { + Old: []x{{A: "foo", B: 1}, {A: "bar", B: 2}}, + New: []x{{A: "foo", B: 3}, {A: "bar", B: 2}}, + Create: []x{{A: "foo", B: 3}}, + Remove: []x{{A: "foo", B: 1}}, + Unchanged: []x{{A: "bar", B: 2}}, + }, + // Remove + { + Old: []x{{A: "foo", B: 1}, {A: "bar", B: 2}}, + New: []x{{A: "foo", B: 1}}, + Create: []x{}, + Remove: []x{{A: "bar", B: 2}}, + Unchanged: []x{{A: "foo", B: 1}}, + }, + } + for _, tc := range cases { + c, r, u := DiffSlices(tc.Old, tc.New, func(x1, x2 x) bool { return x1.A == x2.A && x1.B == x2.B }) + if diff := cmp.Diff(c, tc.Create); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + if diff := cmp.Diff(r, tc.Remove); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + if diff := cmp.Diff(u, tc.Unchanged); diff != "" { + t.Errorf("unexpected diff (+wanted, -got): %s", diff) + } + } +} From d5a1bf7a24a5919d628cd4eff3fea8d296d0a0ac Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 17:14:27 -0400 Subject: [PATCH 062/137] r/aws_globalaccelerator_cross_account_attachment: Tidy up. --- .../cross_account_attachment.go | 571 ++++++------------ .../cross_account_attachment_test.go | 345 ++--------- .../service/globalaccelerator/exports_test.go | 8 +- .../globalaccelerator/service_package_gen.go | 2 +- ...tor_cross_account_attachment.html.markdown | 2 + 5 files changed, 240 insertions(+), 688 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index ecdda10970d5..53cac2e989f9 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -5,527 +5,322 @@ package globalaccelerator import ( "context" - "errors" "fmt" - "time" - "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" "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/types" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" - "github.com/hashicorp/terraform-provider-aws/internal/create" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" + "github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag" + "github.com/hashicorp/terraform-provider-aws/internal/flex" "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(name="Cross Account Attachment") -func newResourceCrossAccountAttachment(_ context.Context) (resource.ResourceWithConfigure, error) { - r := &resourceCrossAccountAttachment{} - - r.SetDefaultCreateTimeout(30 * time.Minute) - r.SetDefaultUpdateTimeout(30 * time.Minute) - r.SetDefaultDeleteTimeout(30 * time.Minute) +// @FrameworkResource(name="Cross-account Attachment") +// @Tags(identifierAttribute="id") +func newCrossAccountAttachmentResource(_ context.Context) (resource.ResourceWithConfigure, error) { + r := &crossAccountAttachmentResource{} return r, nil } -const ( - ResNameCrossAccountAttachment = "Cross Account Attachment" -) - -type resourceCrossAccountAttachment struct { +type crossAccountAttachmentResource struct { framework.ResourceWithConfigure - framework.WithTimeouts + framework.WithImportByID } -func (r *resourceCrossAccountAttachment) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = "aws_globalaccelerator_cross_account_attachment" +func (*crossAccountAttachmentResource) Metadata(_ context.Context, request resource.MetadataRequest, response *resource.MetadataResponse) { + response.TypeName = "aws_globalaccelerator_cross_account_attachment" } -func (r *resourceCrossAccountAttachment) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - resp.Schema = schema.Schema{ +func (r *crossAccountAttachmentResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { + response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "arn": framework.ARNAttributeComputedOnly(), + names.AttrARN: framework.ARNAttributeComputedOnly(), "created_time": schema.StringAttribute{ - Computed: true, + CustomType: timetypes.RFC3339Type{}, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, - "id": framework.IDAttribute(), + names.AttrID: framework.IDAttribute(), "last_modified_time": schema.StringAttribute{ - Computed: true, + CustomType: timetypes.RFC3339Type{}, + Computed: true, }, "name": schema.StringAttribute{ Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, }, - "principals": schema.ListAttribute{ + "principals": schema.SetAttribute{ + CustomType: fwtypes.SetOfStringType, Optional: true, ElementType: types.StringType, }, - "resources": schema.ListAttribute{ - Optional: true, - ElementType: ResourceDataElementType, + names.AttrTags: tftags.TagsAttribute(), + names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), + }, + Blocks: map[string]schema.Block{ + "resource": schema.SetNestedBlock{ + CustomType: fwtypes.NewSetNestedObjectTypeOf[resourceModel](ctx), + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "endpoint_id": schema.StringAttribute{ + Optional: true, + }, + "region": schema.StringAttribute{ + Optional: true, + }, + }, + }, }, }, } } -func (r *resourceCrossAccountAttachment) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - conn := r.Meta().GlobalAcceleratorConn(ctx) - - var plan resourceCrossAccountAttachmentData - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - if resp.Diagnostics.HasError() { +func (r *crossAccountAttachmentResource) Create(ctx context.Context, request resource.CreateRequest, response *resource.CreateResponse) { + var data crossAccountAttachmentResourceModel + response.Diagnostics.Append(request.Plan.Get(ctx, &data)...) + if response.Diagnostics.HasError() { return } - input := &globalaccelerator.CreateCrossAccountAttachmentInput{ - IdempotencyToken: aws.String(id.UniqueId()), - Name: aws.String(plan.Name.ValueString()), - Tags: getTagsIn(ctx), - } + conn := r.Meta().GlobalAcceleratorConn(ctx) - if !plan.Principals.IsNull() { - input.Principals = flex.ExpandFrameworkStringList(ctx, plan.Principals) + input := &globalaccelerator.CreateCrossAccountAttachmentInput{} + response.Diagnostics.Append(fwflex.Expand(ctx, data, input)...) + if response.Diagnostics.HasError() { + return } - if !plan.Resources.IsNull() { - var tfResources []ResourceData - diags := plan.Resources.ElementsAs(ctx, &tfResources, false) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } + input.IdempotencyToken = aws.String(id.UniqueId()) + input.Tags = getTagsIn(ctx) - input.Resources = expandResources(tfResources) - } - - out, err := conn.CreateCrossAccountAttachmentWithContext(ctx, input) + output, err := conn.CreateCrossAccountAttachmentWithContext(ctx, input) if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionCreating, ResNameCrossAccountAttachment, plan.Name.String(), err), - err.Error(), - ) - return - } - if out == nil || out.CrossAccountAttachment == nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionCreating, ResNameCrossAccountAttachment, plan.Name.String(), nil), - errors.New("empty output").Error(), - ) + response.Diagnostics.AddError("creating Global Accelerator Cross-account Attachment", err.Error()) + return } - state := plan - state.ID = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) - state.ARN = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) - - state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) - if out.CrossAccountAttachment.LastModifiedTime != nil { - state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) - } + // Set values for unknowns. + data.AttachmentARN = fwflex.StringToFramework(ctx, output.CrossAccountAttachment.AttachmentArn) + data.CreatedTime = fwflex.TimeToFramework(ctx, output.CrossAccountAttachment.CreatedTime) + data.LastModifiedTime = fwflex.TimeToFramework(ctx, output.CrossAccountAttachment.LastModifiedTime) + data.setID() - resp.Diagnostics.Append(resp.State.Set(ctx, state)...) + response.Diagnostics.Append(response.State.Set(ctx, &data)...) } -func (r *resourceCrossAccountAttachment) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - conn := r.Meta().GlobalAcceleratorConn(ctx) - - var state resourceCrossAccountAttachmentData - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { +func (r *crossAccountAttachmentResource) Read(ctx context.Context, request resource.ReadRequest, response *resource.ReadResponse) { + var data crossAccountAttachmentResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { return } - input := &globalaccelerator.DescribeCrossAccountAttachmentInput{ - AttachmentArn: aws.String(state.ARN.ValueString()), - } - out, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, input) + if err := data.InitFromID(); err != nil { + response.Diagnostics.AddError("parsing resource ID", err.Error()) - var nfe *globalaccelerator.AttachmentNotFoundException - if errors.As(err, &nfe) { - resp.State.RemoveResource(ctx) - return - } - if err != nil { - resp.Diagnostics.AddError( - create.ProblemStandardMessage(names.GlobalAccelerator, create.ErrActionSetting, ResNameCrossAccountAttachment, state.ID.String(), err), - err.Error(), - ) return } - state.ARN = flex.StringToFramework(ctx, out.CrossAccountAttachment.AttachmentArn) - state.Name = flex.StringToFramework(ctx, out.CrossAccountAttachment.Name) - state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) - if out.CrossAccountAttachment.LastModifiedTime != nil { - state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) - } - - state.Principals = flex.FlattenFrameworkStringList(ctx, out.CrossAccountAttachment.Principals) - - resources, errDiags := flattenResources(ctx, out.CrossAccountAttachment.Resources) - resp.Diagnostics.Append(errDiags...) - if resp.Diagnostics.HasError() { - return - } - state.Resources = resources - resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) -} - -func (r *resourceCrossAccountAttachment) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { conn := r.Meta().GlobalAcceleratorConn(ctx) - var plan, state resourceCrossAccountAttachmentData - resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { - return - } - - input := &globalaccelerator.UpdateCrossAccountAttachmentInput{ - AttachmentArn: aws.String(state.ARN.ValueString()), - } - - var diags diag.Diagnostics - if !plan.Principals.Equal(state.Principals) { - input.AddPrincipals, input.RemovePrincipals, diags = diffPrincipals(ctx, state.Principals, plan.Principals) - resp.Diagnostics.Append(diags...) - } - - if !plan.Resources.Equal(state.Resources) { - input.AddResources, input.RemoveResources, diags = diffResources(ctx, state.Resources, plan.Resources) - resp.Diagnostics.Append(diags...) - } - - if !plan.Name.Equal(state.Name) { - input.Name = aws.String(plan.Name.ValueString()) - } + output, err := findCrossAccountAttachmentByARN(ctx, conn, data.ID.ValueString()) - if input.Name != nil || input.AddPrincipals != nil || input.RemovePrincipals != nil || input.AddResources != nil || input.RemoveResources != nil { - out, err := conn.UpdateCrossAccountAttachmentWithContext(ctx, input) - if err != nil { - resp.Diagnostics.AddError( - "Error updating CrossAccountAttachment", - fmt.Sprintf("Could not update CrossAccountAttachment %s: %s", state.ARN.ValueString(), err), - ) - return - } + if tfresource.NotFound(err) { + response.Diagnostics.Append(fwdiag.NewResourceNotFoundWarningDiagnostic(err)) + response.State.RemoveResource(ctx) - state.CreatedTime = types.StringValue(out.CrossAccountAttachment.CreatedTime.Format(time.RFC3339)) - if out.CrossAccountAttachment.LastModifiedTime != nil { - state.LastModifiedTime = types.StringValue(out.CrossAccountAttachment.LastModifiedTime.Format(time.RFC3339)) - } + return } - resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) -} - -func (r *resourceCrossAccountAttachment) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - conn := r.Meta().GlobalAcceleratorConn(ctx) + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("reading Global Accelerator Cross-account Attachment (%s)", data.ID.ValueString()), err.Error()) - var state resourceCrossAccountAttachmentData - resp.Diagnostics.Append(req.State.Get(ctx, &state)...) - if resp.Diagnostics.HasError() { return } - input := &globalaccelerator.DeleteCrossAccountAttachmentInput{ - AttachmentArn: aws.String(state.ARN.ValueString()), + // Normalize return value. + if data.Principals.IsNull() && len(output.Principals) == 0 { + output.Principals = nil } - _, err := conn.DeleteCrossAccountAttachmentWithContext(ctx, input) - - if err != nil { - var nfe *globalaccelerator.AttachmentNotFoundException - if errors.As(err, &nfe) { - return - } - resp.Diagnostics.AddError( - "Error deleting Global Accelerator CrossAccountAttachment", - fmt.Sprintf("Could not delete CrossAccountAttachment %s: %s", state.ARN.ValueString(), err), - ) + response.Diagnostics.Append(fwflex.Flatten(ctx, output, &data)...) + if response.Diagnostics.HasError() { return } -} -func (r *resourceCrossAccountAttachment) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - conn := r.Meta().GlobalAcceleratorConn(ctx) - attachmentArn := req.ID + response.Diagnostics.Append(response.State.Set(ctx, &data)...) +} - output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ - AttachmentArn: aws.String(attachmentArn), - }) - if err != nil { - resp.Diagnostics.AddError("Error describing CrossAccountAttachment", fmt.Sprintf("Could not describe CrossAccountAttachment with ARN %s: %s", attachmentArn, err)) +func (r *crossAccountAttachmentResource) Update(ctx context.Context, request resource.UpdateRequest, response *resource.UpdateResponse) { + var old, new crossAccountAttachmentResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &old)...) + if response.Diagnostics.HasError() { return } - - if output == nil || output.CrossAccountAttachment == nil { - resp.Diagnostics.AddError("Error describing CrossAccountAttachment", fmt.Sprintf("CrossAccountAttachment with ARN %s not found", attachmentArn)) + response.Diagnostics.Append(request.Plan.Get(ctx, &new)...) + if response.Diagnostics.HasError() { return } - var plan resourceCrossAccountAttachmentData - plan.ARN = flex.StringToFramework(ctx, output.CrossAccountAttachment.AttachmentArn) - plan.ID = flex.StringToFramework(ctx, output.CrossAccountAttachment.AttachmentArn) - plan.Name = flex.StringToFramework(ctx, output.CrossAccountAttachment.Name) + conn := r.Meta().GlobalAcceleratorConn(ctx) - if output.CrossAccountAttachment.Principals != nil { - plan.Principals = flex.FlattenFrameworkStringList(ctx, output.CrossAccountAttachment.Principals) - } - if output.CrossAccountAttachment.Resources != nil { - resources, errDiags := flattenResources(ctx, output.CrossAccountAttachment.Resources) - if errDiags.HasError() { - resp.Diagnostics.Append(errDiags...) - return + if !new.Name.Equal(old.Name) || + !new.Principals.Equal(old.Principals) || + !new.Resources.Equal(old.Resources) { + input := &globalaccelerator.UpdateCrossAccountAttachmentInput{ + AttachmentArn: fwflex.StringFromFramework(ctx, new.ID), } - plan.Resources = resources - } - diags := resp.State.Set(ctx, &plan) - resp.Diagnostics.Append(diags...) - if diags.HasError() { - return - } -} - -var ResourceDataElementType = types.ObjectType{ - AttrTypes: map[string]attr.Type{ - "endpoint_id": types.StringType, - "region": types.StringType, - }, -} - -func expandResources(tfList []ResourceData) []*globalaccelerator.Resource { - if len(tfList) == 0 { - return nil - } - - apiResources := make([]*globalaccelerator.Resource, len(tfList)) - - for i, tfResource := range tfList { - apiResource := &globalaccelerator.Resource{ - EndpointId: aws.String(tfResource.EndpointID.ValueString()), + if !new.Name.Equal(old.Name) { + input.Name = aws.String(new.Name.ValueString()) } - if !tfResource.Region.IsNull() && tfResource.Region.ValueString() != "" { - apiResource.Region = aws.String(tfResource.Region.ValueString()) + if !new.Principals.Equal(old.Principals) { + oldPrincipals, newPrincipals := fwflex.ExpandFrameworkStringValueSet(ctx, old.Principals), fwflex.ExpandFrameworkStringValueSet(ctx, new.Principals) + input.AddPrincipals, input.RemovePrincipals = aws.StringSlice(newPrincipals.Difference(oldPrincipals)), aws.StringSlice(oldPrincipals.Difference(newPrincipals)) } - apiResources[i] = apiResource - } - - return apiResources -} + if !new.Resources.Equal(old.Resources) { + oldResources, diags := old.Resources.ToSlice(ctx) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } -func flattenResources(ctx context.Context, resources []*globalaccelerator.Resource) (types.List, diag.Diagnostics) { - var diags diag.Diagnostics + newResources, diags := new.Resources.ToSlice(ctx) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } - if len(resources) == 0 { - return types.ListNull(ResourceDataElementType), diags - } + add, remove, _ := flex.DiffSlices(oldResources, newResources, func(v1, v2 *resourceModel) bool { + return v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region) + }) - elems := []attr.Value{} - for _, resource := range resources { - endpointID := aws.StringValue(resource.EndpointId) - region := "" - // Extract the region from the ARN if the endpoint ID is an ARN - if arn.IsARN(endpointID) { - parsedARN, err := arn.Parse(endpointID) - if err != nil { - diags.AddError("Error parsing ARN", err.Error()) - continue + response.Diagnostics.Append(fwflex.Expand(ctx, add, input.AddResources)...) + if response.Diagnostics.HasError() { + return } - region = parsedARN.Region - } - obj := map[string]attr.Value{ - "endpoint_id": types.StringValue(endpointID), - "region": types.StringValue(region), + response.Diagnostics.Append(fwflex.Expand(ctx, remove, input.RemoveResources)...) + if response.Diagnostics.HasError() { + return + } } - objVal, d := types.ObjectValue(ResourceDataElementType.AttrTypes, obj) - diags.Append(d...) - - elems = append(elems, objVal) - } - - listVal, d := types.ListValue(ResourceDataElementType, elems) - diags.Append(d...) - - return listVal, diags -} -func diffResources(ctx context.Context, oldList, newList types.List) (toAdd, toRemove []*globalaccelerator.Resource, diags diag.Diagnostics) { - toAdd = []*globalaccelerator.Resource{} - toRemove = []*globalaccelerator.Resource{} - var oldSlice, newSlice []ResourceData + output, err := conn.UpdateCrossAccountAttachmentWithContext(ctx, input) - oldSlice, diags = convertListToResourceDataSlice(ctx, oldList) - if diags.HasError() { - return toAdd, toRemove, diags - } - - newSlice, diags = convertListToResourceDataSlice(ctx, newList) - if diags.HasError() { - return toAdd, toRemove, diags - } + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("updating Global Accelerator Cross-account Attachment (%s)", new.ID.ValueString()), err.Error()) - addSet, removeSet := diffResourceDataSlices(oldSlice, newSlice) + return + } - for _, r := range addSet { - toAdd = append(toAdd, &globalaccelerator.Resource{ - EndpointId: r.EndpointId, - Region: r.Region, - }) - } - for _, r := range removeSet { - toRemove = append(toRemove, &globalaccelerator.Resource{ - EndpointId: r.EndpointId, - Region: r.Region, - }) + new.LastModifiedTime = fwflex.TimeToFramework(ctx, output.CrossAccountAttachment.LastModifiedTime) + } else { + new.LastModifiedTime = old.LastModifiedTime } - return toAdd, toRemove, diags + response.Diagnostics.Append(response.State.Set(ctx, &new)...) } -func convertListToResourceDataSlice(ctx context.Context, resourceList types.List) ([]ResourceData, diag.Diagnostics) { - var diags diag.Diagnostics - var resourceDataSlice []ResourceData - - if !resourceList.IsNull() { - diags := resourceList.ElementsAs(ctx, &resourceDataSlice, false) - if diags.HasError() { - return nil, diags - } +func (r *crossAccountAttachmentResource) Delete(ctx context.Context, request resource.DeleteRequest, response *resource.DeleteResponse) { + var data crossAccountAttachmentResourceModel + response.Diagnostics.Append(request.State.Get(ctx, &data)...) + if response.Diagnostics.HasError() { + return } - return resourceDataSlice, diags -} + conn := r.Meta().GlobalAcceleratorConn(ctx) -func diffResourceDataSlices(oldSlice, newSlice []ResourceData) (toAdd, toRemove []*globalaccelerator.Resource) { - toRemoveMap := make(map[string]*globalaccelerator.Resource) - toAddMap := make(map[string]*globalaccelerator.Resource) + _, err := conn.DeleteCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DeleteCrossAccountAttachmentInput{ + AttachmentArn: fwflex.StringFromFramework(ctx, data.ID), + }) - for _, oldResource := range oldSlice { - key := generateCompositeKey(oldResource.EndpointID.ValueString(), oldResource.Region.ValueString()) - apiResource := &globalaccelerator.Resource{ - EndpointId: aws.String(oldResource.EndpointID.ValueString()), - } - if !oldResource.Region.IsNull() && oldResource.Region.ValueString() != "" { - apiResource.Region = aws.String(oldResource.Region.ValueString()) - } - toRemoveMap[key] = apiResource + if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAttachmentNotFoundException) { + return } - for _, newResource := range newSlice { - key := generateCompositeKey(newResource.EndpointID.ValueString(), newResource.Region.ValueString()) - apiResource := &globalaccelerator.Resource{ - EndpointId: aws.String(newResource.EndpointID.ValueString()), - } - if !newResource.Region.IsNull() && newResource.Region.ValueString() != "" { - apiResource.Region = aws.String(newResource.Region.ValueString()) - } - if _, found := toRemoveMap[key]; found { - delete(toRemoveMap, key) - } else { - toAddMap[key] = apiResource - } - } + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("deleting Global Accelerator Cross-account Attachment (%s)", data.ID.ValueString()), err.Error()) - for _, resource := range toRemoveMap { - toRemove = append(toRemove, resource) - } - for _, resource := range toAddMap { - toAdd = append(toAdd, resource) + return } +} - return toAdd, toRemove +func (r *crossAccountAttachmentResource) ModifyPlan(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { + r.SetTagsAll(ctx, request, response) } -func generateCompositeKey(endpointID, region string) string { - if region == "" { - region = "NO_REGION" // Special placeholder for resources without region +func findCrossAccountAttachmentByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.Attachment, error) { + input := &globalaccelerator.DescribeCrossAccountAttachmentInput{ + AttachmentArn: aws.String(arn), } - return endpointID + ":" + region + + return findCrossAccountAttachment(ctx, conn, input) } -func diffPrincipals(ctx context.Context, oldList, newList types.List) (toAdd, toRemove []*string, diags diag.Diagnostics) { - toAdd = []*string{} - toRemove = []*string{} - var oldSlice, newSlice []string - - if !oldList.IsNull() { - var oldElements []types.String - d := oldList.ElementsAs(ctx, &oldElements, false) - diags = append(diags, d...) - for _, element := range oldElements { - oldSlice = append(oldSlice, element.ValueString()) - } - } +func findCrossAccountAttachment(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCrossAccountAttachmentInput) (*globalaccelerator.Attachment, error) { + output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, input) - if !newList.IsNull() { - var newElements []types.String - d := newList.ElementsAs(ctx, &newElements, false) - diags = append(diags, d...) - for _, element := range newElements { - newSlice = append(newSlice, element.ValueString()) + if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAttachmentNotFoundException) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, } } - addSet, removeSet := diffSlices(oldSlice, newSlice) - - for elem := range addSet { - toAdd = append(toAdd, aws.String(elem)) + if err != nil { + return nil, err } - for elem := range removeSet { - toRemove = append(toRemove, aws.String(elem)) + if output == nil || output.CrossAccountAttachment == nil { + return nil, tfresource.NewEmptyResultError(input) } - return toAdd, toRemove, diags + return output.CrossAccountAttachment, nil } -func diffSlices(oldSlice, newSlice []string) (toAdd, toRemove map[string]struct{}) { - toAdd = make(map[string]struct{}) - toRemove = make(map[string]struct{}) - - for _, s := range oldSlice { - toRemove[s] = struct{}{} - } +type crossAccountAttachmentResourceModel struct { + AttachmentARN types.String `tfsdk:"arn"` + CreatedTime timetypes.RFC3339 `tfsdk:"created_time"` + ID types.String `tfsdk:"id"` + LastModifiedTime timetypes.RFC3339 `tfsdk:"last_modified_time"` + Name types.String `tfsdk:"name"` + Principals fwtypes.SetValueOf[types.String] `tfsdk:"principals"` + Resources fwtypes.SetNestedObjectValueOf[resourceModel] `tfsdk:"resource"` + Tags types.Map `tfsdk:"tags"` + TagsAll types.Map `tfsdk:"tags_all"` +} - for _, s := range newSlice { - if _, found := toRemove[s]; found { - delete(toRemove, s) - continue - } - toAdd[s] = struct{}{} - } +func (m *crossAccountAttachmentResourceModel) InitFromID() error { + m.AttachmentARN = m.ID - return toAdd, toRemove + return nil } -type resourceCrossAccountAttachmentData struct { - ID types.String `tfsdk:"id"` - ARN types.String `tfsdk:"arn"` - Name types.String `tfsdk:"name"` - Principals types.List `tfsdk:"principals"` - Resources types.List `tfsdk:"resources"` - CreatedTime types.String `tfsdk:"created_time"` - LastModifiedTime types.String `tfsdk:"last_modified_time"` +func (m *crossAccountAttachmentResourceModel) setID() { + m.ID = m.AttachmentARN } -type ResourceData struct { +type resourceModel struct { EndpointID types.String `tfsdk:"endpoint_id"` Region types.String `tfsdk:"region"` } diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index fe0f7bea9e09..a4e175a423a1 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -6,279 +6,24 @@ package globalaccelerator_test import ( "context" "fmt" - "math/rand" - "reflect" - "strconv" - "strings" "testing" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "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" - globalaccelerator_test "github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator" + tfglobalaccelerator "github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -func generateAccountID() string { - source := rand.NewSource(42) - rand := rand.New(source) - - accountID := "" - for i := 0; i < 12; i++ { - digit := rand.Intn(10) - accountID += strconv.Itoa(digit) - } - return accountID -} - -func TestExpandResources(t *testing.T) { - t.Parallel() - cases := []struct { - Input []globalaccelerator_test.ResourceData - ExpectedOutput []*globalaccelerator.Resource - }{ - { - Input: []globalaccelerator_test.ResourceData{}, - ExpectedOutput: nil, - }, - { - Input: []globalaccelerator_test.ResourceData{ - { - EndpointID: types.StringValue("endpoint-1"), - Region: types.StringValue(acctest.Region()), - }, - { - EndpointID: types.StringValue("endpoint-2"), - Region: types.StringValue(""), - }, - }, - ExpectedOutput: []*globalaccelerator.Resource{ - { - EndpointId: aws.String("endpoint-1"), - Region: aws.String(acctest.Region()), - }, - { - EndpointId: aws.String("endpoint-2"), - }, - }, - }, - } - - for _, tc := range cases { - output := globalaccelerator_test.ExpandResources(tc.Input) - if !reflect.DeepEqual(output, tc.ExpectedOutput) { - t.Fatalf("bad: expected %v, got %v", tc.ExpectedOutput, output) - } - } -} - -func TestFlattenResources(t *testing.T) { - t.Parallel() - elem := globalaccelerator_test.ResourceDataElementType - partition := acctest.Partition() - region := acctest.Region() - endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) - - endpoint1, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue(endpointID), - "region": types.StringValue(region), - }) - - expectedList, _ := types.ListValue(elem, []attr.Value{endpoint1}) - - testCases := []struct { - Name string - Input []*globalaccelerator.Resource - Expected types.List - }{ - { - Name: "empty input", - Input: []*globalaccelerator.Resource{}, - Expected: types.ListNull(elem), - }, - { - Name: "non-empty input", - Input: []*globalaccelerator.Resource{ - { - EndpointId: aws.String(endpointID), - Region: aws.String(region), - }, - }, - Expected: expectedList, - }, - } - - for _, tc := range testCases { - tc := tc - t.Run(tc.Name, func(t *testing.T) { - t.Parallel() - ctx := context.Background() - output, err := globalaccelerator_test.FlattenResources(ctx, tc.Input) - - if err != nil { - t.Fatalf("flattenResources() error = %v, wantErr %v", err, nil) - } - - if !reflect.DeepEqual(output, tc.Expected) { - t.Errorf("flattenResources() got = %v, want %v", output, tc.Expected) - } - }) - } -} - -func TestDiffResources(t *testing.T) { - t.Parallel() - ctx := context.Background() - elem := globalaccelerator_test.ResourceDataElementType - - partition := acctest.Partition() - region := acctest.Region() - alternateRegion := acctest.AlternateRegion() - endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) - endpointID2 := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef1", partition, alternateRegion) - - endpoint1Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue(endpointID), - "region": types.StringValue(region), - }) - endpoint2Object, _ := types.ObjectValue(elem.AttrTypes, map[string]attr.Value{ - "endpoint_id": types.StringValue(endpointID2), - "region": types.StringValue(alternateRegion), - }) - - expectedResource1 := &globalaccelerator.Resource{ - EndpointId: aws.String(endpointID), - Region: aws.String(region), - } - expectedResource2 := &globalaccelerator.Resource{ - EndpointId: aws.String(endpointID2), - Region: aws.String(alternateRegion), - } - - cases := []struct { - Name string - OldList types.List - NewList types.List - ExpectedToAdd []*globalaccelerator.Resource - ExpectedToRemove []*globalaccelerator.Resource - }{ - { - Name: "EmptyLists", - OldList: types.ListNull(elem), - NewList: types.ListNull(elem), - ExpectedToAdd: []*globalaccelerator.Resource{}, - ExpectedToRemove: []*globalaccelerator.Resource{}, - }, - { - Name: "Resource to add", - OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), - NewList: types.ListValueMust(elem, []attr.Value{endpoint1Object, endpoint2Object}), - ExpectedToAdd: []*globalaccelerator.Resource{ - expectedResource2, - }, - ExpectedToRemove: []*globalaccelerator.Resource{}, - }, - { - Name: "Resource to remove", - OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object, endpoint2Object}), - NewList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), - ExpectedToAdd: []*globalaccelerator.Resource{}, - ExpectedToRemove: []*globalaccelerator.Resource{ - expectedResource2, - }, - }, - { - Name: "Resource to add and remove", - OldList: types.ListValueMust(elem, []attr.Value{endpoint1Object}), - NewList: types.ListValueMust(elem, []attr.Value{endpoint2Object}), - ExpectedToAdd: []*globalaccelerator.Resource{ - expectedResource2, - }, - ExpectedToRemove: []*globalaccelerator.Resource{ - expectedResource1, - }, - }, - } - - for _, tc := range cases { - tc := tc - t.Run(tc.Name, func(t *testing.T) { - t.Parallel() - toAdd, toRemove, _ := globalaccelerator_test.DiffResources(ctx, tc.OldList, tc.NewList) - - if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { - t.Errorf("expected to add: %#v, got: %#v", tc.ExpectedToAdd, toAdd) - } - - if !reflect.DeepEqual(toRemove, tc.ExpectedToRemove) { - t.Errorf("expected to remove: %#v, got: %#v", tc.ExpectedToRemove, toRemove) - } - }) - } -} - -func TestDiffPrincipals(t *testing.T) { - t.Parallel() - ctx := context.Background() - - elemType := types.StringType - - principal1 := types.StringValue("principal-1") - principal2 := types.StringValue("principal-2") - - oldList, _ := types.ListValue(elemType, []attr.Value{principal1}) - newList, _ := types.ListValue(elemType, []attr.Value{principal2}) - - cases := []struct { - Name string - OldList types.List - NewList types.List - ExpectedToAdd []*string - ExpectedToRemove []*string - }{ - { - Name: "EmptyLists", - OldList: types.ListNull(elemType), - NewList: types.ListNull(elemType), - ExpectedToAdd: []*string{}, - ExpectedToRemove: []*string{}, - }, - { - Name: "NonEmptyLists", - OldList: oldList, - NewList: newList, - ExpectedToAdd: []*string{aws.String("principal-2")}, - ExpectedToRemove: []*string{aws.String("principal-1")}, - }, - } - - for _, tc := range cases { - tc := tc - t.Run(tc.Name, func(t *testing.T) { - t.Parallel() - toAdd, toRemove, _ := globalaccelerator_test.DiffPrincipals(ctx, tc.OldList, tc.NewList) - - if !reflect.DeepEqual(toAdd, tc.ExpectedToAdd) { - t.Errorf("expected to add: %#v, got: %#v", tc.ExpectedToAdd, toAdd) - } - - if !reflect.DeepEqual(toRemove, tc.ExpectedToRemove) { - t.Errorf("expected to remove: %#v, got: %#v", tc.ExpectedToRemove, toRemove) - } - }) - } -} - func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v *globalaccelerator.DescribeCrossAccountAttachmentOutput + rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + var v globalaccelerator.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -289,10 +34,16 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrossAccountAttachmentConfig_basic(rName), - Check: resource.ComposeTestCheckFunc( + Config: testAccCrossAccountAttachmentConfig_basic(rName1), + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttrSet(resourceName, "created_time"), + resource.TestCheckResourceAttrSet(resourceName, "last_modified_time"), + resource.TestCheckResourceAttr(resourceName, "name", rName1), + resource.TestCheckResourceAttr(resourceName, "principals.#", "0"), + resource.TestCheckResourceAttr(resourceName, "resource.#", "0"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { @@ -300,6 +51,13 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, }, + { + Config: testAccCrossAccountAttachmentConfig_basic(rName2), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "name", rName2), + ), + }, }, }) } @@ -307,8 +65,8 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v *globalaccelerator.DescribeCrossAccountAttachmentOutput - accountId := generateAccountID() + var v globalaccelerator.Attachment + rAccountID := sdkacctest.RandStringFromCharSet(12, "012346789") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -319,13 +77,13 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrossAccountAttachmentConfig_principals(rName, accountId), + Config: testAccCrossAccountAttachmentConfig_principals(rName, rAccountID), Check: resource.ComposeTestCheckFunc( testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "name", rName), - resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", accountId), resource.TestCheckResourceAttrSet(resourceName, "created_time"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_time"), + resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", rAccountID), + resource.TestCheckResourceAttr(resourceName, "name", rName), ), }, { @@ -337,11 +95,11 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { }) } +/* func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - partition := acctest.Partition() region := acctest.Region() alternateRegion := acctest.AlternateRegion() @@ -357,7 +115,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrossAccountAttachmentConfig_resources(rName, []globalaccelerator_test.ResourceData{ + Config: testAccCrossAccountAttachmentConfig_resources(rName, []tfglobalaccelerator.ResourceData{ {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, {EndpointID: types.StringValue(endpointID2), Region: types.StringValue(alternateRegion)}, }), @@ -375,12 +133,14 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { }, }) } +*/ +// TODO: tags func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v *globalaccelerator.DescribeCrossAccountAttachmentOutput + var v globalaccelerator.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -394,7 +154,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { Config: testAccCrossAccountAttachmentConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), - acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, globalaccelerator_test.ResourceCrossAccountAttachment, resourceName), + acctest.CheckFrameworkResourceDisappears(ctx, acctest.Provider, tfglobalaccelerator.ResourceCrossAccountAttachment, resourceName), ), ExpectNonEmptyPlan: true, }, @@ -411,44 +171,39 @@ func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.Tes continue } - _, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ - AttachmentArn: aws.String(rs.Primary.ID), - }) - if err != nil && strings.Contains(err.Error(), "AttachmentNotFoundException") { - return nil - } else if err != nil { - return fmt.Errorf("error checking if Global Accelerator Cross Account Attachment %s still exists: %s", rs.Primary.ID, err) + _, err := tfglobalaccelerator.FindCrossAccountAttachmentByARN(ctx, conn, rs.Primary.ID) + + if tfresource.NotFound(err) { + continue + } + + if err != nil { + return err } - return fmt.Errorf("Global Accelerator Cross Account Attachment %s still exists", rs.Primary.ID) + return fmt.Errorf("Global Accelerator ross-account Attachment %s still exists", rs.Primary.ID) } return nil } } -func testAccCheckCrossAccountAttachmentExists(ctx context.Context, resourceName string, v **globalaccelerator.DescribeCrossAccountAttachmentOutput) resource.TestCheckFunc { +func testAccCheckCrossAccountAttachmentExists(ctx context.Context, n string, v *globalaccelerator.Attachment) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[resourceName] + rs, ok := s.RootModule().Resources[n] if !ok { - return fmt.Errorf("Not found: %s", resourceName) + return fmt.Errorf("Not found: %s", n) } conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DescribeCrossAccountAttachmentInput{ - AttachmentArn: aws.String(rs.Primary.ID), - }) + output, err := tfglobalaccelerator.FindCrossAccountAttachmentByARN(ctx, conn, rs.Primary.ID) if err != nil { return err } - if output == nil || output.CrossAccountAttachment == nil { - return fmt.Errorf("Global Accelerator Cross Account Attachment %s does not exist", rs.Primary.ID) - } - - *v = output + *v = *output return nil } @@ -462,16 +217,17 @@ resource "aws_globalaccelerator_cross_account_attachment" "test" { `, rName) } -func testAccCrossAccountAttachmentConfig_principals(rName string, accountId string) string { +func testAccCrossAccountAttachmentConfig_principals(rName string, accountID string) string { return fmt.Sprintf(` resource "aws_globalaccelerator_cross_account_attachment" "test" { name = %[1]q principals = [%[2]q] } -`, rName, accountId) +`, rName, accountID) } -func testAccCrossAccountAttachmentConfig_resources(rName string, resources []globalaccelerator_test.ResourceData) string { +/* +func testAccCrossAccountAttachmentConfig_resources(rName string, resources []tfglobalaccelerator.ResourceData) string { var resourcesStr []string for _, r := range resources { resourcesStr = append(resourcesStr, fmt.Sprintf(`{ endpoint_id = "%s", region = "%s" }`, r.EndpointID.ValueString(), r.Region.ValueString())) @@ -483,3 +239,4 @@ resource "aws_globalaccelerator_cross_account_attachment" "test" { } `, rName, strings.Join(resourcesStr, ", ")) } +*/ diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index e4f22b79e313..4d8047be5150 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -5,9 +5,7 @@ package globalaccelerator // Exports for use in tests only. var ( - ExpandResources = expandResources - FlattenResources = flattenResources - DiffResources = diffResources - DiffPrincipals = diffPrincipals - ResourceCrossAccountAttachment = newResourceCrossAccountAttachment + ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + + FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN ) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 7acc6f4288af..02ac07ab0f80 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -23,7 +23,7 @@ func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.Serv func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.ServicePackageFrameworkResource { return []*types.ServicePackageFrameworkResource{ { - Factory: newResourceCrossAccountAttachment, + Factory: newCrossAccountAttachmentResource, Name: "Cross Account Attachment", }, } diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown index 3060be55796b..bb7c718a92be 100644 --- a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -43,6 +43,7 @@ The following arguments are optional: * `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator. * `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region`. The `region` field is optional. +* `tags` - (Optional) A map of tags to assign to the resource. 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 @@ -52,6 +53,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - ID of the Cross Account Attachment. * `created_time` - Creation Time when the Cross Account Attachment. * `last_modified_time` - Last modified time of the Cross Account Attachment. +* `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 From 50c597935c3d62c2b883b0e70d39bff0255bec5a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 17:14:42 -0400 Subject: [PATCH 063/137] Acceptance test output: % make testacc TESTARGS='-run=TestAccGlobalAcceleratorCrossAccountAttachment_basic' PKG=globalaccelerator ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.2 test ./internal/service/globalaccelerator/... -v -count 1 -parallel 20 -run=TestAccGlobalAcceleratorCrossAccountAttachment_basic -timeout 360m === RUN TestAccGlobalAcceleratorCrossAccountAttachment_basic === PAUSE TestAccGlobalAcceleratorCrossAccountAttachment_basic === CONT TestAccGlobalAcceleratorCrossAccountAttachment_basic --- PASS: TestAccGlobalAcceleratorCrossAccountAttachment_basic (30.41s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator 41.164s From 9ba8e78134783b06448e0c32e28a4cc354eeb5f2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 22 Apr 2024 17:15:14 -0400 Subject: [PATCH 064/137] Correct CHANGELOG entry file name. --- .changelog/{35991.text => 35991.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{35991.text => 35991.txt} (100%) diff --git a/.changelog/35991.text b/.changelog/35991.txt similarity index 100% rename from .changelog/35991.text rename to .changelog/35991.txt From ded256ee045d9ace8936949a2460ccbc9fa51034 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Mon, 22 Apr 2024 14:52:29 -0700 Subject: [PATCH 065/137] Fix double-backtick typo in website docs --- website/docs/r/codecommit_repository.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/codecommit_repository.html.markdown b/website/docs/r/codecommit_repository.html.markdown index 2bdea448866c..4d586b7efb59 100644 --- a/website/docs/r/codecommit_repository.html.markdown +++ b/website/docs/r/codecommit_repository.html.markdown @@ -41,7 +41,7 @@ This resource supports the following arguments: * `repository_name` - (Required) The name for the repository. This needs to be less than 100 characters. * `description` - (Optional) The description of the repository. This needs to be less than 1000 characters * `default_branch` - (Optional) The default branch of the repository. The branch specified here needs to exist. -* `kms_key_id` - (Optional) The ARN of the encryption key. If no key is specified, the default `aws/codecommit`` Amazon Web Services managed key is used. +* `kms_key_id` - (Optional) The ARN of the encryption key. If no key is specified, the default `aws/codecommit` Amazon Web Services managed key is used. * `tags` - (Optional) Key-value map of resource tags. 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 From 90c7af546c04bf899278d786ba74f273e0bb8130 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 19 Apr 2024 12:54:32 -0700 Subject: [PATCH 066/137] Adds Go package path and alias handling for `generator` --- internal/generate/tagstests/file.tmpl | 3 +++ internal/generate/tagstests/main.go | 29 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/internal/generate/tagstests/file.tmpl b/internal/generate/tagstests/file.tmpl index 5d5eb70b9f99..c5ee944ab528 100644 --- a/internal/generate/tagstests/file.tmpl +++ b/internal/generate/tagstests/file.tmpl @@ -51,6 +51,9 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" + {{ range .GoImports -}} + {{ if .Alias }}{{ .Alias }} {{ end }}"{{ .Path }}" + {{ end }} ) {{ if .Serialize }} diff --git a/internal/generate/tagstests/main.go b/internal/generate/tagstests/main.go index 330dd0a98425..7cd6245bbfb6 100644 --- a/internal/generate/tagstests/main.go +++ b/internal/generate/tagstests/main.go @@ -111,6 +111,12 @@ type ResourceDatum struct { Implementation implementation Serialize bool PreCheck bool + GoImports []goImport +} + +type goImport struct { + Path string + Alias string } //go:embed file.tmpl @@ -221,7 +227,28 @@ func (v *visitor) processFuncDecl(funcDecl *ast.FuncDecl) { d.ExistsTypeName = typeName } if attr, ok := args.Keyword["generator"]; ok { - d.Generator = attr + parts := strings.Split(attr, ";") + switch len(parts) { + case 1: + d.Generator = parts[0] + + case 2: + d.Generator = parts[1] + d.GoImports = append(d.GoImports, goImport{ + Path: parts[0], + }) + + case 3: + d.Generator = parts[2] + d.GoImports = append(d.GoImports, goImport{ + Path: parts[0], + Alias: parts[1], + }) + + default: + v.errs = append(v.errs, fmt.Errorf("invalid generator value: %q at %s.", attr, fmt.Sprintf("%s.%s", v.packageName, v.functionName))) + continue + } } if attr, ok := args.Keyword["importIgnore"]; ok { d.ImportIgnore = strings.Split(attr, ";") From a865d2d7974ed5f603e88dc71aa7df70573c8dee Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 19 Apr 2024 12:56:53 -0700 Subject: [PATCH 067/137] Skip empty tag tests for resources that have minimum tag value length of 1 --- internal/generate/tagstests/file.tmpl | 12 ++++++++++++ internal/generate/tagstests/main.go | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/internal/generate/tagstests/file.tmpl b/internal/generate/tagstests/file.tmpl index c5ee944ab528..972794fa2a95 100644 --- a/internal/generate/tagstests/file.tmpl +++ b/internal/generate/tagstests/file.tmpl @@ -176,6 +176,9 @@ func {{ template "testname" . }}_tags_AddOnUpdate(t *testing.T) { } func {{ template "testname" . }}_tags_EmptyTag_OnCreate(t *testing.T) { +{{- if .SkipEmptyTags }} + t.Skip("Resource {{ .Name }} does not support empty tags") +{{ end }} {{- template "Init" . }} resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ @@ -203,6 +206,9 @@ func {{ template "testname" . }}_tags_EmptyTag_OnCreate(t *testing.T) { } func {{ template "testname" . }}_tags_EmptyTag_OnUpdate_Add(t *testing.T) { +{{- if .SkipEmptyTags }} + t.Skip("Resource {{ .Name }} does not support empty tags") +{{ end }} {{- template "Init" . }} resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ @@ -240,6 +246,9 @@ func {{ template "testname" . }}_tags_EmptyTag_OnUpdate_Add(t *testing.T) { } func {{ template "testname" . }}_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { +{{- if .SkipEmptyTags }} + t.Skip("Resource {{ .Name }} does not support empty tags") +{{ end }} {{- template "Init" . }} resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ @@ -503,6 +512,9 @@ func {{ template "testname" . }}_tags_DefaultTags_updateToResourceOnly(t *testin } func {{ template "testname" . }}_tags_DefaultTags_emptyResourceTag(t *testing.T) { +{{- if .SkipEmptyTags }} + t.Skip("Resource {{ .Name }} does not support empty tags") +{{ end }} {{- template "Init" . }} resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ diff --git a/internal/generate/tagstests/main.go b/internal/generate/tagstests/main.go index 7cd6245bbfb6..68d85fe0d159 100644 --- a/internal/generate/tagstests/main.go +++ b/internal/generate/tagstests/main.go @@ -111,6 +111,7 @@ type ResourceDatum struct { Implementation implementation Serialize bool PreCheck bool + SkipEmptyTags bool // TODO: Remove when we have a strategy for resources that have a minimum tag value length of 1 GoImports []goImport } @@ -281,6 +282,14 @@ func (v *visitor) processFuncDecl(funcDecl *ast.FuncDecl) { skip = true } } + if attr, ok := args.Keyword["skipEmptyTags"]; ok { + if b, err := strconv.ParseBool(attr); err != nil { + v.errs = append(v.errs, fmt.Errorf("invalid skipEmptyTags value: %q at %s. Should be boolean value.", attr, fmt.Sprintf("%s.%s", v.packageName, v.functionName))) + continue + } else { + d.SkipEmptyTags = b + } + } } } } From a948747ee71966e8c2842ae301c0eb2510fa854f Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 19 Apr 2024 12:58:10 -0700 Subject: [PATCH 068/137] Normalizes name of `testAccCheckPortfolioDestroy` --- .../service/servicecatalog/portfolio_data_source_test.go | 2 +- internal/service/servicecatalog/portfolio_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/servicecatalog/portfolio_data_source_test.go b/internal/service/servicecatalog/portfolio_data_source_test.go index 8f7bf425b678..08159befbf97 100644 --- a/internal/service/servicecatalog/portfolio_data_source_test.go +++ b/internal/service/servicecatalog/portfolio_data_source_test.go @@ -22,7 +22,7 @@ func TestAccServiceCatalogPortfolioDataSource_basic(t *testing.T) { PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy(ctx), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccPortfolioDataSourceConfig_basic(rName), diff --git a/internal/service/servicecatalog/portfolio_test.go b/internal/service/servicecatalog/portfolio_test.go index 89483d93ed61..de426cbf3853 100644 --- a/internal/service/servicecatalog/portfolio_test.go +++ b/internal/service/servicecatalog/portfolio_test.go @@ -30,7 +30,7 @@ func TestAccServiceCatalogPortfolio_basic(t *testing.T) { PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy(ctx), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccPortfolioConfig_basic(name), @@ -63,7 +63,7 @@ func TestAccServiceCatalogPortfolio_disappears(t *testing.T) { PreCheck: func() { acctest.PreCheck(ctx, t) }, ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy(ctx), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), Steps: []resource.TestStep{ { Config: testAccPortfolioConfig_basic(name), @@ -151,7 +151,7 @@ func testAccCheckPortfolioExists(ctx context.Context, n string, v *servicecatalo } } -func testAccCheckServiceCatlaogPortfolioDestroy(ctx context.Context) resource.TestCheckFunc { +func testAccCheckPortfolioDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).ServiceCatalogConn(ctx) From 290e3fda8b9e970fee7f245621942b2612b1b67b Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 19 Apr 2024 13:00:42 -0700 Subject: [PATCH 069/137] Generates Portfolio tag tests --- internal/service/servicecatalog/generate.go | 1 + internal/service/servicecatalog/portfolio.go | 1 + .../servicecatalog/portfolio_tags_gen_test.go | 701 ++++++++++++++++++ .../service/servicecatalog/portfolio_test.go | 73 +- 4 files changed, 727 insertions(+), 49 deletions(-) create mode 100644 internal/service/servicecatalog/portfolio_tags_gen_test.go diff --git a/internal/service/servicecatalog/generate.go b/internal/service/servicecatalog/generate.go index bf6c4db1fc5b..57574ebc5bcf 100644 --- a/internal/service/servicecatalog/generate.go +++ b/internal/service/servicecatalog/generate.go @@ -3,6 +3,7 @@ //go:generate go run ../../generate/tags/main.go -ServiceTagsSlice //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. package servicecatalog diff --git a/internal/service/servicecatalog/portfolio.go b/internal/service/servicecatalog/portfolio.go index 2a1e79d33003..b42e2dae3883 100644 --- a/internal/service/servicecatalog/portfolio.go +++ b/internal/service/servicecatalog/portfolio.go @@ -26,6 +26,7 @@ import ( // @SDKResource("aws_servicecatalog_portfolio", name="Portfolio") // @Tags +// @Testing(existsType="github.com/aws/aws-sdk-go/service/servicecatalog.DescribePortfolioOutput", generator="github.com/hashicorp/terraform-plugin-testing/helper/acctest;sdkacctest;sdkacctest.RandString(5)", skipEmptyTags=true) func ResourcePortfolio() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourcePortfolioCreate, diff --git a/internal/service/servicecatalog/portfolio_tags_gen_test.go b/internal/service/servicecatalog/portfolio_tags_gen_test.go new file mode 100644 index 000000000000..3a13209896e1 --- /dev/null +++ b/internal/service/servicecatalog/portfolio_tags_gen_test.go @@ -0,0 +1,701 @@ +// Code generated by internal/generate/tagstests/main.go; DO NOT EDIT. + +package servicecatalog_test + +import ( + "testing" + + "github.com/aws/aws-sdk-go/service/servicecatalog" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestAccServiceCatalogPortfolio_tags(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags1(rName, "key2", "value2"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_null(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tagsNull(rName, "key1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags0(rName), + PlanOnly: true, + ExpectNonEmptyPlan: false, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_AddOnUpdate(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_EmptyTag_OnCreate(t *testing.T) { + t.Skip("Resource Portfolio does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_EmptyTag_OnUpdate_Add(t *testing.T) { + t.Skip("Resource Portfolio does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccPortfolioConfig_tags2(rName, "key1", "value1", "key2", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { + t.Skip("Resource Portfolio does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccPortfolioConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_providerOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("key1", "value1updated", "key2", "value2"), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key2", "value2"), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags0(), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_nonOverlapping(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccPortfolioConfig_tags1(rName, "resourcekey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1updated"), + testAccPortfolioConfig_tags2(rName, "resourcekey1", "resourcevalue1updated", "resourcekey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags0(), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_overlapping(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccPortfolioConfig_tags1(rName, "overlapkey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("overlapkey1", "providervalue1", "overlapkey2", "providervalue2"), + testAccPortfolioConfig_tags2(rName, "overlapkey1", "resourcevalue1", "overlapkey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccPortfolioConfig_tags1(rName, "overlapkey1", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_updateToProviderOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_updateToResourceOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccPortfolioConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: testAccPortfolioConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_emptyResourceTag(t *testing.T) { + t.Skip("Resource Portfolio does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccPortfolioConfig_tags1(rName, "key1", ""), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "providervalue1"), + testAccPortfolioConfig_tagsNull(rName, "key1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccPortfolioConfig_tagsNull(rName, "resourcekey1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/portfolio_test.go b/internal/service/servicecatalog/portfolio_test.go index de426cbf3853..7cd4e8e32038 100644 --- a/internal/service/servicecatalog/portfolio_test.go +++ b/internal/service/servicecatalog/portfolio_test.go @@ -77,55 +77,6 @@ func TestAccServiceCatalogPortfolio_disappears(t *testing.T) { }) } -func TestAccServiceCatalogPortfolio_tags(t *testing.T) { - ctx := acctest.Context(t) - resourceName := "aws_servicecatalog_portfolio.test" - name := sdkacctest.RandString(5) - var dpo servicecatalog.DescribePortfolioOutput - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccPortfolioConfig_tags1(name, "key1", "value1"), - Check: resource.ComposeTestCheckFunc( - testAccCheckPortfolioExists(ctx, resourceName, &dpo), - resource.TestCheckResourceAttr(resourceName, "name", name), - resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccPortfolioConfig_tags2(name, "key1", "value1updated", "key2", "value2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckPortfolioExists(ctx, resourceName, &dpo), - resource.TestCheckResourceAttr(resourceName, "name", name), - resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), - resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), - ), - }, - { - Config: testAccPortfolioConfig_tags1(name, "key2", "value2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckPortfolioExists(ctx, resourceName, &dpo), - resource.TestCheckResourceAttr(resourceName, "name", name), - resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), - ), - }, - }, - }) -} - func testAccCheckPortfolioExists(ctx context.Context, n string, v *servicecatalog.DescribePortfolioOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -187,6 +138,16 @@ resource "aws_servicecatalog_portfolio" "test" { `, name) } +func testAccPortfolioConfig_tags0(name string) string { + return fmt.Sprintf(` +resource "aws_servicecatalog_portfolio" "test" { + name = %[1]q + description = "test-b" + provider_name = "test-c" +} +`, name) +} + func testAccPortfolioConfig_tags1(name, tagKey1, tagValue1 string) string { return fmt.Sprintf(` resource "aws_servicecatalog_portfolio" "test" { @@ -215,3 +176,17 @@ resource "aws_servicecatalog_portfolio" "test" { } `, name, tagKey1, tagValue1, tagKey2, tagValue2) } + +func testAccPortfolioConfig_tagsNull(name, tagKey1 string) string { + return fmt.Sprintf(` +resource "aws_servicecatalog_portfolio" "test" { + name = %[1]q + description = "test-b" + provider_name = "test-c" + + tags = { + %[2]q = null + } +} +`, name, tagKey1) +} From 43d90bde0444b2f408a47a972ca23bc31afb56d8 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 19 Apr 2024 13:17:29 -0700 Subject: [PATCH 070/137] Generates Product tag tests --- internal/service/servicecatalog/product.go | 1 + .../servicecatalog/product_tags_gen_test.go | 764 ++++++++++++++++++ .../service/servicecatalog/product_test.go | 121 ++- 3 files changed, 844 insertions(+), 42 deletions(-) create mode 100644 internal/service/servicecatalog/product_tags_gen_test.go diff --git a/internal/service/servicecatalog/product.go b/internal/service/servicecatalog/product.go index c7dbc4734de9..0948f1083f32 100644 --- a/internal/service/servicecatalog/product.go +++ b/internal/service/servicecatalog/product.go @@ -26,6 +26,7 @@ import ( // @SDKResource("aws_servicecatalog_product", name="Product") // @Tags(identifierAttribute="id") +// @Testing(skipEmptyTags=true, importIgnore="accept_language;provisioning_artifact_parameters.0.disable_template_validation") func ResourceProduct() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceProductCreate, diff --git a/internal/service/servicecatalog/product_tags_gen_test.go b/internal/service/servicecatalog/product_tags_gen_test.go new file mode 100644 index 000000000000..fa7b8e140ca2 --- /dev/null +++ b/internal/service/servicecatalog/product_tags_gen_test.go @@ -0,0 +1,764 @@ +// Code generated by internal/generate/tagstests/main.go; DO NOT EDIT. + +package servicecatalog_test + +import ( + "testing" + + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestAccServiceCatalogProduct_tags(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags1(rName, "key2", "value2"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_null(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tagsNull(rName, "key1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags0(rName), + PlanOnly: true, + ExpectNonEmptyPlan: false, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_AddOnUpdate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_EmptyTag_OnCreate(t *testing.T) { + t.Skip("Resource Product does not support empty tags") + + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_EmptyTag_OnUpdate_Add(t *testing.T) { + t.Skip("Resource Product does not support empty tags") + + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccProductConfig_tags2(rName, "key1", "value1", "key2", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { + t.Skip("Resource Product does not support empty tags") + + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccProductConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_providerOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("key1", "value1updated", "key2", "value2"), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key2", "value2"), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags0(), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_nonOverlapping(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccProductConfig_tags1(rName, "resourcekey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1updated"), + testAccProductConfig_tags2(rName, "resourcekey1", "resourcevalue1updated", "resourcekey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags0(), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_overlapping(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccProductConfig_tags1(rName, "overlapkey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("overlapkey1", "providervalue1", "overlapkey2", "providervalue2"), + testAccProductConfig_tags2(rName, "overlapkey1", "resourcevalue1", "overlapkey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccProductConfig_tags1(rName, "overlapkey1", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_updateToProviderOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_updateToResourceOnly(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: testAccProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_emptyResourceTag(t *testing.T) { + t.Skip("Resource Product does not support empty tags") + + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProductConfig_tags1(rName, "key1", ""), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "providervalue1"), + testAccProductConfig_tagsNull(rName, "key1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccProductConfig_tagsNull(rName, "resourcekey1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/product_test.go b/internal/service/servicecatalog/product_test.go index 6326be356bb2..91e9ed1f0cc9 100644 --- a/internal/service/servicecatalog/product_test.go +++ b/internal/service/servicecatalog/product_test.go @@ -138,40 +138,6 @@ func TestAccServiceCatalogProduct_update(t *testing.T) { }) } -func TestAccServiceCatalogProduct_updateTags(t *testing.T) { - ctx := acctest.Context(t) - resourceName := "aws_servicecatalog_product.test" - - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckProductDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccProductConfig_basic(rName, "beskrivning", "supportbeskrivning", domain, acctest.DefaultEmailAddress), - Check: resource.ComposeTestCheckFunc( - testAccCheckProductExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - ), - }, - { - Config: testAccProductConfig_updateTags(rName, "beskrivning", "supportbeskrivning", domain, acctest.DefaultEmailAddress), - Check: resource.ComposeTestCheckFunc( - testAccCheckProductExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr(resourceName, "tags.Yak", rName), - resource.TestCheckResourceAttr(resourceName, "tags.Environment", "natural"), - ), - }, - }, - }) -} - func TestAccServiceCatalogProduct_physicalID(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_servicecatalog_product.test" @@ -337,19 +303,38 @@ resource "aws_servicecatalog_product" "test" { `, rName, description, supportDescription, domain, email)) } -func testAccProductConfig_updateTags(rName, description, supportDescription, domain, email string) string { +func testAccProductConfig_tags0(rName string) string { return acctest.ConfigCompose(testAccProductTemplateURLBaseConfig(rName), fmt.Sprintf(` data "aws_partition" "current" {} resource "aws_servicecatalog_product" "test" { - description = %[2]q + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = %[1]q + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } +} +`, rName)) +} + +func testAccProductConfig_tags1(rName, tagKey1, tagValue1 string) string { + return acctest.ConfigCompose(testAccProductTemplateURLBaseConfig(rName), fmt.Sprintf(` +data "aws_partition" "current" {} + +resource "aws_servicecatalog_product" "test" { + description = %[1]q distributor = "distributör" name = %[1]q owner = "ägare" type = "CLOUD_FORMATION_TEMPLATE" - support_description = %[3]q - support_email = %[5]q - support_url = %[4]q provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -360,11 +345,63 @@ resource "aws_servicecatalog_product" "test" { } tags = { - Yak = %[1]q - Environment = "natural" + %[2]q = %[3]q } } -`, rName, description, supportDescription, domain, email)) +`, rName, tagKey1, tagValue1)) +} + +func testAccProductConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return acctest.ConfigCompose(testAccProductTemplateURLBaseConfig(rName), fmt.Sprintf(` +data "aws_partition" "current" {} + +resource "aws_servicecatalog_product" "test" { + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = %[1]q + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } + + tags = { + %[2]q = %[3]q + %[4]q = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2)) +} + +func testAccProductConfig_tagsNull(rName, tagKey1 string) string { + return acctest.ConfigCompose(testAccProductTemplateURLBaseConfig(rName), fmt.Sprintf(` +data "aws_partition" "current" {} + +resource "aws_servicecatalog_product" "test" { + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = %[1]q + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } + + tags = { + %[2]q = null + } +} +`, rName, tagKey1)) } func testAccProductConfig_physicalID(rName, domain, email string) string { From 653eda8ec67a6bea5d2ccad4ebca2f0a924d8553 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 22 Apr 2024 10:30:23 -0700 Subject: [PATCH 071/137] Product supports tag-on-update --- internal/service/servicecatalog/product.go | 78 +++++++++++-------- .../servicecatalog/service_package_gen.go | 4 +- internal/service/servicecatalog/tags.go | 35 --------- 3 files changed, 46 insertions(+), 71 deletions(-) diff --git a/internal/service/servicecatalog/product.go b/internal/service/servicecatalog/product.go index 0948f1083f32..b53f91f665fc 100644 --- a/internal/service/servicecatalog/product.go +++ b/internal/service/servicecatalog/product.go @@ -25,7 +25,7 @@ import ( ) // @SDKResource("aws_servicecatalog_product", name="Product") -// @Tags(identifierAttribute="id") +// @Tags // @Testing(skipEmptyTags=true, importIgnore="accept_language;provisioning_artifact_parameters.0.disable_template_validation") func ResourceProduct() *schema.Resource { return &schema.Resource{ @@ -267,50 +267,62 @@ func resourceProductUpdate(ctx context.Context, d *schema.ResourceData, meta int var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ServiceCatalogConn(ctx) - if d.HasChangesExcept("tags", "tags_all") { - input := &servicecatalog.UpdateProductInput{ - Id: aws.String(d.Id()), - } + input := &servicecatalog.UpdateProductInput{ + Id: aws.String(d.Id()), + } - if v, ok := d.GetOk("accept_language"); ok { - input.AcceptLanguage = aws.String(v.(string)) - } + if v, ok := d.GetOk("accept_language"); ok { + input.AcceptLanguage = aws.String(v.(string)) + } - if v, ok := d.GetOk("description"); ok { - input.Description = aws.String(v.(string)) - } + if v, ok := d.GetOk("description"); ok { + input.Description = aws.String(v.(string)) + } - if v, ok := d.GetOk("distributor"); ok { - input.Distributor = aws.String(v.(string)) - } + if v, ok := d.GetOk("distributor"); ok { + input.Distributor = aws.String(v.(string)) + } - if v, ok := d.GetOk("name"); ok { - input.Name = aws.String(v.(string)) - } + if v, ok := d.GetOk("name"); ok { + input.Name = aws.String(v.(string)) + } - if v, ok := d.GetOk("owner"); ok { - input.Owner = aws.String(v.(string)) - } + if v, ok := d.GetOk("owner"); ok { + input.Owner = aws.String(v.(string)) + } - if v, ok := d.GetOk("support_description"); ok { - input.SupportDescription = aws.String(v.(string)) - } + if v, ok := d.GetOk("support_description"); ok { + input.SupportDescription = aws.String(v.(string)) + } + + if v, ok := d.GetOk("support_email"); ok { + input.SupportEmail = aws.String(v.(string)) + } + + if v, ok := d.GetOk("support_url"); ok { + input.SupportUrl = aws.String(v.(string)) + } - if v, ok := d.GetOk("support_email"); ok { - input.SupportEmail = aws.String(v.(string)) + if d.HasChange(names.AttrTagsAll) { + o, n := d.GetChange(names.AttrTagsAll) + oldTags := tftags.New(ctx, o) + newTags := tftags.New(ctx, n) + + if removedTags := oldTags.Removed(newTags).IgnoreSystem(names.ServiceCatalog); len(removedTags) > 0 { + input.RemoveTags = aws.StringSlice(removedTags.Keys()) } - if v, ok := d.GetOk("support_url"); ok { - input.SupportUrl = aws.String(v.(string)) + if updatedTags := oldTags.Updated(newTags).IgnoreSystem(names.ServiceCatalog); len(updatedTags) > 0 { + input.AddTags = Tags(updatedTags) } + } - _, err := tfresource.RetryWhenAWSErrMessageContains(ctx, d.Timeout(schema.TimeoutUpdate), func() (interface{}, error) { - return conn.UpdateProductWithContext(ctx, input) - }, servicecatalog.ErrCodeInvalidParametersException, "profile does not exist") + _, err := tfresource.RetryWhenAWSErrMessageContains(ctx, d.Timeout(schema.TimeoutUpdate), func() (interface{}, error) { + return conn.UpdateProductWithContext(ctx, input) + }, servicecatalog.ErrCodeInvalidParametersException, "profile does not exist") - if err != nil { - return sdkdiag.AppendErrorf(diags, "updating Service Catalog Product (%s): %s", d.Id(), err) - } + if err != nil { + return sdkdiag.AppendErrorf(diags, "updating Service Catalog Product (%s): %s", d.Id(), err) } return append(diags, resourceProductRead(ctx, d, meta)...) diff --git a/internal/service/servicecatalog/service_package_gen.go b/internal/service/servicecatalog/service_package_gen.go index f1a5e8aeebc8..bb0eb4609cd9 100644 --- a/internal/service/servicecatalog/service_package_gen.go +++ b/internal/service/servicecatalog/service_package_gen.go @@ -84,9 +84,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka Factory: ResourceProduct, TypeName: "aws_servicecatalog_product", Name: "Product", - Tags: &types.ServicePackageResourceTags{ - IdentifierAttribute: "id", - }, + Tags: &types.ServicePackageResourceTags{}, }, { Factory: ResourceProductPortfolioAssociation, diff --git a/internal/service/servicecatalog/tags.go b/internal/service/servicecatalog/tags.go index 6e494aee47f3..b5a82780a26c 100644 --- a/internal/service/servicecatalog/tags.go +++ b/internal/service/servicecatalog/tags.go @@ -8,43 +8,14 @@ package servicecatalog import ( "context" - "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/aws/aws-sdk-go/service/servicecatalog/servicecatalogiface" - "github.com/hashicorp/terraform-provider-aws/internal/conns" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" - "github.com/hashicorp/terraform-provider-aws/names" ) // Custom Service Catalog tag service update functions using the same format as generated code. -func productUpdateTags(ctx context.Context, conn servicecatalogiface.ServiceCatalogAPI, identifier string, oldTagsMap, newTagsMap any) error { - oldTags := tftags.New(ctx, oldTagsMap) - newTags := tftags.New(ctx, newTagsMap) - - input := &servicecatalog.UpdateProductInput{ - Id: aws.String(identifier), - } - - if removedTags := oldTags.Removed(newTags).IgnoreSystem(names.ServiceCatalog); len(removedTags) > 0 { - input.RemoveTags = aws.StringSlice(removedTags.Keys()) - } - - if updatedTags := oldTags.Updated(newTags).IgnoreSystem(names.ServiceCatalog); len(updatedTags) > 0 { - input.AddTags = Tags(updatedTags) - } - - _, err := conn.UpdateProductWithContext(ctx, input) - - if err != nil { - return fmt.Errorf("updating tags for Service Catalog Product (%s): %w", identifier, err) - } - - return nil -} - func recordKeyValueTags(ctx context.Context, tags []*servicecatalog.RecordTag) tftags.KeyValueTags { m := make(map[string]*string, len(tags)) @@ -54,9 +25,3 @@ func recordKeyValueTags(ctx context.Context, tags []*servicecatalog.RecordTag) t return tftags.New(ctx, m) } - -// UpdateTags updates servicecatalog service tags. -// It is called from outside this package. -func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { - return productUpdateTags(ctx, meta.(*conns.AWSClient).ServiceCatalogConn(ctx), identifier, oldTags, newTags) -} From 8b9dbfe5d0039eaa261a6baaa82818d88fb8df51 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 22 Apr 2024 18:14:47 -0700 Subject: [PATCH 072/137] Always send tags on update for Provisioned Product --- internal/acctest/s3.go | 34 + internal/service/s3/exports.go | 2 + internal/service/s3/exports_test.go | 1 - .../servicecatalog/provisioned_product.go | 7 +- .../provisioned_product_tags_test.go | 780 ++++++++++++++++++ .../provisioned_product_test.go | 235 +++++- 6 files changed, 1019 insertions(+), 40 deletions(-) create mode 100644 internal/acctest/s3.go create mode 100644 internal/service/servicecatalog/provisioned_product_tags_test.go diff --git a/internal/acctest/s3.go b/internal/acctest/s3.go new file mode 100644 index 000000000000..4debc3a9c6f3 --- /dev/null +++ b/internal/acctest/s3.go @@ -0,0 +1,34 @@ +package acctest + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + tfs3 "github.com/hashicorp/terraform-provider-aws/internal/service/s3" +) + +func S3BucketHasTag(ctx context.Context, bucketName, key, value string) resource.TestCheckFunc { + return func(s *terraform.State) error { + conn := Provider.Meta().(*conns.AWSClient).S3Client(ctx) + + tags, err := tfs3.BucketListTags(ctx, conn, bucketName) + if err != nil { + return err + } + + for k, v := range tags { + if k == key { + if v.ValueString() == value { + return nil + } else { + return fmt.Errorf("expected tag %q value to be %s, got %s", key, value, v.ValueString()) + } + } + } + + return fmt.Errorf("expected tag %q not found", key) + } +} diff --git a/internal/service/s3/exports.go b/internal/service/s3/exports.go index 170ee69e94e6..2f8e998064a6 100644 --- a/internal/service/s3/exports.go +++ b/internal/service/s3/exports.go @@ -7,4 +7,6 @@ package s3 var ( ResourceBucket = resourceBucket ResourceObject = resourceObject + + BucketListTags = bucketListTags ) diff --git a/internal/service/s3/exports_test.go b/internal/service/s3/exports_test.go index 7debae1d1fd7..7b62aa5ef346 100644 --- a/internal/service/s3/exports_test.go +++ b/internal/service/s3/exports_test.go @@ -28,7 +28,6 @@ var ( ResourceDirectoryBucket = newDirectoryBucketResource ResourceObjectCopy = resourceObjectCopy - BucketListTags = bucketListTags BucketUpdateTags = bucketUpdateTags BucketRegionalDomainName = bucketRegionalDomainName BucketWebsiteEndpointAndDomain = bucketWebsiteEndpointAndDomain diff --git a/internal/service/servicecatalog/provisioned_product.go b/internal/service/servicecatalog/provisioned_product.go index daaf6c9b42d8..6a558d99cf1d 100644 --- a/internal/service/servicecatalog/provisioned_product.go +++ b/internal/service/servicecatalog/provisioned_product.go @@ -30,6 +30,7 @@ import ( // @SDKResource("aws_servicecatalog_provisioned_product", name="Provisioned Product") // @Tags +// @Testing(tagsTest=false, existsType="github.com/aws/aws-sdk-go/service/servicecatalog.ProvisionedProductDetail",importIgnore="accept_language;ignore_errors;provisioning_artifact_name;provisioning_parameters;retain_physical_resources", skipEmptyTags=true) func ResourceProvisionedProduct() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceProvisionedProductCreate, @@ -528,9 +529,9 @@ func resourceProvisionedProductUpdate(ctx context.Context, d *schema.ResourceDat input.ProvisioningPreferences = expandUpdateProvisioningPreferences(v.([]interface{})[0].(map[string]interface{})) } - if d.HasChanges("tags", "tags_all") { - input.Tags = getTagsIn(ctx) - } + // Send tags each time the resource is updated. This is necessary to automatically apply tags + // to provisioned AWS objects during update if the tags don't change. + input.Tags = getTagsIn(ctx) err := retry.RetryContext(ctx, d.Timeout(schema.TimeoutUpdate), func() *retry.RetryError { _, err := conn.UpdateProvisionedProductWithContext(ctx, input) diff --git a/internal/service/servicecatalog/provisioned_product_tags_test.go b/internal/service/servicecatalog/provisioned_product_tags_test.go new file mode 100644 index 000000000000..46f525aff34c --- /dev/null +++ b/internal/service/servicecatalog/provisioned_product_tags_test.go @@ -0,0 +1,780 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package servicecatalog_test + +import ( + "testing" + + "github.com/aws/aws-sdk-go/service/servicecatalog" + sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/names" +) + +func TestAccServiceCatalogProvisionedProduct_tags(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: testAccProvisionedProductConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + // { + // Config: testAccProvisionedProductConfig_tags1(rName, "key2", "value2"), + // Check: resource.ComposeAggregateTestCheckFunc( + // testAccCheckProvisionedProductExists(ctx, resourceName, &v), + // resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + // resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + // ), + // }, + // { + // ResourceName: resourceName, + // ImportState: true, + // ImportStateVerify: true, + // ImportStateVerifyIgnore: []string{ + // "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + // }, + // }, + // { + // Config: testAccProvisionedProductConfig_tags0(rName), + // Check: resource.ComposeAggregateTestCheckFunc( + // testAccCheckProvisionedProductExists(ctx, resourceName, &v), + // resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + // ), + // }, + // { + // ResourceName: resourceName, + // ImportState: true, + // ImportStateVerify: true, + // ImportStateVerifyIgnore: []string{ + // "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + // }, + // }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_null(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tagsNull(rName, "key1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: testAccProvisionedProductConfig_tags0(rName), + PlanOnly: true, + ExpectNonEmptyPlan: false, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_AddOnUpdate(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_EmptyTag_OnCreate(t *testing.T) { + t.Skip("Resource ProvisionedProduct does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: testAccProvisionedProductConfig_tags0(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_EmptyTag_OnUpdate_Add(t *testing.T) { + t.Skip("Resource ProvisionedProduct does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccProvisionedProductConfig_tags2(rName, "key1", "value1", "key2", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { + t.Skip("Resource ProvisionedProduct does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", ""), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_providerOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProvisionedProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("key1", "value1updated", "key2", "value2"), + testAccProvisionedProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + // { + // Config: acctest.ConfigCompose( + // acctest.ConfigDefaultTags_Tags1("key2", "value2"), + // testAccProvisionedProductConfig_tags0(rName), + // ), + // Check: resource.ComposeAggregateTestCheckFunc( + // testAccCheckProvisionedProductExists(ctx, resourceName, &v), + // resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + // resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + // resource.TestCheckResourceAttr(resourceName, "tags_all.key2", "value2"), + // ), + // }, + // { + // ResourceName: resourceName, + // ImportState: true, + // ImportStateVerify: true, + // ImportStateVerifyIgnore: []string{ + // "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + // }, + // }, + // { + // Config: acctest.ConfigCompose( + // acctest.ConfigDefaultTags_Tags0(), + // testAccProvisionedProductConfig_tags0(rName), + // ), + // Check: resource.ComposeAggregateTestCheckFunc( + // testAccCheckProvisionedProductExists(ctx, resourceName, &v), + // resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + // resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + // ), + // }, + // { + // ResourceName: resourceName, + // ImportState: true, + // ImportStateVerify: true, + // ImportStateVerifyIgnore: []string{ + // "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + // }, + // }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_nonOverlapping(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccProvisionedProductConfig_tags1(rName, "resourcekey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1updated"), + testAccProvisionedProductConfig_tags2(rName, "resourcekey1", "resourcevalue1updated", "resourcekey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1updated"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + // { + // Config: acctest.ConfigCompose( + // acctest.ConfigDefaultTags_Tags0(), + // testAccProvisionedProductConfig_tags0(rName), + // ), + // Check: resource.ComposeAggregateTestCheckFunc( + // testAccCheckProvisionedProductExists(ctx, resourceName, &v), + // resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + // resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), + // ), + // }, + // { + // ResourceName: resourceName, + // ImportState: true, + // ImportStateVerify: true, + // ImportStateVerifyIgnore: []string{ + // "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + // }, + // }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_overlapping(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccProvisionedProductConfig_tags1(rName, "overlapkey1", "resourcevalue1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags2("overlapkey1", "providervalue1", "overlapkey2", "providervalue2"), + testAccProvisionedProductConfig_tags2(rName, "overlapkey1", "resourcevalue1", "overlapkey2", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey2", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccProvisionedProductConfig_tags1(rName, "overlapkey1", "resourcevalue2"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue2"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_updateToProviderOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProvisionedProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_updateToResourceOnly(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProvisionedProductConfig_tags0(rName), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: testAccProvisionedProductConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_emptyResourceTag(t *testing.T) { + t.Skip("Resource ProvisionedProduct does not support empty tags") + + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "value1"), + testAccProvisionedProductConfig_tags1(rName, "key1", ""), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", ""), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("key1", "providervalue1"), + testAccProvisionedProductConfig_tagsNull(rName, "key1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: acctest.ConfigCompose( + acctest.ConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccProvisionedProductConfig_tagsNull(rName, "resourcekey1"), + ), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/provisioned_product_test.go b/internal/service/servicecatalog/provisioned_product_test.go index 49ee97ffeffc..69def78ecb0a 100644 --- a/internal/service/servicecatalog/provisioned_product_test.go +++ b/internal/service/servicecatalog/provisioned_product_test.go @@ -373,13 +373,11 @@ func TestAccServiceCatalogProvisionedProduct_disappears(t *testing.T) { }) } -func TestAccServiceCatalogProvisionedProduct_tags(t *testing.T) { +func TestAccServiceCatalogProvisionedProduct_errorOnCreate(t *testing.T) { ctx := acctest.Context(t) - resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) - var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -388,30 +386,19 @@ func TestAccServiceCatalogProvisionedProduct_tags(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_tags(rName, "Name", rName, domain, acctest.DefaultEmailAddress), - Check: resource.ComposeTestCheckFunc( - testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), - resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - ), - }, - { - Config: testAccProvisionedProductConfig_tags(rName, "NotName", rName, domain, acctest.DefaultEmailAddress), - Check: resource.ComposeTestCheckFunc( - testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), - resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttr(resourceName, "tags.NotName", rName), - ), + Config: testAccProvisionedProductConfig_error(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + ExpectError: regexache.MustCompile(`AmazonCloudFormationException Unresolved resource dependencies \[MyVPC\] in the Outputs block of the template`), }, }, }) } -func TestAccServiceCatalogProvisionedProduct_errorOnCreate(t *testing.T) { +func TestAccServiceCatalogProvisionedProduct_errorOnUpdate(t *testing.T) { ctx := acctest.Context(t) - + resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) + var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -419,19 +406,32 @@ func TestAccServiceCatalogProvisionedProduct_errorOnCreate(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ + { + Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Check: resource.ComposeTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), + ), + }, { Config: testAccProvisionedProductConfig_error(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), ExpectError: regexache.MustCompile(`AmazonCloudFormationException Unresolved resource dependencies \[MyVPC\] in the Outputs block of the template`), }, + { + // Check we can still run a complete apply after the previous update error + Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Check: resource.ComposeTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), + ), + }, }, }) } -func TestAccServiceCatalogProvisionedProduct_errorOnUpdate(t *testing.T) { +func TestAccServiceCatalogProvisionedProduct_productTagUpdateAfterError(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) + bucketName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -441,20 +441,25 @@ func TestAccServiceCatalogProvisionedProduct_errorOnUpdate(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_productTagUpdateAfterError_valid(rName, bucketName, "1.0"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.version", "1.0"), + acctest.S3BucketHasTag(ctx, bucketName, "version", "1.0"), ), }, { - Config: testAccProvisionedProductConfig_error(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), - ExpectError: regexache.MustCompile(`AmazonCloudFormationException Unresolved resource dependencies \[MyVPC\] in the Outputs block of the template`), + Config: testAccProvisionedProductConfig_productTagUpdateAfterError_confict(rName, bucketName, "1.5"), + ExpectError: regexache.MustCompile(`BucketAlreadyOwnedByYou`), }, { - // Check we can still run a complete apply after the previous update error - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_productTagUpdateAfterError_valid(rName, bucketName, "1.5"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.version", "1.5"), + acctest.S3BucketHasTag(ctx, bucketName, "version", "1.5"), ), }, }, @@ -649,12 +654,59 @@ resource "aws_servicecatalog_product" "test" { template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" type = "CLOUD_FORMATION_TEMPLATE" } +} +`, rName, domain, email)) +} - tags = { - Name = %[1]q +func testAccProvisionedProductTemplateURLSimpleBaseConfig(rName string) string { + return acctest.ConfigCompose( + testAccProvisionedProductPortfolioBaseConfig(rName), + fmt.Sprintf(` +resource "aws_s3_bucket" "test" { + bucket = %[1]q + force_destroy = true +} + +resource "aws_s3_object" "test" { + bucket = aws_s3_bucket.test.id + key = "%[1]s.json" + + content = jsonencode({ + AWSTemplateFormatVersion = "2010-09-09" + + Parameters = { + BucketName = { + Type = "String" + } + } + + Resources = { + MyS3Bucket = { + Type = "AWS::S3::Bucket" + Properties = { + BucketName = { Ref = "BucketName" } + } + } + } + }) +} + +resource "aws_servicecatalog_product" "test" { + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = %[1]q + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" } } -`, rName, domain, email)) +`, rName)) } func testAccProvisionedProductPhysicalTemplateIDBaseConfig(rName, domain, email string) string { @@ -761,6 +813,11 @@ resource "aws_servicecatalog_provisioned_product" "test" { key = "LeaveMeEmpty" value = "" } + + # Leave this here to test tag behavior on Update + tags = { + Name = %[1]q + } } `, rName, vpcCidr)) } @@ -865,6 +922,11 @@ resource "aws_servicecatalog_provisioned_product" "test" { key = "LeaveMeEmpty" value = "" } + + # Leave this here to test tag behavior on Update + tags = { + Name = %[1]q + } } `, rName, vpcCidr, artifactName)) } @@ -894,8 +956,54 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr)) } -func testAccProvisionedProductConfig_tags(rName, tagKey, tagValue, domain, email string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_productTagUpdateAfterError_valid(rName, bucketName, tagValue string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), + fmt.Sprintf(` +resource "aws_servicecatalog_provisioned_product" "test" { + name = %[1]q + product_id = aws_servicecatalog_product.test.id + provisioning_artifact_name = %[1]q + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = %[2]q + } + + tags = { + version = %[3]q + } +} +`, rName, bucketName, tagValue)) +} + +func testAccProvisionedProductConfig_productTagUpdateAfterError_confict(rName, conflictingBucketName, tagValue string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), + fmt.Sprintf(` +resource "aws_servicecatalog_provisioned_product" "test" { + name = %[1]q + product_id = aws_servicecatalog_product.test.id + provisioning_artifact_name = %[1]q + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = aws_s3_bucket.conflict.bucket + } + + tags = { + version = %[3]q + } +} + +resource "aws_s3_bucket" "conflict" { + bucket = %[2]q +} +`, rName, conflictingBucketName, tagValue)) +} + +func testAccProvisionedProductConfig_tags0(rName string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), fmt.Sprintf(` resource "aws_servicecatalog_provisioned_product" "test" { name = %[1]q @@ -904,18 +1012,73 @@ resource "aws_servicecatalog_provisioned_product" "test" { path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id provisioning_parameters { - key = "VPCPrimaryCIDR" - value = "10.2.0.0/16" + key = "BucketName" + value = "%[1]s-dest" } +} +`, rName)) +} + +func testAccProvisionedProductConfig_tags1(rName, tagKey1, tagValue1 string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), + fmt.Sprintf(` +resource "aws_servicecatalog_provisioned_product" "test" { + name = %[1]q + product_id = aws_servicecatalog_constraint.test.product_id + provisioning_artifact_name = %[1]q + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id provisioning_parameters { - key = "LeaveMeEmpty" - value = "" + key = "BucketName" + value = "%[1]s-dest" } tags = { %[2]q = %[3]q } } -`, rName, tagKey, tagValue)) +`, rName, tagKey1, tagValue1)) +} + +func testAccProvisionedProductConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), + fmt.Sprintf(` +resource "aws_servicecatalog_provisioned_product" "test" { + name = %[1]q + product_id = aws_servicecatalog_constraint.test.product_id + provisioning_artifact_name = %[1]q + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = "%[1]s-dest" + } + + tags = { + %[2]q = %[3]q + %[4]q = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2)) +} + +func testAccProvisionedProductConfig_tagsNull(rName, tagKey1 string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLSimpleBaseConfig(rName), + fmt.Sprintf(` +resource "aws_servicecatalog_provisioned_product" "test" { + name = %[1]q + product_id = aws_servicecatalog_constraint.test.product_id + provisioning_artifact_name = %[1]q + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = "%[1]s-dest" + } + + tags = { + %[2]q = null + } +} +`, rName, tagKey1)) } From 5dd2f3b8a1966ce922ea063713f30cf54613d686 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 22 Apr 2024 18:20:36 -0700 Subject: [PATCH 073/137] `terrafmt` --- .../service/servicecatalog/product_test.go | 40 +++++++++---------- .../provisioned_product_test.go | 22 +++++----- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/internal/service/servicecatalog/product_test.go b/internal/service/servicecatalog/product_test.go index 91e9ed1f0cc9..ce8bc393b307 100644 --- a/internal/service/servicecatalog/product_test.go +++ b/internal/service/servicecatalog/product_test.go @@ -308,11 +308,11 @@ func testAccProductConfig_tags0(rName string) string { data "aws_partition" "current" {} resource "aws_servicecatalog_product" "test" { - description = %[1]q - distributor = "distributör" - name = %[1]q - owner = "ägare" - type = "CLOUD_FORMATION_TEMPLATE" + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -330,11 +330,11 @@ func testAccProductConfig_tags1(rName, tagKey1, tagValue1 string) string { data "aws_partition" "current" {} resource "aws_servicecatalog_product" "test" { - description = %[1]q - distributor = "distributör" - name = %[1]q - owner = "ägare" - type = "CLOUD_FORMATION_TEMPLATE" + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -356,11 +356,11 @@ func testAccProductConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 st data "aws_partition" "current" {} resource "aws_servicecatalog_product" "test" { - description = %[1]q - distributor = "distributör" - name = %[1]q - owner = "ägare" - type = "CLOUD_FORMATION_TEMPLATE" + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -383,11 +383,11 @@ func testAccProductConfig_tagsNull(rName, tagKey1 string) string { data "aws_partition" "current" {} resource "aws_servicecatalog_product" "test" { - description = %[1]q - distributor = "distributör" - name = %[1]q - owner = "ägare" - type = "CLOUD_FORMATION_TEMPLATE" + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" provisioning_artifact_parameters { description = "artefaktbeskrivning" diff --git a/internal/service/servicecatalog/provisioned_product_test.go b/internal/service/servicecatalog/provisioned_product_test.go index 69def78ecb0a..b26bd2364c6a 100644 --- a/internal/service/servicecatalog/provisioned_product_test.go +++ b/internal/service/servicecatalog/provisioned_product_test.go @@ -682,7 +682,7 @@ resource "aws_s3_object" "test" { Resources = { MyS3Bucket = { - Type = "AWS::S3::Bucket" + Type = "AWS::S3::Bucket" Properties = { BucketName = { Ref = "BucketName" } } @@ -692,11 +692,11 @@ resource "aws_s3_object" "test" { } resource "aws_servicecatalog_product" "test" { - description = %[1]q - distributor = "distributör" - name = %[1]q - owner = "ägare" - type = "CLOUD_FORMATION_TEMPLATE" + description = %[1]q + distributor = "distributör" + name = %[1]q + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -816,7 +816,7 @@ resource "aws_servicecatalog_provisioned_product" "test" { # Leave this here to test tag behavior on Update tags = { - Name = %[1]q + Name = %[1]q } } `, rName, vpcCidr)) @@ -925,7 +925,7 @@ resource "aws_servicecatalog_provisioned_product" "test" { # Leave this here to test tag behavior on Update tags = { - Name = %[1]q + Name = %[1]q } } `, rName, vpcCidr, artifactName)) @@ -971,7 +971,7 @@ resource "aws_servicecatalog_provisioned_product" "test" { } tags = { - version = %[3]q + version = %[3]q } } `, rName, bucketName, tagValue)) @@ -992,12 +992,12 @@ resource "aws_servicecatalog_provisioned_product" "test" { } tags = { - version = %[3]q + version = %[3]q } } resource "aws_s3_bucket" "conflict" { - bucket = %[2]q + bucket = %[2]q } `, rName, conflictingBucketName, tagValue)) } From cb6dc7436f8a32f343eca759dc4dfab398096ef2 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 22 Apr 2024 19:26:28 -0700 Subject: [PATCH 074/137] Removes unneeded Product parameters from Provisioned Product tests --- .../provisioned_product_test.go | 79 ++++++++----------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/internal/service/servicecatalog/provisioned_product_test.go b/internal/service/servicecatalog/provisioned_product_test.go index b26bd2364c6a..a13f095008e9 100644 --- a/internal/service/servicecatalog/provisioned_product_test.go +++ b/internal/service/servicecatalog/provisioned_product_test.go @@ -26,7 +26,6 @@ func TestAccServiceCatalogProvisionedProduct_basic(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -36,7 +35,7 @@ func TestAccServiceCatalogProvisionedProduct_basic(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "accept_language", tfservicecatalog.AcceptLanguageEnglish), @@ -87,7 +86,6 @@ func TestAccServiceCatalogProvisionedProduct_update(t *testing.T) { resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -97,13 +95,13 @@ func TestAccServiceCatalogProvisionedProduct_update(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), ), }, { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.10.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.10.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "accept_language", tfservicecatalog.AcceptLanguageEnglish), @@ -151,7 +149,6 @@ func TestAccServiceCatalogProvisionedProduct_stackSetProvisioningPreferences(t * ctx := acctest.Context(t) resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -161,7 +158,7 @@ func TestAccServiceCatalogProvisionedProduct_stackSetProvisioningPreferences(t * CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", 1, 2), + Config: testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, "10.1.0.0/16", 1, 2), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "name", rName), @@ -186,7 +183,7 @@ func TestAccServiceCatalogProvisionedProduct_stackSetProvisioningPreferences(t * }, }, { - Config: testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", 3, 4), + Config: testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, "10.1.0.0/16", 3, 4), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "name", rName), @@ -198,7 +195,7 @@ func TestAccServiceCatalogProvisionedProduct_stackSetProvisioningPreferences(t * ), }, { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "name", rName), @@ -216,7 +213,6 @@ func TestAccServiceCatalogProvisionedProduct_ProductName_update(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) productName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) productNameUpdated := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -226,7 +222,7 @@ func TestAccServiceCatalogProvisionedProduct_ProductName_update(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productName), + Config: testAccProvisionedProductConfig_productName(rName, "10.1.0.0/16", productName), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), @@ -235,7 +231,7 @@ func TestAccServiceCatalogProvisionedProduct_ProductName_update(t *testing.T) { }, { // update the product name, but keep provisioned product name as-is to trigger an in-place update - Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productNameUpdated), + Config: testAccProvisionedProductConfig_productName(rName, "10.1.0.0/16", productNameUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), @@ -268,7 +264,6 @@ func TestAccServiceCatalogProvisionedProduct_ProvisioningArtifactName_update(t * rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) artifactName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod1, pprod2 servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -279,14 +274,14 @@ func TestAccServiceCatalogProvisionedProduct_ProvisioningArtifactName_update(t * Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod1), resource.TestCheckResourceAttrPair(resourceName, "provisioning_artifact_name", productResourceName, "provisioning_artifact_parameters.0.name"), ), }, { - Config: testAccProvisionedProductConfig_ProvisionedArtifactName_update(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", artifactName), + Config: testAccProvisionedProductConfig_ProvisionedArtifactName_update(rName, "10.1.0.0/16", artifactName), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod2), resource.TestCheckResourceAttrPair(resourceName, "provisioning_artifact_name", artifactResourceName, "name"), @@ -302,7 +297,6 @@ func TestAccServiceCatalogProvisionedProduct_computedOutputs(t *testing.T) { resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -312,7 +306,7 @@ func TestAccServiceCatalogProvisionedProduct_computedOutputs(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_computedOutputs(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_computedOutputs(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "outputs.#", "3"), @@ -328,7 +322,7 @@ func TestAccServiceCatalogProvisionedProduct_computedOutputs(t *testing.T) { ), }, { - Config: testAccProvisionedProductConfig_computedOutputs(rName, domain, acctest.DefaultEmailAddress, "10.1.0.1/16"), + Config: testAccProvisionedProductConfig_computedOutputs(rName, "10.1.0.1/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), resource.TestCheckResourceAttr(resourceName, "outputs.#", "3"), @@ -352,7 +346,6 @@ func TestAccServiceCatalogProvisionedProduct_disappears(t *testing.T) { resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -362,7 +355,7 @@ func TestAccServiceCatalogProvisionedProduct_disappears(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), acctest.CheckResourceDisappears(ctx, acctest.Provider, tfservicecatalog.ResourceProvisionedProduct(), resourceName), @@ -377,7 +370,6 @@ func TestAccServiceCatalogProvisionedProduct_errorOnCreate(t *testing.T) { ctx := acctest.Context(t) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -386,7 +378,7 @@ func TestAccServiceCatalogProvisionedProduct_errorOnCreate(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_error(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_error(rName, "10.1.0.0/16"), ExpectError: regexache.MustCompile(`AmazonCloudFormationException Unresolved resource dependencies \[MyVPC\] in the Outputs block of the template`), }, }, @@ -397,7 +389,6 @@ func TestAccServiceCatalogProvisionedProduct_errorOnUpdate(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_servicecatalog_provisioned_product.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) var pprod servicecatalog.ProvisionedProductDetail resource.ParallelTest(t, resource.TestCase{ @@ -407,18 +398,18 @@ func TestAccServiceCatalogProvisionedProduct_errorOnUpdate(t *testing.T) { CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), ), }, { - Config: testAccProvisionedProductConfig_error(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_error(rName, "10.1.0.0/16"), ExpectError: regexache.MustCompile(`AmazonCloudFormationException Unresolved resource dependencies \[MyVPC\] in the Outputs block of the template`), }, { // Check we can still run a complete apply after the previous update error - Config: testAccProvisionedProductConfig_basic(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16"), + Config: testAccProvisionedProductConfig_basic(rName, "10.1.0.0/16"), Check: resource.ComposeTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), ), @@ -579,7 +570,7 @@ data "aws_servicecatalog_launch_paths" "test" { `, rName) } -func testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email string) string { +func testAccProvisionedProductTemplateURLBaseConfig(rName string) string { return acctest.ConfigCompose( testAccProvisionedProductPortfolioBaseConfig(rName), fmt.Sprintf(` @@ -644,8 +635,6 @@ resource "aws_servicecatalog_product" "test" { owner = "ägare" type = "CLOUD_FORMATION_TEMPLATE" support_description = %[1]q - support_email = %[3]q - support_url = %[2]q provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -655,7 +644,7 @@ resource "aws_servicecatalog_product" "test" { type = "CLOUD_FORMATION_TEMPLATE" } } -`, rName, domain, email)) +`, rName)) } func testAccProvisionedProductTemplateURLSimpleBaseConfig(rName string) string { @@ -709,7 +698,7 @@ resource "aws_servicecatalog_product" "test" { `, rName)) } -func testAccProvisionedProductPhysicalTemplateIDBaseConfig(rName, domain, email string) string { +func testAccProvisionedProductPhysicalTemplateIDBaseConfig(rName string) string { return acctest.ConfigCompose( testAccProvisionedProductPortfolioBaseConfig(rName), fmt.Sprintf(` @@ -777,8 +766,6 @@ resource "aws_servicecatalog_product" "test" { owner = "ägare" type = "CLOUD_FORMATION_TEMPLATE" support_description = %[1]q - support_email = %[3]q - support_url = %[2]q provisioning_artifact_parameters { description = "artefaktbeskrivning" @@ -792,11 +779,11 @@ resource "aws_servicecatalog_product" "test" { Name = %[1]q } } -`, rName, domain, email)) +`, rName)) } -func testAccProvisionedProductConfig_basic(rName, domain, email, vpcCidr string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_basic(rName, vpcCidr string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName), fmt.Sprintf(` resource "aws_servicecatalog_provisioned_product" "test" { name = %[1]q @@ -822,8 +809,8 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr)) } -func testAccProvisionedProductConfig_computedOutputs(rName, domain, email, vpcCidr string) string { - return acctest.ConfigCompose(testAccProvisionedProductPhysicalTemplateIDBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_computedOutputs(rName, vpcCidr string) string { + return acctest.ConfigCompose(testAccProvisionedProductPhysicalTemplateIDBaseConfig(rName), fmt.Sprintf(` resource "aws_servicecatalog_provisioned_product" "test" { name = %[1]q @@ -844,8 +831,8 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr)) } -func testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, domain, email, vpcCidr string, failureToleranceCount, maxConcurrencyCount int) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_stackSetprovisioningPreferences(rName, vpcCidr string, failureToleranceCount, maxConcurrencyCount int) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName), fmt.Sprintf(` data "aws_region" "current" {} @@ -875,8 +862,8 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr, failureToleranceCount, maxConcurrencyCount)) } -func testAccProvisionedProductConfig_productName(rName, domain, email, vpcCidr, productName string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(productName, domain, email), +func testAccProvisionedProductConfig_productName(rName, vpcCidr, productName string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(productName), fmt.Sprintf(` resource "aws_servicecatalog_provisioned_product" "test" { name = %[1]q @@ -897,8 +884,8 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr)) } -func testAccProvisionedProductConfig_ProvisionedArtifactName_update(rName, domain, email, vpcCidr, artifactName string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_ProvisionedArtifactName_update(rName, vpcCidr, artifactName string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName), fmt.Sprintf(` resource "aws_servicecatalog_provisioning_artifact" "test" { product_id = aws_servicecatalog_product.test.id @@ -934,8 +921,8 @@ resource "aws_servicecatalog_provisioned_product" "test" { // Because the `provisioning_parameter` "LeaveMeEmpty" is not empty, this configuration results in an error. // The `status_message` will be: // AmazonCloudFormationException Unresolved resource dependencies [MyVPC] in the Outputs block of the template -func testAccProvisionedProductConfig_error(rName, domain, email, vpcCidr string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email), +func testAccProvisionedProductConfig_error(rName, vpcCidr string) string { + return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName), fmt.Sprintf(` resource "aws_servicecatalog_provisioned_product" "test" { name = %[1]q From 56588e4030f9ac9407d84b1c320e2c11f5684eba Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 22 Apr 2024 19:27:00 -0700 Subject: [PATCH 075/137] Fixes error on Delete when Portfolio already deleted --- internal/service/servicecatalog/portfolio.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/service/servicecatalog/portfolio.go b/internal/service/servicecatalog/portfolio.go index b42e2dae3883..204864d224f5 100644 --- a/internal/service/servicecatalog/portfolio.go +++ b/internal/service/servicecatalog/portfolio.go @@ -186,6 +186,10 @@ func resourcePortfolioDelete(ctx context.Context, d *schema.ResourceData, meta i Id: aws.String(d.Id()), }) + if tfawserr.ErrCodeEquals(err, servicecatalog.ErrCodeResourceNotFoundException) { + return diags + } + if err != nil { return sdkdiag.AppendErrorf(diags, "deleting Service Catalog Portfolio (%s): %s", d.Id(), err) } From 48b05c025c3d04be1b1b6c3b41de8b160a8ce941 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 23 Apr 2024 13:08:32 +0300 Subject: [PATCH 076/137] add `code_editor_app_image_config` --- .../service/sagemaker/app_image_config.go | 161 +++++++++++++++++- .../sagemaker/app_image_config_test.go | 68 ++++++++ .../sagemaker_app_image_config.html.markdown | 9 +- 3 files changed, 233 insertions(+), 5 deletions(-) diff --git a/internal/service/sagemaker/app_image_config.go b/internal/service/sagemaker/app_image_config.go index e512f772999a..fbc35ea671d9 100644 --- a/internal/service/sagemaker/app_image_config.go +++ b/internal/service/sagemaker/app_image_config.go @@ -48,6 +48,69 @@ func ResourceAppImageConfig() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z](-*[0-9A-Za-z])*$`), "Valid characters are a-z, A-Z, 0-9, and - (hyphen)."), ), }, + "code_editor_app_image_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "container_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "container_arguments": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "container_entrypoint": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "container_environment_variables": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "file_system_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default_gid": { + Type: schema.TypeInt, + Optional: true, + Default: 100, + ValidateFunc: validation.IntInSlice([]int{0, 100}), + }, + "default_uid": { + Type: schema.TypeInt, + Optional: true, + Default: 1000, + ValidateFunc: validation.IntInSlice([]int{0, 1000}), + }, + "mount_path": { + Type: schema.TypeString, + Optional: true, + Default: "/home/sagemaker-user", + ValidateFunc: validation.All( + validation.StringLenBetween(1, 1024), + validation.StringMatch(regexache.MustCompile(`^\/.*`), "Must start with `/`."), + ), + }, + }, + }, + }, + }, + }, + }, "jupyter_lab_image_config": { Type: schema.TypeList, Optional: true, @@ -78,6 +141,36 @@ func ResourceAppImageConfig() *schema.Resource { }, }, }, + "file_system_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default_gid": { + Type: schema.TypeInt, + Optional: true, + Default: 100, + ValidateFunc: validation.IntInSlice([]int{0, 100}), + }, + "default_uid": { + Type: schema.TypeInt, + Optional: true, + Default: 1000, + ValidateFunc: validation.IntInSlice([]int{0, 1000}), + }, + "mount_path": { + Type: schema.TypeString, + Optional: true, + Default: "/home/sagemaker-user", + ValidateFunc: validation.All( + validation.StringLenBetween(1, 1024), + validation.StringMatch(regexache.MustCompile(`^\/.*`), "Must start with `/`."), + ), + }, + }, + }, + }, }, }, }, @@ -156,6 +249,10 @@ func resourceAppImageConfigCreate(ctx context.Context, d *schema.ResourceData, m Tags: getTagsIn(ctx), } + if v, ok := d.GetOk("code_editor_app_image_config"); ok && len(v.([]interface{})) > 0 { + input.CodeEditorAppImageConfig = expandCodeEditorAppImageConfig(v.([]interface{})) + } + if v, ok := d.GetOk("jupyter_lab_image_config"); ok && len(v.([]interface{})) > 0 { input.JupyterLabAppImageConfig = expandJupyterLabAppImageConfig(v.([]interface{})) } @@ -192,6 +289,10 @@ func resourceAppImageConfigRead(ctx context.Context, d *schema.ResourceData, met d.Set("app_image_config_name", image.AppImageConfigName) d.Set("arn", arn) + if err := d.Set("code_editor_app_image_config", flattenCodeEditorAppImageConfig(image.CodeEditorAppImageConfig)); err != nil { + return sdkdiag.AppendErrorf(diags, "setting code_editor_app_image_config: %s", err) + } + if err := d.Set("kernel_gateway_image_config", flattenKernelGatewayImageConfig(image.KernelGatewayImageConfig)); err != nil { return sdkdiag.AppendErrorf(diags, "setting kernel_gateway_image_config: %s", err) } @@ -212,6 +313,12 @@ func resourceAppImageConfigUpdate(ctx context.Context, d *schema.ResourceData, m AppImageConfigName: aws.String(d.Id()), } + if d.HasChange("code_editor_app_image_config") { + if v, ok := d.GetOk("code_editor_app_image_config"); ok && len(v.([]interface{})) > 0 { + input.CodeEditorAppImageConfig = expandCodeEditorAppImageConfig(v.([]interface{})) + } + } + if d.HasChange("kernel_gateway_image_config") { if v, ok := d.GetOk("kernel_gateway_image_config"); ok && len(v.([]interface{})) > 0 { input.KernelGatewayImageConfig = expandKernelGatewayImageConfig(v.([]interface{})) @@ -266,13 +373,13 @@ func expandKernelGatewayImageConfig(l []interface{}) *sagemaker.KernelGatewayIma } if v, ok := m["file_system_config"].([]interface{}); ok && len(v) > 0 { - config.FileSystemConfig = expandKernelGatewayImageConfigFileSystemConfig(v) + config.FileSystemConfig = expandFileSystemConfig(v) } return config } -func expandKernelGatewayImageConfigFileSystemConfig(l []interface{}) *sagemaker.FileSystemConfig { +func expandFileSystemConfig(l []interface{}) *sagemaker.FileSystemConfig { if len(l) == 0 || l[0] == nil { return nil } @@ -328,13 +435,13 @@ func flattenKernelGatewayImageConfig(config *sagemaker.KernelGatewayImageConfig) } if config.FileSystemConfig != nil { - m["file_system_config"] = flattenKernelGatewayImageConfigFileSystemConfig(config.FileSystemConfig) + m["file_system_config"] = flattenFileSystemConfig(config.FileSystemConfig) } return []map[string]interface{}{m} } -func flattenKernelGatewayImageConfigFileSystemConfig(config *sagemaker.FileSystemConfig) []map[string]interface{} { +func flattenFileSystemConfig(config *sagemaker.FileSystemConfig) []map[string]interface{} { if config == nil { return []map[string]interface{}{} } @@ -366,6 +473,44 @@ func flattenKernelGatewayImageConfigKernelSpecs(kernelSpecs []*sagemaker.KernelS return res } +func expandCodeEditorAppImageConfig(l []interface{}) *sagemaker.CodeEditorAppImageConfig { + if len(l) == 0 || l[0] == nil { + return nil + } + + m := l[0].(map[string]interface{}) + + config := &sagemaker.CodeEditorAppImageConfig{} + + if v, ok := m["container_config"].([]interface{}); ok && len(v) > 0 { + config.ContainerConfig = expandContainerConfig(v) + } + + if v, ok := m["file_system_config"].([]interface{}); ok && len(v) > 0 { + config.FileSystemConfig = expandFileSystemConfig(v) + } + + return config +} + +func flattenCodeEditorAppImageConfig(config *sagemaker.CodeEditorAppImageConfig) []map[string]interface{} { + if config == nil { + return []map[string]interface{}{} + } + + m := map[string]interface{}{} + + if config.ContainerConfig != nil { + m["container_config"] = flattenContainerConfig(config.ContainerConfig) + } + + if config.FileSystemConfig != nil { + m["file_system_config"] = flattenFileSystemConfig(config.FileSystemConfig) + } + + return []map[string]interface{}{m} +} + func expandJupyterLabAppImageConfig(l []interface{}) *sagemaker.JupyterLabAppImageConfig { if len(l) == 0 || l[0] == nil { return nil @@ -379,6 +524,10 @@ func expandJupyterLabAppImageConfig(l []interface{}) *sagemaker.JupyterLabAppIma config.ContainerConfig = expandContainerConfig(v) } + if v, ok := m["file_system_config"].([]interface{}); ok && len(v) > 0 { + config.FileSystemConfig = expandFileSystemConfig(v) + } + return config } @@ -393,6 +542,10 @@ func flattenJupyterLabAppImageConfig(config *sagemaker.JupyterLabAppImageConfig) m["container_config"] = flattenContainerConfig(config.ContainerConfig) } + if config.FileSystemConfig != nil { + m["file_system_config"] = flattenFileSystemConfig(config.FileSystemConfig) + } + return []map[string]interface{}{m} } diff --git a/internal/service/sagemaker/app_image_config_test.go b/internal/service/sagemaker/app_image_config_test.go index 582b0c2acd81..d89e6f40b146 100644 --- a/internal/service/sagemaker/app_image_config_test.go +++ b/internal/service/sagemaker/app_image_config_test.go @@ -143,6 +143,56 @@ func TestAccSageMakerAppImageConfig_KernelGatewayImage_fileSystem(t *testing.T) }) } +func TestAccSageMakerAppImageConfig_CodeEditor(t *testing.T) { + ctx := acctest.Context(t) + var config sagemaker.DescribeAppImageConfigOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + rNameUpdated := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_sagemaker_app_image_config.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.SageMakerServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckAppImageDestroyConfig(ctx), + Steps: []resource.TestStep{ + { + Config: testAccAppImageConfigConfig_codeEditor(rName, rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppImageExistsConfig(ctx, resourceName, &config), + resource.TestCheckResourceAttr(resourceName, "app_image_config_name", rName), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_arguments.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_arguments.0", rName), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_entrypoint.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_entrypoint.0", rName), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_environment_variables.%", "1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccAppImageConfigConfig_codeEditor(rName, rNameUpdated), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppImageExistsConfig(ctx, resourceName, &config), + resource.TestCheckResourceAttr(resourceName, "app_image_config_name", rName), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_arguments.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_arguments.0", rNameUpdated), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_entrypoint.#", "1"), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_entrypoint.0", rNameUpdated), + resource.TestCheckResourceAttr(resourceName, "code_editor_app_image_config.0.container_config.0.container_environment_variables.%", "1"), + ), + }, + }, + }) +} + func TestAccSageMakerAppImageConfig_JupyterLab(t *testing.T) { ctx := acctest.Context(t) var config sagemaker.DescribeAppImageConfigOutput @@ -429,3 +479,21 @@ resource "aws_sagemaker_app_image_config" "test" { } `, rName, arg) } + +func testAccAppImageConfigConfig_codeEditor(rName, arg string) string { + return fmt.Sprintf(` +resource "aws_sagemaker_app_image_config" "test" { + app_image_config_name = %[1]q + + code_editor_app_image_config { + container_config { + container_arguments = ["%[2]s"] + container_entrypoint = ["%[2]s"] + container_environment_variables = { + %[2]q = %[2]q + } + } + } +} +`, rName, arg) +} diff --git a/website/docs/r/sagemaker_app_image_config.html.markdown b/website/docs/r/sagemaker_app_image_config.html.markdown index f34a3c95bf2a..dad89e966d68 100644 --- a/website/docs/r/sagemaker_app_image_config.html.markdown +++ b/website/docs/r/sagemaker_app_image_config.html.markdown @@ -47,13 +47,20 @@ resource "aws_sagemaker_app_image_config" "test" { This resource supports the following arguments: * `app_image_config_name` - (Required) The name of the App Image Config. -* `kernel_gateway_image_config` - (Optional) The JupyterLabAppImageConfig. You can only specify one image kernel in the AppImageConfig API. This kernel is shown to users before the image starts. After the image runs, all kernels are visible in JupyterLab. See [Jupyte rLab Image Config](#jupyter-lab-image-config) details below. +* `code_editor_app_image_config` - (Optional) The CodeEditorAppImageConfig. You can only specify one image kernel in the AppImageConfig API. This kernel is shown to users before the image starts. After the image runs, all kernels are visible in Code Editor. See [Code Editor App Image Config](#code-editor-app-image-config) details below. +* `jupyter_lab_image_config` - (Optional) The JupyterLabAppImageConfig. You can only specify one image kernel in the AppImageConfig API. This kernel is shown to users before the image starts. After the image runs, all kernels are visible in JupyterLab. See [Jupyter Lab Image Config](#jupyter-lab-image-config) details below. * `kernel_gateway_image_config` - (Optional) The configuration for the file system and kernels in a SageMaker image running as a KernelGateway app. See [Kernel Gateway Image Config](#kernel-gateway-image-config) details below. * `tags` - (Optional) A map of tags to assign to the resource. 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. +### Code Editor App Image Config + +* `container_config` - (Optional) The configuration used to run the application image container. See [Container Config](#container-config) details below. +* `file_system_config` - (Optional) The URL where the Git repository is located. See [File System Config](#file-system-config) details below. + ### Jupyter Lab Image Config * `container_config` - (Optional) The configuration used to run the application image container. See [Container Config](#container-config) details below. +* `file_system_config` - (Optional) The URL where the Git repository is located. See [File System Config](#file-system-config) details below. #### Container Config From e1d2ab9150c04b3434744f592e9a7fbc8ae27a20 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 23 Apr 2024 13:10:18 +0300 Subject: [PATCH 077/137] add `code_editor_app_image_config` --- .changelog/37059.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37059.txt diff --git a/.changelog/37059.txt b/.changelog/37059.txt new file mode 100644 index 000000000000..be5ae9dfeb2f --- /dev/null +++ b/.changelog/37059.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_sagemaker_app_image_config: Add `code_editor_app_image_config` and `jupyter_lab_image_config.jupyter_lab_image_config` arguments +``` \ No newline at end of file From 4b59f3da86da92ca9ad0830925983144fe6ce86c Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 23 Apr 2024 13:14:30 +0300 Subject: [PATCH 078/137] add `code_editor_app_image_config` --- .changelog/37059.txt | 4 ++++ internal/service/sagemaker/app_image_config.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.changelog/37059.txt b/.changelog/37059.txt index be5ae9dfeb2f..a2e96a5daba0 100644 --- a/.changelog/37059.txt +++ b/.changelog/37059.txt @@ -1,3 +1,7 @@ ```release-note:enhancement resource/aws_sagemaker_app_image_config: Add `code_editor_app_image_config` and `jupyter_lab_image_config.jupyter_lab_image_config` arguments +``` + +```release-note:enhancement +resource/aws_sagemaker_app_image_config: Change `kernel_gateway_image_config.kernel_spec` MaxItems to 5 ``` \ No newline at end of file diff --git a/internal/service/sagemaker/app_image_config.go b/internal/service/sagemaker/app_image_config.go index fbc35ea671d9..18efcccd5549 100644 --- a/internal/service/sagemaker/app_image_config.go +++ b/internal/service/sagemaker/app_image_config.go @@ -213,7 +213,7 @@ func ResourceAppImageConfig() *schema.Resource { "kernel_spec": { Type: schema.TypeList, Required: true, - MaxItems: 1, + MaxItems: 5, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_name": { From 76456c84e19f8c0e8e2925336294b066fab32a16 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 09:08:27 -0400 Subject: [PATCH 079/137] build(deps): bump github.com/aws/aws-sdk-go in /.ci/providerlint (#37054) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.51.25 to 1.51.26. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.25...v1.51.26) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .ci/providerlint/go.mod | 2 +- .ci/providerlint/go.sum | 4 ++-- .ci/providerlint/vendor/modules.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/providerlint/go.mod b/.ci/providerlint/go.mod index cc198a4e4d97..ee941e6e8876 100644 --- a/.ci/providerlint/go.mod +++ b/.ci/providerlint/go.mod @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint go 1.22 require ( - github.com/aws/aws-sdk-go v1.51.25 + github.com/aws/aws-sdk-go v1.51.26 github.com/bflad/tfproviderlint v0.29.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 golang.org/x/tools v0.13.0 diff --git a/.ci/providerlint/go.sum b/.ci/providerlint/go.sum index c548e16a77a9..7da87866d978 100644 --- a/.ci/providerlint/go.sum +++ b/.ci/providerlint/go.sum @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/aws/aws-sdk-go v1.51.25 h1:DjTT8mtmsachhV6yrXR8+yhnG6120dazr720nopRsls= -github.com/aws/aws-sdk-go v1.51.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.26 h1:fYud+95lh9B89fAlRtgYpY8CcJF4T7JrWkLMq4GGCOo= +github.com/aws/aws-sdk-go v1.51.26/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow= diff --git a/.ci/providerlint/vendor/modules.txt b/.ci/providerlint/vendor/modules.txt index d45e3117051d..15b7bfb9f9dd 100644 --- a/.ci/providerlint/vendor/modules.txt +++ b/.ci/providerlint/vendor/modules.txt @@ -28,7 +28,7 @@ github.com/agext/levenshtein # github.com/apparentlymart/go-textseg/v15 v15.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v15/textseg -# github.com/aws/aws-sdk-go v1.51.25 +# github.com/aws/aws-sdk-go v1.51.26 ## explicit; go 1.19 github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/endpoints From abbe440ac4210138bbf7a0f2f3082e29a89e6201 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 09:08:52 -0400 Subject: [PATCH 080/137] build(deps): bump the aws-sdk-go group with 5 updates (#37055) Bumps the aws-sdk-go group with 5 updates: | Package | From | To | | --- | --- | --- | | [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.51.25` | `1.51.26` | | [github.com/aws/aws-sdk-go-v2/service/bedrockagent](https://github.com/aws/aws-sdk-go-v2) | `1.6.0` | `1.7.0` | | [github.com/aws/aws-sdk-go-v2/service/paymentcryptography](https://github.com/aws/aws-sdk-go-v2) | `1.9.4` | `1.10.0` | | [github.com/aws/aws-sdk-go-v2/service/redshiftserverless](https://github.com/aws/aws-sdk-go-v2) | `1.17.4` | `1.17.5` | | [github.com/aws/aws-sdk-go-v2/service/transfer](https://github.com/aws/aws-sdk-go-v2) | `1.46.0` | `1.47.0` | Updates `github.com/aws/aws-sdk-go` from 1.51.25 to 1.51.26 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.25...v1.51.26) Updates `github.com/aws/aws-sdk-go-v2/service/bedrockagent` from 1.6.0 to 1.7.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.7.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.6.0...v1.7.0) Updates `github.com/aws/aws-sdk-go-v2/service/paymentcryptography` from 1.9.4 to 1.10.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.10.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/m2/v1.9.4...v1.10.0) Updates `github.com/aws/aws-sdk-go-v2/service/redshiftserverless` from 1.17.4 to 1.17.5 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.17.5/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.17.4...v1.17.5) Updates `github.com/aws/aws-sdk-go-v2/service/transfer` from 1.46.0 to 1.47.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.46.0...service/s3/v1.47.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/bedrockagent dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/paymentcryptography dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/redshiftserverless dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/transfer dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index c28905da16a7..3dd297e4ec21 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.2 github.com/YakDriver/go-version v0.1.0 github.com/YakDriver/regexache v0.23.0 - github.com/aws/aws-sdk-go v1.51.25 + github.com/aws/aws-sdk-go v1.51.26 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/config v1.27.11 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 @@ -31,7 +31,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/batch v1.37.0 github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 - github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0 + github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 github.com/aws/aws-sdk-go-v2/service/chimesdkvoice v1.14.4 @@ -119,7 +119,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/oam v1.10.1 github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4 github.com/aws/aws-sdk-go-v2/service/osis v1.8.4 - github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4 + github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0 github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4 github.com/aws/aws-sdk-go-v2/service/pipes v1.11.4 github.com/aws/aws-sdk-go-v2/service/polly v1.39.6 @@ -130,7 +130,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/rds v1.77.1 github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 - github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4 + github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5 github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0 github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.5 github.com/aws/aws-sdk-go-v2/service/resourcegroups v1.22.0 @@ -161,7 +161,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/synthetics v1.24.4 github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5 github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4 - github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0 + github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0 github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1 github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.5 github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.30.0 diff --git a/go.sum b/go.sum index 7094bb13a273..69a7d42e9c9d 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.51.25 h1:DjTT8mtmsachhV6yrXR8+yhnG6120dazr720nopRsls= -github.com/aws/aws-sdk-go v1.51.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.26 h1:fYud+95lh9B89fAlRtgYpY8CcJF4T7JrWkLMq4GGCOo= +github.com/aws/aws-sdk-go v1.51.26/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -82,8 +82,8 @@ github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 h1:WJEEIYSDCqNeG/q0OU github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4/go.mod h1:QdNvYtC3DYswfkhnlWXa0Oib+8jugRL/a+5Nbhw4v/g= github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 h1:3omHt2KuI7K58mb2r3BwKPF0ph0MOXZZ48XIthXhHcI= github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7/go.mod h1:/D6V245MG0yEqSULoBf/zLdQk8lmsMZXR3d/vc2mOdo= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0 h1:TUV3Ih0U+1EaNH8I3OjQl15iOSR94QyXBBELZt2izlk= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 h1:f2hDre6hySnv5RTcV9zqHdCUp8EmusEIHB81aPFGaAo= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 h1:sVv+p2Wo+sUXa8dC1pCMJ/+9ncOriq8EiRWvAkOuaLY= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4/go.mod h1:JFS3MaNoisHXHQm5/xRQjj1tICixIgT8Vv32D0lV5NE= github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 h1:FgeK3aPbB/ARkhxUXfSn9d2ibb4Q9kUhHl/dWwqIy8Y= @@ -268,8 +268,8 @@ github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4 h1:XHtavC0Lrm5 github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= github.com/aws/aws-sdk-go-v2/service/osis v1.8.4 h1:ZQyG9HtH9s6+U3rXPHaHq2ICArNtlqEy5HJIiqHChr4= github.com/aws/aws-sdk-go-v2/service/osis v1.8.4/go.mod h1:MHw9zAnU6CaZXqe/J1UNcxcEZLF5oXs21Efdxw0K5tY= -github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4 h1:3Eu2DIvWbjsAUuK47p+5+AZoacf4W5Y3LDawbkI5/es= -github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4/go.mod h1:PCzPetpCllCUXLpDIZ+OKrosD3LGP14/Zr6BLJwc0fo= +github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0 h1:sfVZeQi5tw/2ZZj7n0TyQATIovkxQ/sL2Sow8kBLXYA= +github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0/go.mod h1:PCzPetpCllCUXLpDIZ+OKrosD3LGP14/Zr6BLJwc0fo= github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4 h1:yv+usWRleYprm877J3eOAJZcNgz2n9NbV/qVk65m2oQ= github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4/go.mod h1:2NtRjk9YR/8M08R9A7TSpysazsSeDBWk1uQCe5yO8dc= github.com/aws/aws-sdk-go-v2/service/pipes v1.11.4 h1:xOLwoRZoNFTNeM1W6jafNh9xFmvpi7pK2u8cwgO22D0= @@ -290,8 +290,8 @@ github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 h1:j18lTPPqe+qlapn1R8//+uj github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0/go.mod h1:8ldsMsikORLj0GZUozSvbQdctrumAPYhizmj/3AAATI= github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 h1:Rnz5skILimGue5zJ8txb5Mr9JLjznYJFKgK0r/n3AI0= github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4/go.mod h1:rTgaFmfqdMVM4JpBoYZndATNpUguvyjDgUOT9h4qUUs= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4 h1:aCgDTg7NalOIbcz26fFRsz7JtxDUvBHm5/YBT/5J2S8= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4/go.mod h1:XIPGtb7MKsA/uAfS9pngCspt+NfjDxlIAg1hSwvtQQs= +github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5 h1:QxPQnoPHEQbU44AZCIaQCFQ63xxk2eLLCY5cj+yOJU0= +github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5/go.mod h1:XIPGtb7MKsA/uAfS9pngCspt+NfjDxlIAg1hSwvtQQs= github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0 h1:dQsPc/8oqQGe3tWFbCxkujcDtOqprC2i0ssvJeD6tEg= github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0/go.mod h1:z84+kK5mDuKu7muAIuop201/BOL7XsGwlg+2xtp6XRQ= github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.5 h1:jZRmSjW91mFQ6BNUu9wTZ41ZBtEwWH7HNCGLjus2uos= @@ -354,8 +354,8 @@ github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5 h1:0Ty3j3QkLoqkZ+Va github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5/go.mod h1:9R1IlrgiivwTCZdbKgMPkseFS+moUM+DLh0TEjO6pvE= github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4 h1:5SSnbzdOLeiFe/n38kjIRc5TKglEs7598sZkFYw9X78= github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4/go.mod h1:k8u3Uj5KgSM4eUoGXyvLNNf1Y/mLMM7jJM4o9kIazEc= -github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0 h1:4M9wPu5RLDLqo9fUHYvm0Nq+sbnx7fPW9wM273iqYVI= -github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= +github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0 h1:0u+kisnXkglzOMqYQd9xmBDzXELJZFgxT653oMGE+Pg= +github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1 h1:uEKMCWNCbKIEn+en/BqTxJmO/gdMVqzW5VJwhyaG76A= github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.5 h1:k7JPfsAWnc4vbO/6nksfKdz8lClDacQe5x6fen3vn1A= From 787e6038218fc65927482f01655a507a2eb2198c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 09:09:33 -0400 Subject: [PATCH 081/137] build(deps): bump actions/upload-artifact from 4.3.2 to 4.3.3 (#37053) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.2 to 4.3.3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/1746f4ab65b179e0ea60a494b83293b640dd5bba...65462800fd760344b1a7b4382951275a0abb4808) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/firewatch.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/snapshot.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/firewatch.yml b/.github/workflows/firewatch.yml index 11677072423c..782e16285dac 100644 --- a/.github/workflows/firewatch.yml +++ b/.github/workflows/firewatch.yml @@ -17,7 +17,7 @@ jobs: slack_token: ${{ secrets.SLACK_BOT_TOKEN }} slack_channel: ${{ secrets.SLACK_CHANNEL }} - name: UploadArtifact - uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: firewatch path: firewatch.data diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7a9b977831c..b240ea78fd78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: fetch-depth: 0 - name: Generate Release Notes run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt - - uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: release-notes path: release-notes.txt @@ -103,7 +103,7 @@ jobs: steps: - name: Save Release Tag run: echo ${{ github.ref_name }} > release-tag.data - - uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: release-tag path: release-tag.data diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 88857816cd93..166f25e0b4cd 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -36,7 +36,7 @@ jobs: ARTIFACT="${GITHUB_REF}";; esac echo "artifact=$ARTIFACT-$(date -u +'%Y-%m-%dT%H-%M')" >> "$GITHUB_OUTPUT" - - uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: ${{steps.naming.outputs.artifact}} path: dist/*.zip From 987e1b365abd162ba7e90373ba4eb85ffadd6dd2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 10:23:19 -0400 Subject: [PATCH 082/137] aws_eip: Add 'arn' attribute. --- .changelog/35991.txt | 8 ++++++++ internal/service/ec2/ec2_eip.go | 19 ++++++++++++++++++- internal/service/ec2/ec2_eip_data_source.go | 9 ++++++++- .../service/ec2/ec2_eip_data_source_test.go | 1 + internal/service/ec2/ec2_eip_test.go | 1 + 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.changelog/35991.txt b/.changelog/35991.txt index ceefbdd83500..951446948bc3 100644 --- a/.changelog/35991.txt +++ b/.changelog/35991.txt @@ -1,3 +1,11 @@ ```release-note:new-resource aws_globalaccelerator_cross_account_attachment +``` + +```release-note:enhancement +resource/aws_eip: Add `arn` attribute +``` + +```release-note:enhancement +data-source/aws_eip: Add `arn` attribute ``` \ No newline at end of file diff --git a/internal/service/ec2/ec2_eip.go b/internal/service/ec2/ec2_eip.go index 1476bd416f30..2d143005c787 100644 --- a/internal/service/ec2/ec2_eip.go +++ b/internal/service/ec2/ec2_eip.go @@ -12,6 +12,7 @@ import ( "time" "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/ec2/types" "github.com/hashicorp/aws-sdk-go-base/v2/tfawserr" @@ -57,6 +58,10 @@ func resourceEIP() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "arn": { + Type: schema.TypeString, + Computed: true, + }, "associate_with_private_ip": { Type: schema.TypeString, Optional: true, @@ -226,7 +231,9 @@ func resourceEIPRead(ctx context.Context, d *schema.ResourceData, meta interface } address := outputRaw.(*types.Address) - d.Set("allocation_id", address.AllocationId) + allocationID := aws.ToString(address.AllocationId) + d.Set("allocation_id", allocationID) + d.Set("arn", eipARN(meta.(*conns.AWSClient), allocationID)) d.Set("association_id", address.AssociationId) d.Set("carrier_ip", address.CarrierIp) d.Set("customer_owned_ip", address.CustomerOwnedIp) @@ -405,3 +412,13 @@ func disassociateEIP(ctx context.Context, conn *ec2.Client, associationID string return nil } + +func eipARN(c *conns.AWSClient, allocationID string) string { + return arn.ARN{ + Partition: c.Partition, + Service: names.EC2, + Region: c.Region, + AccountID: c.AccountID, + Resource: "elastic-ip/" + allocationID, + }.String() +} diff --git a/internal/service/ec2/ec2_eip_data_source.go b/internal/service/ec2/ec2_eip_data_source.go index d919acc9252c..2949716431ab 100644 --- a/internal/service/ec2/ec2_eip_data_source.go +++ b/internal/service/ec2/ec2_eip_data_source.go @@ -30,6 +30,10 @@ func dataSourceEIP() *schema.Resource { }, Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, "association_id": { Type: schema.TypeString, Computed: true, @@ -132,7 +136,9 @@ func dataSourceEIPRead(ctx context.Context, d *schema.ResourceData, meta interfa } if eip.Domain == types.DomainTypeVpc { - d.SetId(aws.ToString(eip.AllocationId)) + allocationID := aws.ToString(eip.AllocationId) + d.SetId(allocationID) + d.Set("arn", eipARN(meta.(*conns.AWSClient), allocationID)) addressAttr, err := findEIPDomainNameAttributeByAllocationID(ctx, conn, d.Id()) @@ -146,6 +152,7 @@ func dataSourceEIPRead(ctx context.Context, d *schema.ResourceData, meta interfa } } else { d.SetId(aws.ToString(eip.PublicIp)) + d.Set("arn", nil) d.Set("ptr_record", nil) } d.Set("association_id", eip.AssociationId) diff --git a/internal/service/ec2/ec2_eip_data_source_test.go b/internal/service/ec2/ec2_eip_data_source_test.go index 40f8b6bdcddc..c9003a04c5ee 100644 --- a/internal/service/ec2/ec2_eip_data_source_test.go +++ b/internal/service/ec2/ec2_eip_data_source_test.go @@ -27,6 +27,7 @@ func TestAccEC2EIPDataSource_filter(t *testing.T) { { Config: testAccEIPDataSourceConfig_filter(rName), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "id", resourceName, "id"), resource.TestCheckResourceAttrPair(dataSourceName, "public_dns", resourceName, "public_dns"), resource.TestCheckResourceAttrPair(dataSourceName, "public_ip", resourceName, "public_ip"), diff --git a/internal/service/ec2/ec2_eip_test.go b/internal/service/ec2/ec2_eip_test.go index 12507de68545..5bdab0c6e6ba 100644 --- a/internal/service/ec2/ec2_eip_test.go +++ b/internal/service/ec2/ec2_eip_test.go @@ -36,6 +36,7 @@ func TestAccEC2EIP_basic(t *testing.T) { Config: testAccEIPConfig_basic, Check: resource.ComposeTestCheckFunc( testAccCheckEIPExists(ctx, resourceName, &conf), + resource.TestCheckResourceAttrSet(resourceName, "arn"), resource.TestCheckResourceAttr(resourceName, "domain", "vpc"), resource.TestCheckResourceAttr(resourceName, "ptr_record", ""), resource.TestCheckResourceAttrSet(resourceName, "public_ip"), From f180637c375d259f9e2ec4b33203d4b456593cd2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 10:27:36 -0400 Subject: [PATCH 083/137] Acceptance test output: % make testacc TESTARGS='-run=TestAccEC2EIPDataSource_filter\|TestAccEC2EIP_basic' PKG=ec2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccEC2EIPDataSource_filter\|TestAccEC2EIP_basic -timeout 360m === RUN TestAccEC2EIPDataSource_filter === PAUSE TestAccEC2EIPDataSource_filter === RUN TestAccEC2EIP_basic === PAUSE TestAccEC2EIP_basic === CONT TestAccEC2EIPDataSource_filter === CONT TestAccEC2EIP_basic --- PASS: TestAccEC2EIPDataSource_filter (18.78s) --- PASS: TestAccEC2EIP_basic (21.89s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 32.160s From 5d275e400cf752d8e60f6ce6c5e849ba3df52f7c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 10:45:48 -0400 Subject: [PATCH 084/137] r/aws_globalaccelerator_cross_account_attachment: Fixup acceptance tests. --- .../cross_account_attachment.go | 24 ++- .../cross_account_attachment_test.go | 194 +++++++++++++----- .../globalaccelerator/endpoint_group_test.go | 6 +- .../globalaccelerator/service_package_gen.go | 5 +- ...tor_cross_account_attachment.html.markdown | 13 +- 5 files changed, 171 insertions(+), 71 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index 53cac2e989f9..39cf5ee950d5 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/framework" fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex" fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types" + tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/names" @@ -189,7 +190,7 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res } if !new.Name.Equal(old.Name) { - input.Name = aws.String(new.Name.ValueString()) + input.Name = fwflex.StringFromFramework(ctx, new.Name) } if !new.Principals.Equal(old.Principals) { @@ -214,15 +215,18 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res return v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region) }) - response.Diagnostics.Append(fwflex.Expand(ctx, add, input.AddResources)...) - if response.Diagnostics.HasError() { - return - } - - response.Diagnostics.Append(fwflex.Expand(ctx, remove, input.RemoveResources)...) - if response.Diagnostics.HasError() { - return - } + input.AddResources = tfslices.ApplyToAll(add, func(v *resourceModel) *globalaccelerator.Resource { + return &globalaccelerator.Resource{ + EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID), + Region: fwflex.StringFromFramework(ctx, v.Region), + } + }) + input.RemoveResources = tfslices.ApplyToAll(remove, func(v *resourceModel) *globalaccelerator.Resource { + return &globalaccelerator.Resource{ + EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID), + Region: fwflex.StringFromFramework(ctx, v.Region), + } + }) } output, err := conn.UpdateCrossAccountAttachmentWithContext(ctx, input) diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index a4e175a423a1..63840f72cf58 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" tfglobalaccelerator "github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { @@ -26,10 +27,8 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { var v globalaccelerator.Attachment resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - acctest.PreCheck(ctx, t) - }, - ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.GlobalAcceleratorServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ @@ -65,25 +64,22 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + rAccountID1 := sdkacctest.RandStringFromCharSet(12, "012346789") + rAccountID2 := sdkacctest.RandStringFromCharSet(12, "012346789") var v globalaccelerator.Attachment - rAccountID := sdkacctest.RandStringFromCharSet(12, "012346789") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - acctest.PreCheck(ctx, t) - }, - ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.GlobalAcceleratorServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrossAccountAttachmentConfig_principals(rName, rAccountID), + Config: testAccCrossAccountAttachmentConfig_principals(rName, rAccountID1), Check: resource.ComposeTestCheckFunc( testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "created_time"), - resource.TestCheckResourceAttrSet(resourceName, "last_modified_time"), - resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", rAccountID), - resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "principals.#", "1"), + resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", rAccountID1), ), }, { @@ -91,51 +87,50 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { ImportState: true, ImportStateVerify: true, }, + { + Config: testAccCrossAccountAttachmentConfig_principals(rName, rAccountID2), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "principals.#", "1"), + resource.TestCheckTypeSetElemAttr(resourceName, "principals.*", rAccountID2), + ), + }, }, }) } -/* func TestAccGlobalAcceleratorCrossAccountAttachment_resources(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - partition := acctest.Partition() - region := acctest.Region() - alternateRegion := acctest.AlternateRegion() - endpointID := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef0", partition, region) - endpointID2 := fmt.Sprintf("arn:%s:ec2:%s:171405876253:elastic-ip/eipalloc-1234567890abcdef1", partition, alternateRegion) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - acctest.PreCheck(ctx, t) - }, - ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.GlobalAcceleratorServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrossAccountAttachmentConfig_resources(rName, []tfglobalaccelerator.ResourceData{ - {EndpointID: types.StringValue(endpointID), Region: types.StringValue(region)}, - {EndpointID: types.StringValue(endpointID2), Region: types.StringValue(alternateRegion)}, - }), + Config: testAccCrossAccountAttachmentConfig_resources(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "resource.#", "1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccCrossAccountAttachmentConfig_resourcesUpdated(rName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpointID, - "region": region, - }), - resource.TestCheckTypeSetElemNestedAttrs(resourceName, "resources.*", map[string]string{ - "endpoint_id": endpointID2, - "region": alternateRegion, - }), + resource.TestCheckResourceAttr(resourceName, "resource.#", "1"), ), }, }, }) } -*/ -// TODO: tags func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" @@ -143,10 +138,8 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { var v globalaccelerator.Attachment resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - acctest.PreCheck(ctx, t) - }, - ErrorCheck: acctest.ErrorCheck(t, "aws_globalaccelerator_cross_account_attachment"), + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.GlobalAcceleratorServiceID), ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, CheckDestroy: testAccCheckCrossAccountAttachmentDestroy(ctx), Steps: []resource.TestStep{ @@ -162,6 +155,53 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { }) } +func TestAccGlobalAcceleratorCrossAccountAttachment_tags(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_globalaccelerator_cross_account_attachment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + var v globalaccelerator.Attachment + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.GlobalAcceleratorServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckAcceleratorDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccCrossAccountAttachmentConfig_tags1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccCrossAccountAttachmentConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + Config: testAccCrossAccountAttachmentConfig_tags1(rName, "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckCrossAccountAttachmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) @@ -181,7 +221,7 @@ func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.Tes return err } - return fmt.Errorf("Global Accelerator ross-account Attachment %s still exists", rs.Primary.ID) + return fmt.Errorf("Global Accelerator Cross-account Attachment %s still exists", rs.Primary.ID) } return nil @@ -217,7 +257,7 @@ resource "aws_globalaccelerator_cross_account_attachment" "test" { `, rName) } -func testAccCrossAccountAttachmentConfig_principals(rName string, accountID string) string { +func testAccCrossAccountAttachmentConfig_principals(rName, accountID string) string { return fmt.Sprintf(` resource "aws_globalaccelerator_cross_account_attachment" "test" { name = %[1]q @@ -226,17 +266,63 @@ resource "aws_globalaccelerator_cross_account_attachment" "test" { `, rName, accountID) } -/* -func testAccCrossAccountAttachmentConfig_resources(rName string, resources []tfglobalaccelerator.ResourceData) string { - var resourcesStr []string - for _, r := range resources { - resourcesStr = append(resourcesStr, fmt.Sprintf(`{ endpoint_id = "%s", region = "%s" }`, r.EndpointID.ValueString(), r.Region.ValueString())) - } +func testAccCrossAccountAttachmentConfig_resources(rName string) string { + return acctest.ConfigCompose(testAccEndpointGroupConfig_baseALB(rName), fmt.Sprintf(` +resource "aws_eip" "test" { + tags = { + Name = %[1]q + } +} + +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = %[1]q + + resource { + endpoint_id = aws_lb.test.id + } +} +`, rName)) +} + +func testAccCrossAccountAttachmentConfig_resourcesUpdated(rName string) string { + return acctest.ConfigCompose(testAccEndpointGroupConfig_baseALB(rName), fmt.Sprintf(` +resource "aws_eip" "test" { + tags = { + Name = %[1]q + } +} + +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = %[1]q + + resource { + endpoint_id = aws_eip.test.arn + } +} +`, rName)) +} + +func testAccCrossAccountAttachmentConfig_tags1(rName, tagKey1, tagValue1 string) string { + return fmt.Sprintf(` +resource "aws_globalaccelerator_cross_account_attachment" "test" { + name = %[1]q + + tags = { + %[2]q = %[3]q + } +} +`, rName, tagKey1, tagValue1) +} + +func testAccCrossAccountAttachmentConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { return fmt.Sprintf(` resource "aws_globalaccelerator_cross_account_attachment" "test" { - name = "%s" - resources = [%s] + name = %[1]q + + tags = { + %[2]q = %[3]q + %[4]q = %[5]q + } } -`, rName, strings.Join(resourcesStr, ", ")) +`, rName, tagKey1, tagValue1, tagKey2, tagValue2) } -*/ diff --git a/internal/service/globalaccelerator/endpoint_group_test.go b/internal/service/globalaccelerator/endpoint_group_test.go index 3ba36305ae6a..94a0d7e3f225 100644 --- a/internal/service/globalaccelerator/endpoint_group_test.go +++ b/internal/service/globalaccelerator/endpoint_group_test.go @@ -532,7 +532,7 @@ resource "aws_globalaccelerator_endpoint_group" "test" { `, rName) } -func testAccEndpointGroupConfig_albClientIP(rName string, clientIP bool, weight int) string { +func testAccEndpointGroupConfig_baseALB(rName string) string { return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 2), fmt.Sprintf(` resource "aws_lb" "test" { name = %[1]q @@ -578,7 +578,11 @@ resource "aws_internet_gateway" "test" { Name = %[1]q } } +`, rName)) +} +func testAccEndpointGroupConfig_albClientIP(rName string, clientIP bool, weight int) string { + return acctest.ConfigCompose(testAccEndpointGroupConfig_baseALB(rName), fmt.Sprintf(` resource "aws_globalaccelerator_accelerator" "test" { name = %[1]q ip_address_type = "IPV4" diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 02ac07ab0f80..0c976a0672f6 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -24,7 +24,10 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic return []*types.ServicePackageFrameworkResource{ { Factory: newCrossAccountAttachmentResource, - Name: "Cross Account Attachment", + Name: "Cross-account Attachment", + Tags: &types.ServicePackageResourceTags{ + IdentifierAttribute: "id", + }, }, } } diff --git a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown index bb7c718a92be..7a7edd54f8c9 100644 --- a/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown +++ b/website/docs/r/globalaccelerator_cross_account_attachment.html.markdown @@ -26,10 +26,11 @@ resource "aws_globalaccelerator_cross_account_attachment" "example" { resource "aws_globalaccelerator_cross_account_attachment" "example" { name = "example-cross-account-attachment" principals = ["123456789012"] - resources = [ - { endpoint_id = "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", region = "us-west-2" }, - { endpoint_id = "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/my-other-load-balancer/50dc6c495c0c9189", region = "us-east-1" } - ] + + resource { + endpoint_id = "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188" + region = "us-west-2" + } } ``` @@ -42,7 +43,9 @@ The following arguments are required: The following arguments are optional: * `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator. -* `resources` - (Optional) List of resources to be associated with the accelerator. Each resource is specified as a map with keys `endpoint_id` and `region`. The `region` field is optional. +* `resource` - (Optional) List of resources to be associated with the accelerator. + * `endpoint_id` - (Optional) The endpoint ID for the endpoint that is specified as a AWS resource. + * `region` - (Optional) The AWS Region where a shared endpoint resource is located. * `tags` - (Optional) A map of tags to assign to the resource. 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 From 8c9de386d37ea5dfe2ad3901550bea372b1b7db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Silva?= Date: Tue, 23 Apr 2024 16:39:19 +0100 Subject: [PATCH 085/137] new service: route53profiles --- .ci/.semgrep-service-name3.yml | 61 +++ .github/labeler-issue-triage.yml | 2 + .github/labeler-pr-triage.yml | 6 + .../components/generated/services_all.kt | 1 + go.mod | 1 + go.sum | 2 + infrastructure/repository/labels-service.tf | 1 + internal/conns/awsclient_gen.go | 5 + internal/provider/service_packages_gen.go | 2 + internal/service/route53profiles/generate.go | 7 + .../service_endpoints_gen_test.go | 496 ++++++++++++++++++ .../route53profiles/service_package_gen.go | 50 ++ internal/sweep/service_packages_gen_test.go | 2 + names/consts_gen.go | 2 + names/data/names_data.csv | 1 + website/allowed-subcategories.txt | 1 + .../custom-service-endpoints.html.markdown | 1 + 17 files changed, 641 insertions(+) create mode 100644 internal/service/route53profiles/generate.go create mode 100644 internal/service/route53profiles/service_endpoints_gen_test.go create mode 100644 internal/service/route53profiles/service_package_gen.go diff --git a/.ci/.semgrep-service-name3.yml b/.ci/.semgrep-service-name3.yml index f65fbacaa5c4..983727991e84 100644 --- a/.ci/.semgrep-service-name3.yml +++ b/.ci/.semgrep-service-name3.yml @@ -776,6 +776,67 @@ rules: patterns: - pattern-regex: "(?i)Route53Domains" severity: WARNING + - id: route53profiles-in-func-name + languages: + - go + message: Do not use "Route53Profiles" in func name inside route53profiles package + paths: + include: + - internal/service/route53profiles + exclude: + - internal/service/route53profiles/list_pages_gen.go + patterns: + - pattern: func $NAME( ... ) { ... } + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)Route53Profiles" + - focus-metavariable: $NAME + - pattern-not: func $NAME($T *testing.T) { ... } + severity: WARNING + - id: route53profiles-in-test-name + languages: + - go + message: Include "Route53Profiles" in test name + paths: + include: + - internal/service/route53profiles/*_test.go + patterns: + - pattern: func $NAME( ... ) { ... } + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-not-regex: "^TestAccRoute53Profiles" + - pattern-regex: ^TestAcc.* + severity: WARNING + - id: route53profiles-in-const-name + languages: + - go + message: Do not use "Route53Profiles" in const name inside route53profiles package + paths: + include: + - internal/service/route53profiles + patterns: + - pattern: const $NAME = ... + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)Route53Profiles" + severity: WARNING + - id: route53profiles-in-var-name + languages: + - go + message: Do not use "Route53Profiles" in var name inside route53profiles package + paths: + include: + - internal/service/route53profiles + patterns: + - pattern: var $NAME = ... + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)Route53Profiles" + severity: WARNING - id: route53recoverycontrolconfig-in-func-name languages: - go diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index 9445a24aaba0..2bba1a827738 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -569,6 +569,8 @@ service/route53: - '((\*|-)\s*`?|(data|resource)\s+"?)aws_route53_(?!resolver_)' service/route53domains: - '((\*|-)\s*`?|(data|resource)\s+"?)aws_route53domains_' +service/route53profiles: + - '((\*|-)\s*`?|(data|resource)\s+"?)aws_route53profiles_' service/route53recoverycluster: - '((\*|-)\s*`?|(data|resource)\s+"?)aws_route53recoverycluster_' service/route53recoverycontrolconfig: diff --git a/.github/labeler-pr-triage.yml b/.github/labeler-pr-triage.yml index 9eadf9fac76e..01bca485e955 100644 --- a/.github/labeler-pr-triage.yml +++ b/.github/labeler-pr-triage.yml @@ -1794,6 +1794,12 @@ service/route53domains: - any-glob-to-any-file: - 'internal/service/route53domains/**/*' - 'website/**/route53domains_*' +service/route53profiles: + - any: + - changed-files: + - any-glob-to-any-file: + - 'internal/service/route53profiles/**/*' + - 'website/**/route53profiles_*' service/route53recoverycluster: - any: - changed-files: diff --git a/.teamcity/components/generated/services_all.kt b/.teamcity/components/generated/services_all.kt index 5c0383ecca16..375f1a303a4b 100644 --- a/.teamcity/components/generated/services_all.kt +++ b/.teamcity/components/generated/services_all.kt @@ -184,6 +184,7 @@ val services = mapOf( "rolesanywhere" to ServiceSpec("Roles Anywhere"), "route53" to ServiceSpec("Route 53", vpcLock = true), "route53domains" to ServiceSpec("Route 53 Domains"), + "route53profiles" to ServiceSpec("Route 53 Profiles"), "route53recoverycontrolconfig" to ServiceSpec("Route 53 Recovery Control Config"), "route53recoveryreadiness" to ServiceSpec("Route 53 Recovery Readiness"), "route53resolver" to ServiceSpec("Route 53 Resolver", vpcLock = true), diff --git a/go.mod b/go.mod index 3dd297e4ec21..3ffb86ca8881 100644 --- a/go.mod +++ b/go.mod @@ -137,6 +137,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.4 github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 + github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.4 diff --git a/go.sum b/go.sum index 69a7d42e9c9d..191f628830d9 100644 --- a/go.sum +++ b/go.sum @@ -304,6 +304,8 @@ github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 h1:znBjrg7qGF7DOXpJ1Z github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0/go.mod h1:RHFmC9Lds1jS1zBvnFq1GDh3yxFXH++n+2sI9TE53Cc= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 h1:Qb7EiHvGJZGU43aCMahEJrP5sJjV62gGXm4y9x/syRQ= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4/go.mod h1:8wjITSWOCR+G7DhS2WraZnZ/geFYxXLLP0KKTfZtRGQ= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 h1:on9+rCVnTcfYtz4i7sVsNuJYCAQO9xucyGtaWtlbIXY= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0/go.mod h1:tTj/YUqvGBhnxNh8gMjf31pSJF1L3STJwdPkjhSyl5I= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o= github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 h1:J6weNKyH2/bVlQ4dWpfprtIGf1tor3Ht5xurx+GXJjs= diff --git a/infrastructure/repository/labels-service.tf b/infrastructure/repository/labels-service.tf index 7122623910df..604b2fd22df2 100644 --- a/infrastructure/repository/labels-service.tf +++ b/infrastructure/repository/labels-service.tf @@ -271,6 +271,7 @@ variable "service_labels" { "rolesanywhere", "route53", "route53domains", + "route53profiles", "route53recoverycluster", "route53recoverycontrolconfig", "route53recoveryreadiness", diff --git a/internal/conns/awsclient_gen.go b/internal/conns/awsclient_gen.go index ad4fe435f1be..79e46d9322d4 100644 --- a/internal/conns/awsclient_gen.go +++ b/internal/conns/awsclient_gen.go @@ -129,6 +129,7 @@ import ( resourcegroupstaggingapi_sdkv2 "github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi" rolesanywhere_sdkv2 "github.com/aws/aws-sdk-go-v2/service/rolesanywhere" route53domains_sdkv2 "github.com/aws/aws-sdk-go-v2/service/route53domains" + route53profiles_sdkv2 "github.com/aws/aws-sdk-go-v2/service/route53profiles" s3_sdkv2 "github.com/aws/aws-sdk-go-v2/service/s3" s3control_sdkv2 "github.com/aws/aws-sdk-go-v2/service/s3control" scheduler_sdkv2 "github.com/aws/aws-sdk-go-v2/service/scheduler" @@ -1042,6 +1043,10 @@ func (c *AWSClient) Route53DomainsClient(ctx context.Context) *route53domains_sd return errs.Must(client[*route53domains_sdkv2.Client](ctx, c, names.Route53Domains, make(map[string]any))) } +func (c *AWSClient) Route53ProfilesClient(ctx context.Context) *route53profiles_sdkv2.Client { + return errs.Must(client[*route53profiles_sdkv2.Client](ctx, c, names.Route53Profiles, make(map[string]any))) +} + func (c *AWSClient) Route53RecoveryControlConfigConn(ctx context.Context) *route53recoverycontrolconfig_sdkv1.Route53RecoveryControlConfig { return errs.Must(conn[*route53recoverycontrolconfig_sdkv1.Route53RecoveryControlConfig](ctx, c, names.Route53RecoveryControlConfig, make(map[string]any))) } diff --git a/internal/provider/service_packages_gen.go b/internal/provider/service_packages_gen.go index 3ccbd61ef99c..d81f0c820ab6 100644 --- a/internal/provider/service_packages_gen.go +++ b/internal/provider/service_packages_gen.go @@ -191,6 +191,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere" "github.com/hashicorp/terraform-provider-aws/internal/service/route53" "github.com/hashicorp/terraform-provider-aws/internal/service/route53domains" + "github.com/hashicorp/terraform-provider-aws/internal/service/route53profiles" "github.com/hashicorp/terraform-provider-aws/internal/service/route53recoverycontrolconfig" "github.com/hashicorp/terraform-provider-aws/internal/service/route53recoveryreadiness" "github.com/hashicorp/terraform-provider-aws/internal/service/route53resolver" @@ -427,6 +428,7 @@ func servicePackages(ctx context.Context) []conns.ServicePackage { rolesanywhere.ServicePackage(ctx), route53.ServicePackage(ctx), route53domains.ServicePackage(ctx), + route53profiles.ServicePackage(ctx), route53recoverycontrolconfig.ServicePackage(ctx), route53recoveryreadiness.ServicePackage(ctx), route53resolver.ServicePackage(ctx), diff --git a/internal/service/route53profiles/generate.go b/internal/service/route53profiles/generate.go new file mode 100644 index 000000000000..7674e03bc5dc --- /dev/null +++ b/internal/service/route53profiles/generate.go @@ -0,0 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +//go:generate go run ../../generate/servicepackage/main.go +// ONLY generate directives and package declaration! Do not add anything else to this file. + +package route53profiles diff --git a/internal/service/route53profiles/service_endpoints_gen_test.go b/internal/service/route53profiles/service_endpoints_gen_test.go new file mode 100644 index 000000000000..ef471d814e2c --- /dev/null +++ b/internal/service/route53profiles/service_endpoints_gen_test.go @@ -0,0 +1,496 @@ +// Code generated by internal/generate/serviceendpointtests/main.go; DO NOT EDIT. + +package route53profiles_test + +import ( + "context" + "errors" + "fmt" + "maps" + "os" + "path/filepath" + "reflect" + "strings" + "testing" + + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + route53profiles_sdkv2 "github.com/aws/aws-sdk-go-v2/service/route53profiles" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/aws-sdk-go-base/v2/servicemocks" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + terraformsdk "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/internal/provider" +) + +type endpointTestCase struct { + with []setupFunc + expected caseExpectations +} + +type caseSetup struct { + config map[string]any + configFile configFile + environmentVariables map[string]string +} + +type configFile struct { + baseUrl string + serviceUrl string +} + +type caseExpectations struct { + diags diag.Diagnostics + endpoint string +} + +type setupFunc func(setup *caseSetup) + +type callFunc func(ctx context.Context, t *testing.T, meta *conns.AWSClient) string + +const ( + packageNameConfigEndpoint = "https://packagename-config.endpoint.test/" + awsServiceEnvvarEndpoint = "https://service-envvar.endpoint.test/" + baseEnvvarEndpoint = "https://base-envvar.endpoint.test/" + serviceConfigFileEndpoint = "https://service-configfile.endpoint.test/" + baseConfigFileEndpoint = "https://base-configfile.endpoint.test/" +) + +const ( + packageName = "route53profiles" + awsEnvVar = "AWS_ENDPOINT_URL_ROUTE_53_PROFILES" + baseEnvVar = "AWS_ENDPOINT_URL" + configParam = "route_53_profiles" +) + +func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.Setenv + const region = "us-west-2" //lintignore:AWSAT003 + + testcases := map[string]endpointTestCase{ + "no config": { + with: []setupFunc{withNoConfig}, + expected: expectDefaultEndpoint(region), + }, + + // Package name endpoint on Config + + "package name endpoint config": { + with: []setupFunc{ + withPackageNameEndpointInConfig, + }, + expected: expectPackageNameConfigEndpoint(), + }, + + "package name endpoint config overrides aws service envvar": { + with: []setupFunc{ + withPackageNameEndpointInConfig, + withAwsEnvVar, + }, + expected: expectPackageNameConfigEndpoint(), + }, + + "package name endpoint config overrides base envvar": { + with: []setupFunc{ + withPackageNameEndpointInConfig, + withBaseEnvVar, + }, + expected: expectPackageNameConfigEndpoint(), + }, + + "package name endpoint config overrides service config file": { + with: []setupFunc{ + withPackageNameEndpointInConfig, + withServiceEndpointInConfigFile, + }, + expected: expectPackageNameConfigEndpoint(), + }, + + "package name endpoint config overrides base config file": { + with: []setupFunc{ + withPackageNameEndpointInConfig, + withBaseEndpointInConfigFile, + }, + expected: expectPackageNameConfigEndpoint(), + }, + + // Service endpoint in AWS envvar + + "service aws envvar": { + with: []setupFunc{ + withAwsEnvVar, + }, + expected: expectAwsEnvVarEndpoint(), + }, + + "service aws envvar overrides base envvar": { + with: []setupFunc{ + withAwsEnvVar, + withBaseEnvVar, + }, + expected: expectAwsEnvVarEndpoint(), + }, + + "service aws envvar overrides service config file": { + with: []setupFunc{ + withAwsEnvVar, + withServiceEndpointInConfigFile, + }, + expected: expectAwsEnvVarEndpoint(), + }, + + "service aws envvar overrides base config file": { + with: []setupFunc{ + withAwsEnvVar, + withBaseEndpointInConfigFile, + }, + expected: expectAwsEnvVarEndpoint(), + }, + + // Base endpoint in envvar + + "base endpoint envvar": { + with: []setupFunc{ + withBaseEnvVar, + }, + expected: expectBaseEnvVarEndpoint(), + }, + + "base endpoint envvar overrides service config file": { + with: []setupFunc{ + withBaseEnvVar, + withServiceEndpointInConfigFile, + }, + expected: expectBaseEnvVarEndpoint(), + }, + + "base endpoint envvar overrides base config file": { + with: []setupFunc{ + withBaseEnvVar, + withBaseEndpointInConfigFile, + }, + expected: expectBaseEnvVarEndpoint(), + }, + + // Service endpoint in config file + + "service config file": { + with: []setupFunc{ + withServiceEndpointInConfigFile, + }, + expected: expectServiceConfigFileEndpoint(), + }, + + "service config file overrides base config file": { + with: []setupFunc{ + withServiceEndpointInConfigFile, + withBaseEndpointInConfigFile, + }, + expected: expectServiceConfigFileEndpoint(), + }, + + // Base endpoint in config file + + "base endpoint config file": { + with: []setupFunc{ + withBaseEndpointInConfigFile, + }, + expected: expectBaseConfigFileEndpoint(), + }, + } + + for name, testcase := range testcases { //nolint:paralleltest // uses t.Setenv + testcase := testcase + + t.Run(name, func(t *testing.T) { + testEndpointCase(t, region, testcase, callService) + }) + } +} + +func defaultEndpoint(region string) string { + r := route53profiles_sdkv2.NewDefaultEndpointResolverV2() + + ep, err := r.ResolveEndpoint(context.Background(), route53profiles_sdkv2.EndpointParameters{ + Region: aws_sdkv2.String(region), + }) + if err != nil { + return err.Error() + } + + if ep.URI.Path == "" { + ep.URI.Path = "/" + } + + return ep.URI.String() +} + +func callService(ctx context.Context, t *testing.T, meta *conns.AWSClient) string { + t.Helper() + + var endpoint string + + client := meta.Route53ProfilesClient(ctx) + + _, err := client.ListProfiles(ctx, &route53profiles_sdkv2.ListProfilesInput{}, + func(opts *route53profiles_sdkv2.Options) { + opts.APIOptions = append(opts.APIOptions, + addRetrieveEndpointURLMiddleware(t, &endpoint), + addCancelRequestMiddleware(), + ) + }, + ) + if err == nil { + t.Fatal("Expected an error, got none") + } else if !errors.Is(err, errCancelOperation) { + t.Fatalf("Unexpected error: %s", err) + } + + return endpoint +} + +func withNoConfig(_ *caseSetup) { + // no-op +} + +func withPackageNameEndpointInConfig(setup *caseSetup) { + if _, ok := setup.config["endpoints"]; !ok { + setup.config["endpoints"] = []any{ + map[string]any{}, + } + } + endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints[packageName] = packageNameConfigEndpoint +} + +func withAwsEnvVar(setup *caseSetup) { + setup.environmentVariables[awsEnvVar] = awsServiceEnvvarEndpoint +} + +func withBaseEnvVar(setup *caseSetup) { + setup.environmentVariables[baseEnvVar] = baseEnvvarEndpoint +} + +func withServiceEndpointInConfigFile(setup *caseSetup) { + setup.configFile.serviceUrl = serviceConfigFileEndpoint +} + +func withBaseEndpointInConfigFile(setup *caseSetup) { + setup.configFile.baseUrl = baseConfigFileEndpoint +} + +func expectDefaultEndpoint(region string) caseExpectations { + return caseExpectations{ + endpoint: defaultEndpoint(region), + } +} + +func expectPackageNameConfigEndpoint() caseExpectations { + return caseExpectations{ + endpoint: packageNameConfigEndpoint, + } +} + +func expectAwsEnvVarEndpoint() caseExpectations { + return caseExpectations{ + endpoint: awsServiceEnvvarEndpoint, + } +} + +func expectBaseEnvVarEndpoint() caseExpectations { + return caseExpectations{ + endpoint: baseEnvvarEndpoint, + } +} + +func expectServiceConfigFileEndpoint() caseExpectations { + return caseExpectations{ + endpoint: serviceConfigFileEndpoint, + } +} + +func expectBaseConfigFileEndpoint() caseExpectations { + return caseExpectations{ + endpoint: baseConfigFileEndpoint, + } +} + +func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, callF callFunc) { + t.Helper() + + ctx := context.Background() + + setup := caseSetup{ + config: map[string]any{}, + environmentVariables: map[string]string{}, + } + + for _, f := range testcase.with { + f(&setup) + } + + config := map[string]any{ + "access_key": servicemocks.MockStaticAccessKey, + "secret_key": servicemocks.MockStaticSecretKey, + "region": region, + "skip_credentials_validation": true, + "skip_requesting_account_id": true, + } + + maps.Copy(config, setup.config) + + if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { + config["profile"] = "default" + tempDir := t.TempDir() + writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) + } + + for k, v := range setup.environmentVariables { + t.Setenv(k, v) + } + + p, err := provider.New(ctx) + if err != nil { + t.Fatal(err) + } + + expectedDiags := testcase.expected.diags + expectedDiags = append( + expectedDiags, + errs.NewWarningDiagnostic( + "AWS account ID not found for provider", + "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.", + ), + ) + + diags := p.Configure(ctx, terraformsdk.NewResourceConfigRaw(config)) + + if diff := cmp.Diff(diags, expectedDiags, cmp.Comparer(sdkdiag.Comparer)); diff != "" { + t.Errorf("unexpected diagnostics difference: %s", diff) + } + + if diags.HasError() { + return + } + + meta := p.Meta().(*conns.AWSClient) + + endpoint := callF(ctx, t, meta) + + if endpoint != testcase.expected.endpoint { + t.Errorf("expected endpoint %q, got %q", testcase.expected.endpoint, endpoint) + } +} + +func addRetrieveEndpointURLMiddleware(t *testing.T, endpoint *string) func(*middleware.Stack) error { + return func(stack *middleware.Stack) error { + return stack.Finalize.Add( + retrieveEndpointURLMiddleware(t, endpoint), + middleware.After, + ) + } +} + +func retrieveEndpointURLMiddleware(t *testing.T, endpoint *string) middleware.FinalizeMiddleware { + return middleware.FinalizeMiddlewareFunc( + "Test: Retrieve Endpoint", + func(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (middleware.FinalizeOutput, middleware.Metadata, error) { + t.Helper() + + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + t.Fatalf("Expected *github.com/aws/smithy-go/transport/http.Request, got %s", fullTypeName(in.Request)) + } + + url := request.URL + url.RawQuery = "" + url.Path = "/" + + *endpoint = url.String() + + return next.HandleFinalize(ctx, in) + }) +} + +var errCancelOperation = fmt.Errorf("Test: Cancelling request") + +func addCancelRequestMiddleware() func(*middleware.Stack) error { + return func(stack *middleware.Stack) error { + return stack.Finalize.Add( + cancelRequestMiddleware(), + middleware.After, + ) + } +} + +// cancelRequestMiddleware creates a Smithy middleware that intercepts the request before sending and cancels it +func cancelRequestMiddleware() middleware.FinalizeMiddleware { + return middleware.FinalizeMiddlewareFunc( + "Test: Cancel Requests", + func(_ context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (middleware.FinalizeOutput, middleware.Metadata, error) { + return middleware.FinalizeOutput{}, middleware.Metadata{}, errCancelOperation + }) +} + +func fullTypeName(i interface{}) string { + return fullValueTypeName(reflect.ValueOf(i)) +} + +func fullValueTypeName(v reflect.Value) string { + if v.Kind() == reflect.Ptr { + return "*" + fullValueTypeName(reflect.Indirect(v)) + } + + requestType := v.Type() + return fmt.Sprintf("%s.%s", requestType.PkgPath(), requestType.Name()) +} + +func generateSharedConfigFile(config configFile) string { + var buf strings.Builder + + buf.WriteString(` +[default] +aws_access_key_id = DefaultSharedCredentialsAccessKey +aws_secret_access_key = DefaultSharedCredentialsSecretKey +`) + if config.baseUrl != "" { + buf.WriteString(fmt.Sprintf("endpoint_url = %s\n", config.baseUrl)) + } + + if config.serviceUrl != "" { + buf.WriteString(fmt.Sprintf(` +services = endpoint-test + +[services endpoint-test] +%[1]s = + endpoint_url = %[2]s +`, configParam, serviceConfigFileEndpoint)) + } + + return buf.String() +} + +func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, content string) string { + t.Helper() + + file, err := os.Create(filepath.Join(tempDir, "aws-sdk-go-base-shared-configuration-file")) + if err != nil { + t.Fatalf("creating shared configuration file: %s", err) + } + + _, err = file.WriteString(content) + if err != nil { + t.Fatalf(" writing shared configuration file: %s", err) + } + + if v, ok := (*config)["shared_config_files"]; !ok { + (*config)["shared_config_files"] = []any{file.Name()} + } else { + (*config)["shared_config_files"] = append(v.([]any), file.Name()) + } + + return file.Name() +} diff --git a/internal/service/route53profiles/service_package_gen.go b/internal/service/route53profiles/service_package_gen.go new file mode 100644 index 000000000000..1a83796277fe --- /dev/null +++ b/internal/service/route53profiles/service_package_gen.go @@ -0,0 +1,50 @@ +// Code generated by internal/generate/servicepackages/main.go; DO NOT EDIT. + +package route53profiles + +import ( + "context" + + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + route53profiles_sdkv2 "github.com/aws/aws-sdk-go-v2/service/route53profiles" + "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/types" + "github.com/hashicorp/terraform-provider-aws/names" +) + +type servicePackage struct{} + +func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.ServicePackageFrameworkDataSource { + return []*types.ServicePackageFrameworkDataSource{} +} + +func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.ServicePackageFrameworkResource { + return []*types.ServicePackageFrameworkResource{} +} + +func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { + return []*types.ServicePackageSDKDataSource{} +} + +func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePackageSDKResource { + return []*types.ServicePackageSDKResource{} +} + +func (p *servicePackage) ServicePackageName() string { + return names.Route53Profiles +} + +// NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. +func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) (*route53profiles_sdkv2.Client, error) { + cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) + + return route53profiles_sdkv2.NewFromConfig(cfg, func(o *route53profiles_sdkv2.Options) { + if endpoint := config["endpoint"].(string); endpoint != "" { + o.BaseEndpoint = aws_sdkv2.String(endpoint) + } + }), nil +} + +func ServicePackage(ctx context.Context) conns.ServicePackage { + return &servicePackage{} +} diff --git a/internal/sweep/service_packages_gen_test.go b/internal/sweep/service_packages_gen_test.go index 2d2cb65330a1..275ef2957bca 100644 --- a/internal/sweep/service_packages_gen_test.go +++ b/internal/sweep/service_packages_gen_test.go @@ -191,6 +191,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/service/rolesanywhere" "github.com/hashicorp/terraform-provider-aws/internal/service/route53" "github.com/hashicorp/terraform-provider-aws/internal/service/route53domains" + "github.com/hashicorp/terraform-provider-aws/internal/service/route53profiles" "github.com/hashicorp/terraform-provider-aws/internal/service/route53recoverycontrolconfig" "github.com/hashicorp/terraform-provider-aws/internal/service/route53recoveryreadiness" "github.com/hashicorp/terraform-provider-aws/internal/service/route53resolver" @@ -427,6 +428,7 @@ func servicePackages(ctx context.Context) []conns.ServicePackage { rolesanywhere.ServicePackage(ctx), route53.ServicePackage(ctx), route53domains.ServicePackage(ctx), + route53profiles.ServicePackage(ctx), route53recoverycontrolconfig.ServicePackage(ctx), route53recoveryreadiness.ServicePackage(ctx), route53resolver.ServicePackage(ctx), diff --git a/names/consts_gen.go b/names/consts_gen.go index 15f66de76e9d..1eb470f5a846 100644 --- a/names/consts_gen.go +++ b/names/consts_gen.go @@ -186,6 +186,7 @@ const ( RolesAnywhere = "rolesanywhere" Route53 = "route53" Route53Domains = "route53domains" + Route53Profiles = "route53profiles" Route53RecoveryControlConfig = "route53recoverycontrolconfig" Route53RecoveryReadiness = "route53recoveryreadiness" Route53Resolver = "route53resolver" @@ -422,6 +423,7 @@ const ( RolesAnywhereServiceID = "RolesAnywhere" Route53ServiceID = "Route 53" Route53DomainsServiceID = "Route 53 Domains" + Route53ProfilesServiceID = "Route 53 Profiles" Route53RecoveryControlConfigServiceID = "Route53 Recovery Control Config" Route53RecoveryReadinessServiceID = "Route53 Recovery Readiness" Route53ResolverServiceID = "Route53Resolver" diff --git a/names/data/names_data.csv b/names/data/names_data.csv index a3efdbe33440..e72f174da02f 100644 --- a/names/data/names_data.csv +++ b/names/data/names_data.csv @@ -311,6 +311,7 @@ robomaker,robomaker,robomaker,robomaker,,robomaker,,,RoboMaker,RoboMaker,,1,,,aw rolesanywhere,rolesanywhere,rolesanywhere,rolesanywhere,,rolesanywhere,,,RolesAnywhere,RolesAnywhere,,,2,,aws_rolesanywhere_,,rolesanywhere_,Roles Anywhere,AWS,,,,,,,RolesAnywhere,ListProfiles,, route53,route53,route53,route53,,route53,,,Route53,Route53,x,1,,aws_route53_(?!resolver_),aws_route53_,,route53_cidr_;route53_delegation_;route53_health_;route53_hosted_;route53_key_;route53_query_;route53_record;route53_traffic_;route53_vpc_;route53_zone,Route 53,Amazon,,,,,,,Route 53,ListHostedZones,, route53domains,route53domains,route53domains,route53domains,,route53domains,,,Route53Domains,Route53Domains,x,,2,,aws_route53domains_,,route53domains_,Route 53 Domains,Amazon,,,,,,,Route 53 Domains,ListDomains,, +route53profiles,route53profiles,route53profiles,route53profiles,,route53profiles,,,Route53Profiles,Route53Profiles,,,2,,aws_route53profiles_,,route53profiles_,Route 53 Profiles,Amazon,,,,,,,Route 53 Profiles,ListProfiles,, route53-recovery-cluster,route53recoverycluster,route53recoverycluster,route53recoverycluster,,route53recoverycluster,,,Route53RecoveryCluster,Route53RecoveryCluster,,1,,,aws_route53recoverycluster_,,route53recoverycluster_,Route 53 Recovery Cluster,Amazon,,x,,,,,Route53 Recovery Cluster,,, route53-recovery-control-config,route53recoverycontrolconfig,route53recoverycontrolconfig,route53recoverycontrolconfig,,route53recoverycontrolconfig,,,Route53RecoveryControlConfig,Route53RecoveryControlConfig,x,1,,,aws_route53recoverycontrolconfig_,,route53recoverycontrolconfig_,Route 53 Recovery Control Config,Amazon,,,,,,,Route53 Recovery Control Config,ListClusters,, route53-recovery-readiness,route53recoveryreadiness,route53recoveryreadiness,route53recoveryreadiness,,route53recoveryreadiness,,,Route53RecoveryReadiness,Route53RecoveryReadiness,x,1,,,aws_route53recoveryreadiness_,,route53recoveryreadiness_,Route 53 Recovery Readiness,Amazon,,,,,,,Route53 Recovery Readiness,ListCells,, diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index 1924fe76d34a..1c6c8c92a1fb 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -187,6 +187,7 @@ Resource Groups Tagging Roles Anywhere Route 53 Route 53 Domains +Route 53 Profiles Route 53 Recovery Control Config Route 53 Recovery Readiness Route 53 Resolver diff --git a/website/docs/guides/custom-service-endpoints.html.markdown b/website/docs/guides/custom-service-endpoints.html.markdown index 6410f2391a08..78b92bf82df0 100644 --- a/website/docs/guides/custom-service-endpoints.html.markdown +++ b/website/docs/guides/custom-service-endpoints.html.markdown @@ -253,6 +253,7 @@ provider "aws" {
  • rolesanywhere
  • route53
  • route53domains
  • +
  • route53profiles
  • route53recoverycontrolconfig
  • route53recoveryreadiness
  • route53resolver
  • From 0b910997af554331bc83cdd4a133e4e845c1809d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 11:42:10 -0400 Subject: [PATCH 086/137] globalaccelerator: Use AWS SDK for Go v2. --- names/data/names_data.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/names/data/names_data.csv b/names/data/names_data.csv index a3efdbe33440..3ef7158d3850 100644 --- a/names/data/names_data.csv +++ b/names/data/names_data.csv @@ -171,7 +171,7 @@ frauddetector,frauddetector,frauddetector,frauddetector,,frauddetector,,,FraudDe ,,,,,,,,,,,,,,,,,FreeRTOS,,x,,,,,,,,,No SDK support fsx,fsx,fsx,fsx,,fsx,,,FSx,FSx,,1,,,aws_fsx_,,fsx_,FSx,Amazon,,,,,,,FSx,DescribeFileSystems,, gamelift,gamelift,gamelift,gamelift,,gamelift,,,GameLift,GameLift,,1,,,aws_gamelift_,,gamelift_,GameLift,Amazon,,,,,,,GameLift,ListGameServerGroups,, -globalaccelerator,globalaccelerator,globalaccelerator,globalaccelerator,,globalaccelerator,,,GlobalAccelerator,GlobalAccelerator,x,1,,,aws_globalaccelerator_,,globalaccelerator_,Global Accelerator,AWS,,,,,,,Global Accelerator,ListAccelerators,, +globalaccelerator,globalaccelerator,globalaccelerator,globalaccelerator,,globalaccelerator,,,GlobalAccelerator,GlobalAccelerator,x,,2,,aws_globalaccelerator_,,globalaccelerator_,Global Accelerator,AWS,,,,,,,Global Accelerator,ListAccelerators,, glue,glue,glue,glue,,glue,,,Glue,Glue,,1,,,aws_glue_,,glue_,Glue,AWS,,,,,,,Glue,ListRegistries,, databrew,databrew,gluedatabrew,databrew,,databrew,,gluedatabrew,DataBrew,GlueDataBrew,,1,,,aws_databrew_,,databrew_,Glue DataBrew,AWS,,x,,,,,DataBrew,,, groundstation,groundstation,groundstation,groundstation,,groundstation,,,GroundStation,GroundStation,,,2,,aws_groundstation_,,groundstation_,Ground Station,AWS,,,,,,,GroundStation,ListConfigs,, From 172661d416b098f9642f0c3a7a1fe28ae7d66399 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 11:43:38 -0400 Subject: [PATCH 087/137] globalaccelerator: AWS SDK for Go v2 tagging codewq. --- internal/service/globalaccelerator/generate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/globalaccelerator/generate.go b/internal/service/globalaccelerator/generate.go index e3f90ea20bd5..77472c95ab3a 100644 --- a/internal/service/globalaccelerator/generate.go +++ b/internal/service/globalaccelerator/generate.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run ../../generate/tags/main.go -ListTags -ServiceTagsSlice -UpdateTags +//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -ListTags -ServiceTagsSlice -UpdateTags //go:generate go run ../../generate/servicepackage/main.go // ONLY generate directives and package declaration! Do not add anything else to this file. From b52e88904c7ffdbd82dbcf7a30bce263b54231f3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 11:44:31 -0400 Subject: [PATCH 088/137] Run 'make gen'. --- internal/conns/awsclient_gen.go | 6 +-- .../service_endpoints_gen_test.go | 40 +++++++++++-------- .../service/globalaccelerator/tags_gen.go | 36 ++++++++--------- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/internal/conns/awsclient_gen.go b/internal/conns/awsclient_gen.go index ad4fe435f1be..b67f6a932f38 100644 --- a/internal/conns/awsclient_gen.go +++ b/internal/conns/awsclient_gen.go @@ -81,6 +81,7 @@ import ( fis_sdkv2 "github.com/aws/aws-sdk-go-v2/service/fis" fms_sdkv2 "github.com/aws/aws-sdk-go-v2/service/fms" glacier_sdkv2 "github.com/aws/aws-sdk-go-v2/service/glacier" + globalaccelerator_sdkv2 "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" groundstation_sdkv2 "github.com/aws/aws-sdk-go-v2/service/groundstation" healthlake_sdkv2 "github.com/aws/aws-sdk-go-v2/service/healthlake" iam_sdkv2 "github.com/aws/aws-sdk-go-v2/service/iam" @@ -195,7 +196,6 @@ import ( emrcontainers_sdkv1 "github.com/aws/aws-sdk-go/service/emrcontainers" fsx_sdkv1 "github.com/aws/aws-sdk-go/service/fsx" gamelift_sdkv1 "github.com/aws/aws-sdk-go/service/gamelift" - globalaccelerator_sdkv1 "github.com/aws/aws-sdk-go/service/globalaccelerator" glue_sdkv1 "github.com/aws/aws-sdk-go/service/glue" greengrass_sdkv1 "github.com/aws/aws-sdk-go/service/greengrass" guardduty_sdkv1 "github.com/aws/aws-sdk-go/service/guardduty" @@ -698,8 +698,8 @@ func (c *AWSClient) GlacierClient(ctx context.Context) *glacier_sdkv2.Client { return errs.Must(client[*glacier_sdkv2.Client](ctx, c, names.Glacier, make(map[string]any))) } -func (c *AWSClient) GlobalAcceleratorConn(ctx context.Context) *globalaccelerator_sdkv1.GlobalAccelerator { - return errs.Must(conn[*globalaccelerator_sdkv1.GlobalAccelerator](ctx, c, names.GlobalAccelerator, make(map[string]any))) +func (c *AWSClient) GlobalAcceleratorClient(ctx context.Context) *globalaccelerator_sdkv2.Client { + return errs.Must(client[*globalaccelerator_sdkv2.Client](ctx, c, names.GlobalAccelerator, make(map[string]any))) } func (c *AWSClient) GlueConn(ctx context.Context) *glue_sdkv1.Glue { diff --git a/internal/service/globalaccelerator/service_endpoints_gen_test.go b/internal/service/globalaccelerator/service_endpoints_gen_test.go index beddae7df67b..0d337e6ad70e 100644 --- a/internal/service/globalaccelerator/service_endpoints_gen_test.go +++ b/internal/service/globalaccelerator/service_endpoints_gen_test.go @@ -4,17 +4,17 @@ package globalaccelerator_test import ( "context" + "errors" "fmt" "maps" - "net/url" "os" "path/filepath" "reflect" "strings" "testing" - "github.com/aws/aws-sdk-go/aws/endpoints" - globalaccelerator_sdkv1 "github.com/aws/aws-sdk-go/service/globalaccelerator" + aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" + globalaccelerator_sdkv2 "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "github.com/google/go-cmp/cmp" @@ -212,34 +212,42 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S } func defaultEndpoint(region string) string { - r := endpoints.DefaultResolver() + r := globalaccelerator_sdkv2.NewDefaultEndpointResolverV2() - ep, err := r.EndpointFor(globalaccelerator_sdkv1.EndpointsID, region, func(opt *endpoints.Options) { - opt.ResolveUnknownService = true + ep, err := r.ResolveEndpoint(context.Background(), globalaccelerator_sdkv2.EndpointParameters{ + Region: aws_sdkv2.String(region), }) if err != nil { return err.Error() } - url, _ := url.Parse(ep.URL) - - if url.Path == "" { - url.Path = "/" + if ep.URI.Path == "" { + ep.URI.Path = "/" } - return url.String() + return ep.URI.String() } func callService(ctx context.Context, t *testing.T, meta *conns.AWSClient) string { t.Helper() - client := meta.GlobalAcceleratorConn(ctx) - - req, _ := client.ListAcceleratorsRequest(&globalaccelerator_sdkv1.ListAcceleratorsInput{}) + var endpoint string - req.HTTPRequest.URL.Path = "/" + client := meta.GlobalAcceleratorClient(ctx) - endpoint := req.HTTPRequest.URL.String() + _, err := client.ListAccelerators(ctx, &globalaccelerator_sdkv2.ListAcceleratorsInput{}, + func(opts *globalaccelerator_sdkv2.Options) { + opts.APIOptions = append(opts.APIOptions, + addRetrieveEndpointURLMiddleware(t, &endpoint), + addCancelRequestMiddleware(), + ) + }, + ) + if err == nil { + t.Fatal("Expected an error, got none") + } else if !errors.Is(err, errCancelOperation) { + t.Fatalf("Unexpected error: %s", err) + } return endpoint } diff --git a/internal/service/globalaccelerator/tags_gen.go b/internal/service/globalaccelerator/tags_gen.go index e9974334e9e9..49aeeefe3623 100644 --- a/internal/service/globalaccelerator/tags_gen.go +++ b/internal/service/globalaccelerator/tags_gen.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/aws/aws-sdk-go/service/globalaccelerator/globalacceleratoriface" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/logging" @@ -19,12 +19,12 @@ import ( // listTags lists globalaccelerator service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. -func listTags(ctx context.Context, conn globalacceleratoriface.GlobalAcceleratorAPI, identifier string) (tftags.KeyValueTags, error) { +func listTags(ctx context.Context, conn *globalaccelerator.Client, identifier string, optFns ...func(*globalaccelerator.Options)) (tftags.KeyValueTags, error) { input := &globalaccelerator.ListTagsForResourceInput{ ResourceArn: aws.String(identifier), } - output, err := conn.ListTagsForResourceWithContext(ctx, input) + output, err := conn.ListTagsForResource(ctx, input, optFns...) if err != nil { return tftags.New(ctx, nil), err @@ -36,7 +36,7 @@ func listTags(ctx context.Context, conn globalacceleratoriface.GlobalAccelerator // ListTags lists globalaccelerator service tags and set them in Context. // It is called from outside this package. func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier string) error { - tags, err := listTags(ctx, meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx), identifier) + tags, err := listTags(ctx, meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx), identifier) if err != nil { return err @@ -52,11 +52,11 @@ func (p *servicePackage) ListTags(ctx context.Context, meta any, identifier stri // []*SERVICE.Tag handling // Tags returns globalaccelerator service tags. -func Tags(tags tftags.KeyValueTags) []*globalaccelerator.Tag { - result := make([]*globalaccelerator.Tag, 0, len(tags)) +func Tags(tags tftags.KeyValueTags) []awstypes.Tag { + result := make([]awstypes.Tag, 0, len(tags)) for k, v := range tags.Map() { - tag := &globalaccelerator.Tag{ + tag := awstypes.Tag{ Key: aws.String(k), Value: aws.String(v), } @@ -68,11 +68,11 @@ func Tags(tags tftags.KeyValueTags) []*globalaccelerator.Tag { } // KeyValueTags creates tftags.KeyValueTags from globalaccelerator service tags. -func KeyValueTags(ctx context.Context, tags []*globalaccelerator.Tag) tftags.KeyValueTags { +func KeyValueTags(ctx context.Context, tags []awstypes.Tag) tftags.KeyValueTags { m := make(map[string]*string, len(tags)) for _, tag := range tags { - m[aws.StringValue(tag.Key)] = tag.Value + m[aws.ToString(tag.Key)] = tag.Value } return tftags.New(ctx, m) @@ -80,7 +80,7 @@ func KeyValueTags(ctx context.Context, tags []*globalaccelerator.Tag) tftags.Key // getTagsIn returns globalaccelerator service tags from Context. // nil is returned if there are no input tags. -func getTagsIn(ctx context.Context) []*globalaccelerator.Tag { +func getTagsIn(ctx context.Context) []awstypes.Tag { if inContext, ok := tftags.FromContext(ctx); ok { if tags := Tags(inContext.TagsIn.UnwrapOrDefault()); len(tags) > 0 { return tags @@ -91,7 +91,7 @@ func getTagsIn(ctx context.Context) []*globalaccelerator.Tag { } // setTagsOut sets globalaccelerator service tags in Context. -func setTagsOut(ctx context.Context, tags []*globalaccelerator.Tag) { +func setTagsOut(ctx context.Context, tags []awstypes.Tag) { if inContext, ok := tftags.FromContext(ctx); ok { inContext.TagsOut = option.Some(KeyValueTags(ctx, tags)) } @@ -100,7 +100,7 @@ func setTagsOut(ctx context.Context, tags []*globalaccelerator.Tag) { // updateTags updates globalaccelerator service tags. // The identifier is typically the Amazon Resource Name (ARN), although // it may also be a different identifier depending on the service. -func updateTags(ctx context.Context, conn globalacceleratoriface.GlobalAcceleratorAPI, identifier string, oldTagsMap, newTagsMap any) error { +func updateTags(ctx context.Context, conn *globalaccelerator.Client, identifier string, oldTagsMap, newTagsMap any, optFns ...func(*globalaccelerator.Options)) error { oldTags := tftags.New(ctx, oldTagsMap) newTags := tftags.New(ctx, newTagsMap) @@ -111,10 +111,10 @@ func updateTags(ctx context.Context, conn globalacceleratoriface.GlobalAccelerat if len(removedTags) > 0 { input := &globalaccelerator.UntagResourceInput{ ResourceArn: aws.String(identifier), - TagKeys: aws.StringSlice(removedTags.Keys()), + TagKeys: removedTags.Keys(), } - _, err := conn.UntagResourceWithContext(ctx, input) + _, err := conn.UntagResource(ctx, input, optFns...) if err != nil { return fmt.Errorf("untagging resource (%s): %w", identifier, err) @@ -129,7 +129,7 @@ func updateTags(ctx context.Context, conn globalacceleratoriface.GlobalAccelerat Tags: Tags(updatedTags), } - _, err := conn.TagResourceWithContext(ctx, input) + _, err := conn.TagResource(ctx, input, optFns...) if err != nil { return fmt.Errorf("tagging resource (%s): %w", identifier, err) @@ -142,5 +142,5 @@ func updateTags(ctx context.Context, conn globalacceleratoriface.GlobalAccelerat // UpdateTags updates globalaccelerator service tags. // It is called from outside this package. func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { - return updateTags(ctx, meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx), identifier, oldTags, newTags) + return updateTags(ctx, meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx), identifier, oldTags, newTags) } From 4889af33e5df538fb7ef3b4f877231770c25cdd4 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 11:46:25 -0400 Subject: [PATCH 089/137] Run 'go get github.com/aws/aws-sdk-go-v2/service/globalaccelerator@v1.23.1 && go mod tidy'. --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index c28905da16a7..98d1c47a611b 100644 --- a/go.mod +++ b/go.mod @@ -89,6 +89,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/fis v1.24.2 github.com/aws/aws-sdk-go-v2/service/fms v1.31.4 github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4 + github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1 github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0 github.com/aws/aws-sdk-go-v2/service/healthlake v1.24.0 github.com/aws/aws-sdk-go-v2/service/iam v1.32.0 diff --git a/go.sum b/go.sum index 7094bb13a273..7e43fbff1036 100644 --- a/go.sum +++ b/go.sum @@ -198,6 +198,8 @@ github.com/aws/aws-sdk-go-v2/service/fms v1.31.4 h1:gY+Dp2QdphY6m5IVkETmsNauYztd github.com/aws/aws-sdk-go-v2/service/fms v1.31.4/go.mod h1:X4DjA4sm8cobhR9DtHn947+dLYxU1oWq3zwRZUmFSLo= github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4 h1:y0/RN8LwIbyDTPe/dnDBdsCw89ko8ZNFPW4vStye4aE= github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4/go.mod h1:8ofkOuh1SZLKR5EdfxPhQ1UgaQuCBAZzUwbeIBmeKIM= +github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1 h1:E48tPAIKptyIb8OFOAsZ3xSzjwou8A63f40ao1H3tVU= +github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1/go.mod h1:6morRSCgJD400qAu5DCEtvoaAC1owS5t6oq8ddLLwxw= github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0 h1:joAdQdtfg8Yy/e5Pq5qwAe0hjH3+EJUzd1jPrlXE3SA= github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0/go.mod h1:yGNTqdu48YxjsCyLpalmwHCQF52GGERK7+J3nTcvJ3A= github.com/aws/aws-sdk-go-v2/service/healthlake v1.24.0 h1:HRcwttYPNlE5mv6uDlcsk9m4oV3fxV8+a+V4U3jIMd4= From 7f685e8c1ada598a0cc181b14784aad2f75a5d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Silva?= Date: Tue, 23 Apr 2024 16:54:29 +0100 Subject: [PATCH 090/137] fix: remove go.mod and go.sum --- go.mod | 1 - go.sum | 2 -- 2 files changed, 3 deletions(-) diff --git a/go.mod b/go.mod index 3ffb86ca8881..3dd297e4ec21 100644 --- a/go.mod +++ b/go.mod @@ -137,7 +137,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.4 github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 - github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.4 diff --git a/go.sum b/go.sum index 191f628830d9..69a7d42e9c9d 100644 --- a/go.sum +++ b/go.sum @@ -304,8 +304,6 @@ github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 h1:znBjrg7qGF7DOXpJ1Z github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0/go.mod h1:RHFmC9Lds1jS1zBvnFq1GDh3yxFXH++n+2sI9TE53Cc= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 h1:Qb7EiHvGJZGU43aCMahEJrP5sJjV62gGXm4y9x/syRQ= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4/go.mod h1:8wjITSWOCR+G7DhS2WraZnZ/geFYxXLLP0KKTfZtRGQ= -github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 h1:on9+rCVnTcfYtz4i7sVsNuJYCAQO9xucyGtaWtlbIXY= -github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0/go.mod h1:tTj/YUqvGBhnxNh8gMjf31pSJF1L3STJwdPkjhSyl5I= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o= github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 h1:J6weNKyH2/bVlQ4dWpfprtIGf1tor3Ht5xurx+GXJjs= From 2b33949a61ba9d76198545d0051255812bee2d36 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 12:01:15 -0400 Subject: [PATCH 091/137] r/aws_globalaccelerator_accelerator: Migrate to AWS SDK for GO v2. --- .../service/globalaccelerator/accelerator.go | 126 +++++++++--------- .../globalaccelerator/accelerator_test.go | 45 +++---- .../service/globalaccelerator/exports_test.go | 2 + .../globalaccelerator/service_package_gen.go | 2 +- 4 files changed, 85 insertions(+), 90 deletions(-) diff --git a/internal/service/globalaccelerator/accelerator.go b/internal/service/globalaccelerator/accelerator.go index fda5db63211d..5125deaa3bc5 100644 --- a/internal/service/globalaccelerator/accelerator.go +++ b/internal/service/globalaccelerator/accelerator.go @@ -9,15 +9,17 @@ import ( "time" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" @@ -28,7 +30,7 @@ import ( // @SDKResource("aws_globalaccelerator_accelerator", name="Accelerator") // @Tags(identifierAttribute="id") -func ResourceAccelerator() *schema.Resource { +func resourceAccelerator() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceAcceleratorCreate, ReadWithoutTimeout: resourceAcceleratorRead, @@ -88,10 +90,10 @@ func ResourceAccelerator() *schema.Resource { Computed: true, }, "ip_address_type": { - Type: schema.TypeString, - Optional: true, - Default: globalaccelerator.IpAddressTypeIpv4, - ValidateFunc: validation.StringInSlice(globalaccelerator.IpAddressType_Values(), false), + Type: schema.TypeString, + Optional: true, + Default: awstypes.IpAddressTypeIpv4, + ValidateDiagFunc: enum.Validate[awstypes.IpAddressType](), }, "ip_addresses": { Type: schema.TypeList, @@ -136,8 +138,7 @@ func ResourceAccelerator() *schema.Resource { func resourceAcceleratorCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) name := d.Get("name").(string) input := &globalaccelerator.CreateAcceleratorInput{ @@ -148,37 +149,37 @@ func resourceAcceleratorCreate(ctx context.Context, d *schema.ResourceData, meta } if v, ok := d.GetOk("ip_address_type"); ok { - input.IpAddressType = aws.String(v.(string)) + input.IpAddressType = awstypes.IpAddressType(v.(string)) } if v, ok := d.GetOk("ip_addresses"); ok && len(v.([]interface{})) > 0 { - input.IpAddresses = flex.ExpandStringList(v.([]interface{})) + input.IpAddresses = flex.ExpandStringValueList(v.([]interface{})) } - output, err := conn.CreateAcceleratorWithContext(ctx, input) + output, err := conn.CreateAccelerator(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Accelerator (%s): %s", name, err) } - d.SetId(aws.StringValue(output.Accelerator.AcceleratorArn)) + d.SetId(aws.ToString(output.Accelerator.AcceleratorArn)) if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } if v, ok := d.GetOk("attributes"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input := expandUpdateAcceleratorAttributesInput(v.([]interface{})[0].(map[string]interface{})) input.AcceleratorArn = aws.String(d.Id()) - _, err := conn.UpdateAcceleratorAttributesWithContext(ctx, input) + _, err := conn.UpdateAcceleratorAttributes(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } } @@ -187,10 +188,9 @@ func resourceAcceleratorCreate(ctx context.Context, d *schema.ResourceData, meta func resourceAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) - - accelerator, err := FindAcceleratorByARN(ctx, conn, d.Id()) + accelerator, err := findAcceleratorByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator Accelerator (%s) not found, removing from state", d.Id()) @@ -212,7 +212,7 @@ func resourceAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("name", accelerator.Name) - acceleratorAttributes, err := FindAcceleratorAttributesByARN(ctx, conn, d.Id()) + acceleratorAttributes, err := findAcceleratorAttributesByARN(ctx, conn, d.Id()) if err != nil { return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Accelerator (%s) attributes: %s", d.Id(), err) @@ -227,8 +227,7 @@ func resourceAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta i func resourceAcceleratorUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) if d.HasChanges("name", "ip_address_type", "enabled") { input := &globalaccelerator.UpdateAcceleratorInput{ @@ -238,17 +237,17 @@ func resourceAcceleratorUpdate(ctx context.Context, d *schema.ResourceData, meta } if v, ok := d.GetOk("ip_address_type"); ok { - input.IpAddressType = aws.String(v.(string)) + input.IpAddressType = awstypes.IpAddressType(v.(string)) } - _, err := conn.UpdateAcceleratorWithContext(ctx, input) + _, err := conn.UpdateAccelerator(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Accelerator (%s): %s", d.Id(), err) } if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } } @@ -262,28 +261,28 @@ func resourceAcceleratorUpdate(ctx context.Context, d *schema.ResourceData, meta nInput.AcceleratorArn = aws.String(d.Id()) // To change flow logs bucket and prefix attributes while flows are enabled, first disable flow logs. - if aws.BoolValue(oInput.FlowLogsEnabled) && aws.BoolValue(nInput.FlowLogsEnabled) { + if aws.ToBool(oInput.FlowLogsEnabled) && aws.ToBool(nInput.FlowLogsEnabled) { oInput.FlowLogsEnabled = aws.Bool(false) - _, err := conn.UpdateAcceleratorAttributesWithContext(ctx, oInput) + _, err := conn.UpdateAcceleratorAttributes(ctx, oInput) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } } - _, err := conn.UpdateAcceleratorAttributesWithContext(ctx, nInput) + _, err := conn.UpdateAcceleratorAttributes(ctx, nInput) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } } } @@ -294,17 +293,16 @@ func resourceAcceleratorUpdate(ctx context.Context, d *schema.ResourceData, meta func resourceAcceleratorDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.UpdateAcceleratorInput{ AcceleratorArn: aws.String(d.Id()), Enabled: aws.Bool(false), } - _, err := conn.UpdateAcceleratorWithContext(ctx, input) + _, err := conn.UpdateAccelerator(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return diags } @@ -313,15 +311,15 @@ func resourceAcceleratorDelete(ctx context.Context, d *schema.ResourceData, meta } if _, err := waitAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", d.Id(), err) } log.Printf("[DEBUG] Deleting Global Accelerator Accelerator: %s", d.Id()) - _, err = conn.DeleteAcceleratorWithContext(ctx, &globalaccelerator.DeleteAcceleratorInput{ + _, err = conn.DeleteAccelerator(ctx, &globalaccelerator.DeleteAcceleratorInput{ AcceleratorArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return diags } @@ -332,7 +330,7 @@ func resourceAcceleratorDelete(ctx context.Context, d *schema.ResourceData, meta return diags } -func FindAcceleratorByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.Accelerator, error) { +func findAcceleratorByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.Accelerator, error) { input := &globalaccelerator.DescribeAcceleratorInput{ AcceleratorArn: aws.String(arn), } @@ -340,10 +338,10 @@ func FindAcceleratorByARN(ctx context.Context, conn *globalaccelerator.GlobalAcc return findAccelerator(ctx, conn, input) } -func findAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeAcceleratorInput) (*globalaccelerator.Accelerator, error) { - output, err := conn.DescribeAcceleratorWithContext(ctx, input) +func findAccelerator(ctx context.Context, conn *globalaccelerator.Client, input *globalaccelerator.DescribeAcceleratorInput) (*awstypes.Accelerator, error) { + output, err := conn.DescribeAccelerator(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -361,7 +359,7 @@ func findAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccelera return output.Accelerator, nil } -func FindAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.AcceleratorAttributes, error) { +func findAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.AcceleratorAttributes, error) { input := &globalaccelerator.DescribeAcceleratorAttributesInput{ AcceleratorArn: aws.String(arn), } @@ -369,10 +367,10 @@ func FindAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator return findAcceleratorAttributes(ctx, conn, input) } -func findAcceleratorAttributes(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeAcceleratorAttributesInput) (*globalaccelerator.AcceleratorAttributes, error) { - output, err := conn.DescribeAcceleratorAttributesWithContext(ctx, input) +func findAcceleratorAttributes(ctx context.Context, conn *globalaccelerator.Client, input *globalaccelerator.DescribeAcceleratorAttributesInput) (*awstypes.AcceleratorAttributes, error) { + output, err := conn.DescribeAcceleratorAttributes(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -390,9 +388,9 @@ func findAcceleratorAttributes(ctx context.Context, conn *globalaccelerator.Glob return output.AcceleratorAttributes, nil } -func statusAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) retry.StateRefreshFunc { +func statusAccelerator(ctx context.Context, conn *globalaccelerator.Client, arn string) retry.StateRefreshFunc { return func() (interface{}, string, error) { - accelerator, err := FindAcceleratorByARN(ctx, conn, arn) + accelerator, err := findAcceleratorByARN(ctx, conn, arn) if tfresource.NotFound(err) { return nil, "", nil @@ -402,21 +400,21 @@ func statusAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccele return nil, "", err } - return accelerator, aws.StringValue(accelerator.Status), nil + return accelerator, string(accelerator.Status), nil } } -func waitAcceleratorDeployed(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string, timeout time.Duration) (*globalaccelerator.Accelerator, error) { //nolint:unparam +func waitAcceleratorDeployed(ctx context.Context, conn *globalaccelerator.Client, arn string, timeout time.Duration) (*awstypes.Accelerator, error) { //nolint:unparam stateConf := &retry.StateChangeConf{ - Pending: []string{globalaccelerator.AcceleratorStatusInProgress}, - Target: []string{globalaccelerator.AcceleratorStatusDeployed}, + Pending: enum.Slice(awstypes.AcceleratorStatusInProgress), + Target: enum.Slice(awstypes.AcceleratorStatusDeployed), Refresh: statusAccelerator(ctx, conn, arn), Timeout: timeout, } outputRaw, err := stateConf.WaitForStateContext(ctx) - if output, ok := outputRaw.(*globalaccelerator.Accelerator); ok { + if output, ok := outputRaw.(*awstypes.Accelerator); ok { return output, err } @@ -445,7 +443,7 @@ func expandUpdateAcceleratorAttributesInput(tfMap map[string]interface{}) *globa return apiObject } -func flattenIPSet(apiObject *globalaccelerator.IpSet) map[string]interface{} { +func flattenIPSet(apiObject *awstypes.IpSet) map[string]interface{} { if apiObject == nil { return nil } @@ -453,17 +451,17 @@ func flattenIPSet(apiObject *globalaccelerator.IpSet) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.IpAddresses; v != nil { - tfMap["ip_addresses"] = aws.StringValueSlice(v) + tfMap["ip_addresses"] = v } if v := apiObject.IpFamily; v != nil { - tfMap["ip_family"] = aws.StringValue(v) + tfMap["ip_family"] = aws.ToString(v) } return tfMap } -func flattenIPSets(apiObjects []*globalaccelerator.IpSet) []interface{} { +func flattenIPSets(apiObjects []awstypes.IpSet) []interface{} { if len(apiObjects) == 0 { return nil } @@ -471,17 +469,13 @@ func flattenIPSets(apiObjects []*globalaccelerator.IpSet) []interface{} { var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenIPSet(apiObject)) + tfList = append(tfList, flattenIPSet(&apiObject)) } return tfList } -func flattenAcceleratorAttributes(apiObject *globalaccelerator.AcceleratorAttributes) map[string]interface{} { +func flattenAcceleratorAttributes(apiObject *awstypes.AcceleratorAttributes) map[string]interface{} { if apiObject == nil { return nil } @@ -489,15 +483,15 @@ func flattenAcceleratorAttributes(apiObject *globalaccelerator.AcceleratorAttrib tfMap := map[string]interface{}{} if v := apiObject.FlowLogsEnabled; v != nil { - tfMap["flow_logs_enabled"] = aws.BoolValue(v) + tfMap["flow_logs_enabled"] = aws.ToBool(v) } if v := apiObject.FlowLogsS3Bucket; v != nil { - tfMap["flow_logs_s3_bucket"] = aws.StringValue(v) + tfMap["flow_logs_s3_bucket"] = aws.ToString(v) } if v := apiObject.FlowLogsS3Prefix; v != nil { - tfMap["flow_logs_s3_prefix"] = aws.StringValue(v) + tfMap["flow_logs_s3_prefix"] = aws.ToString(v) } return tfMap diff --git a/internal/service/globalaccelerator/accelerator_test.go b/internal/service/globalaccelerator/accelerator_test.go index 30e73e9554c0..53e7aceb61f8 100644 --- a/internal/service/globalaccelerator/accelerator_test.go +++ b/internal/service/globalaccelerator/accelerator_test.go @@ -11,7 +11,9 @@ import ( "testing" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -331,11 +333,11 @@ func TestAccGlobalAcceleratorAccelerator_tags(t *testing.T) { } func testAccPreCheck(ctx context.Context, t *testing.T) { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListAcceleratorsInput{} - _, err := conn.ListAcceleratorsWithContext(ctx, input) + _, err := conn.ListAccelerators(ctx, input) if acctest.PreCheckSkipError(err) { t.Skipf("skipping acceptance testing: %s", err) @@ -355,19 +357,24 @@ func testAccCheckBYOIPExists(ctx context.Context, t *testing.T) { parsedAddr := net.ParseIP(requestedAddr) - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListByoipCidrsInput{} - cidrs := make([]*globalaccelerator.ByoipCidr, 0) + cidrs := make([]awstypes.ByoipCidr, 0) - err := conn.ListByoipCidrsPagesWithContext(ctx, input, - func(page *globalaccelerator.ListByoipCidrsOutput, lastPage bool) bool { - cidrs = append(cidrs, page.ByoipCidrs...) - return !lastPage - }) + pages := globalaccelerator.NewListByoipCidrsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) - if acctest.PreCheckSkipError(err) { - t.Skipf("skipping acceptance testing: %s", err) + if acctest.PreCheckSkipError(err) { + t.Skipf("skipping acceptance testing: %s", err) + } + + if err != nil { + t.Fatalf("unexpected PreCheck error: %s", err) + } + + cidrs = append(cidrs, page.ByoipCidrs...) } if len(cidrs) == 0 { @@ -377,7 +384,7 @@ func testAccCheckBYOIPExists(ctx context.Context, t *testing.T) { matches := false for _, cidr := range cidrs { - _, network, _ := net.ParseCIDR(*cidr.Cidr) + _, network, _ := net.ParseCIDR(aws.ToString(cidr.Cidr)) if network.Contains(parsedAddr) { matches = true break @@ -387,24 +394,16 @@ func testAccCheckBYOIPExists(ctx context.Context, t *testing.T) { if !matches { t.Skipf("skipping acceptance testing: requested address %s not available via BYOIP", requestedAddr) } - - if err != nil { - t.Fatalf("unexpected PreCheck error: %s", err) - } } func testAccCheckAcceleratorExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Accelerator ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) _, err := tfglobalaccelerator.FindAcceleratorByARN(ctx, conn, rs.Primary.ID) @@ -414,7 +413,7 @@ func testAccCheckAcceleratorExists(ctx context.Context, n string) resource.TestC func testAccCheckAcceleratorDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_accelerator" { diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index 4d8047be5150..d341722a046c 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -5,7 +5,9 @@ package globalaccelerator // Exports for use in tests only. var ( + ResourceAccelerator = resourceAccelerator ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + FindAcceleratorByARN = findAcceleratorByARN FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN ) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 0c976a0672f6..ce15945e6793 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePackageSDKResource { return []*types.ServicePackageSDKResource{ { - Factory: ResourceAccelerator, + Factory: resourceAccelerator, TypeName: "aws_globalaccelerator_accelerator", Name: "Accelerator", Tags: &types.ServicePackageResourceTags{ From 90f2093ff6da795e7312c2d3811f18c6ea9e08e8 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 23 Apr 2024 11:30:37 -0500 Subject: [PATCH 092/137] make gen --- go.mod | 3 +- go.sum | 303 +------------------------------- internal/conns/awsclient_gen.go | 9 - 3 files changed, 4 insertions(+), 311 deletions(-) diff --git a/go.mod b/go.mod index cd7197088a54..3cfe47c0df7d 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/appconfig v1.29.2 github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4 github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4 + github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4 github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4 github.com/aws/aws-sdk-go-v2/service/athena v1.40.4 github.com/aws/aws-sdk-go-v2/service/auditmanager v1.32.4 @@ -284,4 +285,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/hashicorp/terraform-plugin-log => github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb \ No newline at end of file +replace github.com/hashicorp/terraform-plugin-log => github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb diff --git a/go.sum b/go.sum index de90bf226137..d3feee6d7c04 100644 --- a/go.sum +++ b/go.sum @@ -42,306 +42,6 @@ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3C github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -<<<<<<< HEAD -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.4 h1:SIkD6T4zGQ+1YIit22wi37CGNkrE7mXV1vNA5VpI3TI= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.4/go.mod h1:XfeqbsG0HNedNs0GT+ju4Bs+pFAwsrlzcRdMvdNVf5s= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.0 h1:79JqmS9IHHK2GehZ/3lleA9qZduEdAiDPpm65G3sC3Q= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.0/go.mod h1:MR0MHfFVMib39bwmwRkPWB/3GrGK47kK3/QRvWh1iwU= -github.com/aws/aws-sdk-go-v2/service/account v1.16.3 h1:naZ+3ZZa/j5c7N25vCII8ZHWFhNMnzy2KBJEXRM/BMs= -github.com/aws/aws-sdk-go-v2/service/account v1.16.3/go.mod h1:QBT5/WHp07EA3HgT/Wg3qVpL9baYpqaLl6XWSH18ntk= -github.com/aws/aws-sdk-go-v2/service/acm v1.25.3 h1:AH94I88C4CPMp6YOTncdshON5hsyBDWUAM/FBAHHkco= -github.com/aws/aws-sdk-go-v2/service/acm v1.25.3/go.mod h1:hFOyylMVlIkhN7YLhv64oBZzVTJoi8bqhJZfkDVlZww= -github.com/aws/aws-sdk-go-v2/service/amp v1.25.3 h1:GkOnnt0ItVXnvo7xt1/+XJkzB6q1NAa80cLn7KkQd50= -github.com/aws/aws-sdk-go-v2/service/amp v1.25.3/go.mod h1:FUrdgK1jyv01Q1DjpW6MWjA/ZEuTRphMLdkqtLTBXq0= -github.com/aws/aws-sdk-go-v2/service/appconfig v1.29.1 h1:AtkGG+t4U+Mb7sR2lQj/uvDlbdA7GVAIv8o/AAnS+vk= -github.com/aws/aws-sdk-go-v2/service/appconfig v1.29.1/go.mod h1:I5x1yMmMf/5Igkyxa8dm4uXuIBhWVkBpbcXDR9ypAdU= -github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.3 h1:1eZup6prjncUlZrUcLhRxhMIHwTaioF1XMfwzqkIe3M= -github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.3/go.mod h1:rez9BC+738QMML4jQ7spSMQDF2MmIvyZmfeOSdiUvTE= -github.com/aws/aws-sdk-go-v2/service/appflow v1.41.3 h1:tK9duUSGFRz/8nshXYyddbw2S7xkVSO0S7nOoUbRW/4= -github.com/aws/aws-sdk-go-v2/service/appflow v1.41.3/go.mod h1:D08dEVi5M9I0qAIl1IyMydjFQPcjQqCp2Mw3WqhCDbQ= -github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.3 h1:rri9+f2A76jTOKtutUNMW8ykCR9/krxzUL/pV6fCnT8= -github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.3/go.mod h1:DQh97NocTwdqG8YCRfEr8WzDNfzvTbtByPV9qKLePHc= -github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.3 h1:nby4wV20qfVF2yswXCFKL7lTkddNvYUj2P9+k/UbYQc= -github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.3/go.mod h1:ECUaiPa9O5LwqgVNeBduNwayctvWkc5nb8NdBLmLJ00= -github.com/aws/aws-sdk-go-v2/service/athena v1.40.3 h1:Q54tyTwpoEyJNmP4WqwT9hdPHpbpNahvcW9so6lItQw= -github.com/aws/aws-sdk-go-v2/service/athena v1.40.3/go.mod h1:HP/WmaAcHBNMHa6EwxTMPdqCIbV0uCnWR8WNTp2AG5c= -github.com/aws/aws-sdk-go-v2/service/auditmanager v1.32.3 h1:Y9Tqv+Pb93GGLpxYoKYdz9ZdwpnT5HP6AFazR3moNlM= -github.com/aws/aws-sdk-go-v2/service/auditmanager v1.32.3/go.mod h1:iKupmNJ2eciB82e13iVV0Yy0RF3rEYwnWvjOFS8gwSo= -github.com/aws/aws-sdk-go-v2/service/batch v1.35.1 h1:0s/EA1gzCbGc3QJPFKtkQSZthqKAtjTQ9KZK8vdq6MY= -github.com/aws/aws-sdk-go-v2/service/batch v1.35.1/go.mod h1:6wZ9nLiDKN23ZIR+JFkBT2ja8ptpN0+GXc468eb6pz8= -github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.3 h1:7eWSY1WH9QwOhynO1q7FeTiQmlDuDuA4U3aVnzJuwlI= -github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.3/go.mod h1:oKzsmy0T0tnOwivf+uLOQi0HiZMVHFjkvdDSXJgzI6w= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.4.3 h1:PyHPzIUfK0hqgisQStSSv6B6pxMD3u0glzqxX4hpu7E= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.4.3/go.mod h1:dZI35YHA0eH/XivJRXI0rh9dtI5W7bfPcbNoo6cxRlw= -github.com/aws/aws-sdk-go-v2/service/budgets v1.22.3 h1:8/EAWsRzln7yZ8XjKm4eDizPz+SIaZ83CZRsl4hGsgM= -github.com/aws/aws-sdk-go-v2/service/budgets v1.22.3/go.mod h1:tLE9xTrWczkC/4JKSTmoFMdO+sRVOdc78mSLEDdsMd4= -github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.3 h1:cnaPPuP1Vibm0S6NrAw3uLsyUHHTN9MZBifCPiM2KM4= -github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.3/go.mod h1:Bwt+CNMRVQxCEzfqVJB4eJjedEYzyPk7zIkbzG6uxMw= -github.com/aws/aws-sdk-go-v2/service/chimesdkvoice v1.14.3 h1:mEnRQhdLEDhkd8nxv1OQZtVXw3ebWfUOVcPnXyRNKiQ= -github.com/aws/aws-sdk-go-v2/service/chimesdkvoice v1.14.3/go.mod h1:QcyoLDnm8ovYqTHaF/Fuuinxs6gOh2Z8eJIhY2vvR4Y= -github.com/aws/aws-sdk-go-v2/service/cleanrooms v1.10.3 h1:f5xS8vcBOOTFOee23wU0nGFO65wwhh7PnBBzF/iYeDg= -github.com/aws/aws-sdk-go-v2/service/cleanrooms v1.10.3/go.mod h1:/2C7uqJuxa0SeMiXN1H+EnnMxOaPdZgbigaRdeentb0= -github.com/aws/aws-sdk-go-v2/service/cloud9 v1.24.3 h1:8W6VrHEMkRpzc64MM6r32zhn6uDAJsxVHw47afTscPg= -github.com/aws/aws-sdk-go-v2/service/cloud9 v1.24.3/go.mod h1:Zr6iQzGtPscHSHQu8+vqeWf9LyENvOcc19Ttq2qESbw= -github.com/aws/aws-sdk-go-v2/service/cloudcontrol v1.18.3 h1:efZWsCqUWLroETjWqv08axRjRPtX9ZpAAnuNJ4AYLwY= -github.com/aws/aws-sdk-go-v2/service/cloudcontrol v1.18.3/go.mod h1:gKnz42e0bo0dYqZsk9Uk+ykN1u+R8pCyoWf7tzIEUl4= -github.com/aws/aws-sdk-go-v2/service/cloudfront v1.35.3 h1:6CGEqYI+Pk54q7QzAntKHpjgsXHd5RdSqorunawd0dQ= -github.com/aws/aws-sdk-go-v2/service/cloudfront v1.35.3/go.mod h1:ewTOi8Y1rphZPKwdCtsAbDBvtWVXGgqhb7Z+7IPCmiE= -github.com/aws/aws-sdk-go-v2/service/cloudfrontkeyvaluestore v1.4.3 h1:R4Ce0J/4haaaHn+V2bPL89ejVt+1B+11lj0ie/tHPSM= -github.com/aws/aws-sdk-go-v2/service/cloudfrontkeyvaluestore v1.4.3/go.mod h1:isSK3RhAAr1BhkdSpcoZk8uAB5BSiQR1rpwFp+v6LMM= -github.com/aws/aws-sdk-go-v2/service/cloudhsmv2 v1.21.3 h1:0nDMjpPvgniFtGYvdYb0p2jjlZPzvPWK9K3AwN4yjug= -github.com/aws/aws-sdk-go-v2/service/cloudhsmv2 v1.21.3/go.mod h1:CGI7hj1IeGLfAzMngsAiv9E6z+SY2hDm5V9VFRyuj2U= -github.com/aws/aws-sdk-go-v2/service/cloudsearch v1.22.3 h1:BgEpzcdRjRGoWDXCzDcC9xEyIYQB3ybiOHvcT453nco= -github.com/aws/aws-sdk-go-v2/service/cloudsearch v1.22.3/go.mod h1:CS0qLkXNeycRTC77ESg6FkaD37NWzI9cZV5Vi8wTCbg= -github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.39.1 h1:3gmWxPT3URe8Yswfm0uiyqURRat8P7Gxv9SFSN0KOxY= -github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.39.1/go.mod h1:d6xG6uOYwvPcLfgAqYVYJziH1kO2xwaNlReUk2jJeyQ= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.36.3 h1:l3vM7tnmYWZBdyN1d2Q4gTCnDNbwKNtns4oCFt0zfQk= -github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.36.3/go.mod h1:xeAHc7vhdOYwpG2t4uXdnGhOvOIpJ8n+A5AHnCkk8iw= -github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.35.0 h1:Tpy3mOh9ladwf9bhlAr38OTnZk/Uh9UuN4UNg3MFB/U= -github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.35.0/go.mod h1:bIFyamdY1PRTmifPT7uHCq4+af0SooBn9hmK9UW/hmg= -github.com/aws/aws-sdk-go-v2/service/codeartifact v1.26.0 h1:pd4MCOXxIABkJZhnst/sNvjCDXgcT7hqDjhBYDbEmjA= -github.com/aws/aws-sdk-go-v2/service/codeartifact v1.26.0/go.mod h1:SiTynZd9Y6kyyetSwU9wS3PVo8LxVusPlebMU0hzxSY= -github.com/aws/aws-sdk-go-v2/service/codebuild v1.31.2 h1:o9NWkmCGK0BfbXpuiIUGcgv5XlEcrDohqwepyFqrF7U= -github.com/aws/aws-sdk-go-v2/service/codebuild v1.31.2/go.mod h1:r+u4e5jkfeCLiTUKMNunJPiRV3j+uJD9TL5KBRAXy8A= -github.com/aws/aws-sdk-go-v2/service/codecatalyst v1.12.3 h1:AJouQBGP960Xv2awBeJ0NgZaatMe3eIP2hCeTT2j544= -github.com/aws/aws-sdk-go-v2/service/codecatalyst v1.12.3/go.mod h1:dE9FjOfKWN/Dm8sB1PKV6bz/CPZClhkHybyicrtOqKA= -github.com/aws/aws-sdk-go-v2/service/codecommit v1.22.3 h1:JFEGvOVTxk+i56BjRVrICK5N1F0qbsJcSVwbc+M8hJM= -github.com/aws/aws-sdk-go-v2/service/codecommit v1.22.3/go.mod h1:2ZAZDXxpDWKehKwbyHzcgcIuy8iPmP8xNU5l+s3Uq/A= -github.com/aws/aws-sdk-go-v2/service/codedeploy v1.25.3 h1:xDuKrOzcKpKPbk9r5m79n5IU/FKoYN1FJYDkdxx/TXU= -github.com/aws/aws-sdk-go-v2/service/codedeploy v1.25.3/go.mod h1:Tqpjpv1Ruwsa3zlHEjLDMegvbTIMd5GT3uaCGgD0nDg= -github.com/aws/aws-sdk-go-v2/service/codeguruprofiler v1.20.3 h1:px6/RhwAO4Fhg3Q4ydoiDr0zetodKOJXjDUsSFIrqaw= -github.com/aws/aws-sdk-go-v2/service/codeguruprofiler v1.20.3/go.mod h1:3G6Rpcj1aRMYCHhbu9kjPdd+nAABzBNhDfFd0npFcbk= -github.com/aws/aws-sdk-go-v2/service/codegurureviewer v1.25.3 h1:eBiFunqYRhdxenw2ZEidumT10FJ7n8w0QiThP7zOZ9s= -github.com/aws/aws-sdk-go-v2/service/codegurureviewer v1.25.3/go.mod h1:2Sqr/dVb/Vr/uiW2zhjf5z5jHRbmwgSq2pUmYu8JUkY= -github.com/aws/aws-sdk-go-v2/service/codepipeline v1.26.3 h1:BtXeRsAxgdthQaKn9VCh+e1rsxbvLCfKwK0royTT+C8= -github.com/aws/aws-sdk-go-v2/service/codepipeline v1.26.3/go.mod h1:uHhcT9a9JC7/5Ukpyg2fsa08JMv4j3apCp/Ac7KMwjs= -github.com/aws/aws-sdk-go-v2/service/codestarconnections v1.25.1 h1:btguNb5RveHI5oLGyGzHGuxJM72ulbj/vMJDSJx5JbY= -github.com/aws/aws-sdk-go-v2/service/codestarconnections v1.25.1/go.mod h1:2NIVa/f2TKEoCIabItm/y9Tb3VvGl0qLH6DhR1eW0vo= -github.com/aws/aws-sdk-go-v2/service/codestarnotifications v1.22.3 h1:M1ilNZMHC/urX3uMsvpsy8NKrTZiWj2Ms30b6sSSWh0= -github.com/aws/aws-sdk-go-v2/service/codestarnotifications v1.22.3/go.mod h1:BSyhC9VhMZgkyhpuNGwZBtYwkRYV7wEd6boEKImMQaw= -github.com/aws/aws-sdk-go-v2/service/cognitoidentity v1.23.4 h1:KuN2GQBLzac3PdhsVBt7n11jKfRsXg0OZSuuizF+yNw= -github.com/aws/aws-sdk-go-v2/service/cognitoidentity v1.23.4/go.mod h1:OnFArLhSkVvZjmlx3wiYir/O44gpEerCXPJbK+LQBSE= -github.com/aws/aws-sdk-go-v2/service/comprehend v1.31.3 h1:d92Iw9lJyi2MyOiGwdCIxr36lAozRoOqZ3bdmLx2I2s= -github.com/aws/aws-sdk-go-v2/service/comprehend v1.31.3/go.mod h1:4BFydizu/IyGzEHv4tW8RQSa52Zv8GGSCqjw0zQdiOE= -github.com/aws/aws-sdk-go-v2/service/computeoptimizer v1.33.3 h1:S6FLJZYwSOcJfqLednxDqvUBMaYNRbXJRrw4RsBjqvI= -github.com/aws/aws-sdk-go-v2/service/computeoptimizer v1.33.3/go.mod h1:ydOoYIRwIGsjORuU7sJ/RfSh+BjDD50Npls2N098Je0= -github.com/aws/aws-sdk-go-v2/service/configservice v1.46.3 h1:rxZv7fqz593Yvidy5GAFo8f0VbaacgYMejyUwYZvnqs= -github.com/aws/aws-sdk-go-v2/service/configservice v1.46.3/go.mod h1:6d3HjJwLffS4M2jTahQ8IuKJDukJuLTVN8T2X1N7Vsk= -github.com/aws/aws-sdk-go-v2/service/connectcases v1.15.3 h1:L95GltoDtewMcFq15o/6ENVmhrvnbNtPvcrkOBe3lnE= -github.com/aws/aws-sdk-go-v2/service/connectcases v1.15.3/go.mod h1:TyZr6RqRlR3hKsh1y1XfbY7+4NRvp3SgMFzxBk1K3Us= -github.com/aws/aws-sdk-go-v2/service/controltower v1.13.3 h1:SG3sGG6K3N6tPMVeJBe98Zx0aXfTZlBDhHn6F0Nqof0= -github.com/aws/aws-sdk-go-v2/service/controltower v1.13.3/go.mod h1:/MVyYMNxCYw1fGAIjcMc4N/gmTfJusFugrFKiKrW1Pw= -github.com/aws/aws-sdk-go-v2/service/costoptimizationhub v1.4.3 h1:nCnaWjpCuKpcvUjnS/xuZTYPNUIWyyDB+br1muzA7Xk= -github.com/aws/aws-sdk-go-v2/service/costoptimizationhub v1.4.3/go.mod h1:GgMyAMEjKSWEMqwTkesHtHygbeh6aKyeGtkJC2XBQNc= -github.com/aws/aws-sdk-go-v2/service/customerprofiles v1.36.3 h1:8akKwsfPSXuuva2PtFOGEJMS/yBOqzt45a7+fiDStEg= -github.com/aws/aws-sdk-go-v2/service/customerprofiles v1.36.3/go.mod h1:poSn2Rf3sIZq4o9HFUXF9SFIANrNmdMpK5tsCVI5N34= -github.com/aws/aws-sdk-go-v2/service/dax v1.19.3 h1:nBFeHXBmuicno0/3gV/QeKEJL2+PKTOk+ISrk7DNNjU= -github.com/aws/aws-sdk-go-v2/service/dax v1.19.3/go.mod h1:jPAOa4SFhgbTLdzZ77wuLjXHRjQCobtSZIbAcjttpZ0= -github.com/aws/aws-sdk-go-v2/service/devopsguru v1.30.3 h1:GdBBQ5f3MFBlwpOHxHKECfLI879O3jwn/yfsJqPH8ds= -github.com/aws/aws-sdk-go-v2/service/devopsguru v1.30.3/go.mod h1:rGRbtfaa3ovXyun9VNPEvBY4gTkQ7u1F0aMV6LOR/RE= -github.com/aws/aws-sdk-go-v2/service/directoryservice v1.24.3 h1:akRnreh7ecjD8/INMWUbD3hyqZ5CioCuZz5ExCfHvew= -github.com/aws/aws-sdk-go-v2/service/directoryservice v1.24.3/go.mod h1:PCEpTemK0GzMPif0G1hAoRlDkmLOpAKZFTntx5bTHDM= -github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.9.2 h1:mNuCgv1+9HaWNrU24TVwf5E0ZlH1WVJQ6gFtLAT+lzE= -github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.9.2/go.mod h1:18sgErGtZi/o6ITt8+eWIejU0VyIqOn7eJX6lCl3BnQ= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.0 h1:LtsNRZ6+ZYIbJcPiLHcefXeWkw2DZT9iJyXJJQvhvXw= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.0/go.mod h1:ua1eYOCxAAT0PUY3LAi9bUFuKJHC/iAksBLqR1Et7aU= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.152.0 h1:ltCQObuImVYmIrMX65ikB9W83MEun3Ry2Sk11ecZ8Xw= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.152.0/go.mod h1:TeZ9dVQzGaLG+SBIgdLIDbJ6WmfFvksLeG3EHGnNfZM= -github.com/aws/aws-sdk-go-v2/service/ecr v1.27.3 h1:gfgt0D8MGL3gHrJPEv4rcWptA4Nz7uYn25ls8lLiANw= -github.com/aws/aws-sdk-go-v2/service/ecr v1.27.3/go.mod h1:O5Fvd41s5KfDG093xLM7FhGiH6EmhmEli5D5MQH3TWw= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.3 h1:gaq/4fd2/bQeJ33m4csgL7DJHrrmvGhqnrsxchNr46c= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.3/go.mod h1:vn+Rz9fAFGJtDXbBmYdTc71Q8iF/W/uK1/ec93hinD8= -github.com/aws/aws-sdk-go-v2/service/ecs v1.41.3 h1:lMtV6j7HE9vpJ+rCXbjfKYuM0lVQVWOYGn6zxy0OvEQ= -github.com/aws/aws-sdk-go-v2/service/ecs v1.41.3/go.mod h1:7b5ZXNyT7SjZhy+MOuXwL2XtsrFDl1bOL4Mqrgr5c3k= -github.com/aws/aws-sdk-go-v2/service/eks v1.41.2 h1:0X5g5H8YyW9QVtlp6j+ZGHl/h0ZS58jiLRXabyiB5uw= -github.com/aws/aws-sdk-go-v2/service/eks v1.41.2/go.mod h1:T2MBMUUCoSEvHuKPplubyQJbWNghbHhx3ToJpLoipDs= -github.com/aws/aws-sdk-go-v2/service/elasticache v1.37.4 h1:a86Pz2dmS3KwpHTXvipg5hX5wgWtzb1th8t9fAzdZCA= -github.com/aws/aws-sdk-go-v2/service/elasticache v1.37.4/go.mod h1:S/K/QIhqH+2hwikH4SctnR8QhKvaljcPZ6GdcjmFXSk= -github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.23.3 h1:JJ5sred8R2EHH0wwShEHY1yy7Vl7aYu7RkAw/lmGgNU= -github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.23.3/go.mod h1:Q9T8IxdX1JMwax432uDRWaFhG+abLbs20oLtizL2Wxo= -github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.4 h1:Lq2q/AWzFv5jHVoGJ2Hz1PkxwHYNdGzAB3lbw2g7IEU= -github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.4/go.mod h1:SNhjWOsnsHSveL4fDQL0sDiAIMVnKrvJTp9Z/MNspx0= -github.com/aws/aws-sdk-go-v2/service/emr v1.39.3 h1:5dh5/uBMDJZ095pyo8J9Iq6eO+spYSpBxIht3zHSDJE= -github.com/aws/aws-sdk-go-v2/service/emr v1.39.3/go.mod h1:1XQMB8mMwEgJ/PiqHYroypNRmntlxC4S6Si9s/e6MBg= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.17.4 h1:Sel4bhQsqWJpMpS7phMkKKraPblDQO7A7LcNUdEfYaU= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.17.4/go.mod h1:Lqyi+jrynf2YmFnPAGX/QV0E03GPevxTO4ZF8K+9WKE= -github.com/aws/aws-sdk-go-v2/service/evidently v1.19.3 h1:I5aDPbhOCXW1ghm+jVn3w7OyUJ5ibGxJk1Ztn19nzGc= -github.com/aws/aws-sdk-go-v2/service/evidently v1.19.3/go.mod h1:OdJAuOKSBvgWd7IPPt1mhFcZMrWKHxvkiaCk1baayl0= -github.com/aws/aws-sdk-go-v2/service/finspace v1.23.0 h1:hzIP5bmFE3zz9fhnOFj9Q8ygOOpQQeZtg7Zsaq5RcFg= -github.com/aws/aws-sdk-go-v2/service/finspace v1.23.0/go.mod h1:jcWNHj8/0TSarVAPO/wMLr4PqVW7wLZ9IklE0JFTgdQ= -github.com/aws/aws-sdk-go-v2/service/firehose v1.28.3 h1:WitDVXj+2Ljpr9rpcB9PU+rW2cKDNeOEohXcYlq82zk= -github.com/aws/aws-sdk-go-v2/service/firehose v1.28.3/go.mod h1:lG0iZ1i9pDmHwZzPwt62ek5F+IURxddbra2KWidu11s= -github.com/aws/aws-sdk-go-v2/service/fis v1.24.1 h1:jXrNT8HEz8Z2DuXq+aToU9gdVDi5Pw4NwVUvfMOzHoM= -github.com/aws/aws-sdk-go-v2/service/fis v1.24.1/go.mod h1:altCNtz8BV8tQDXkT6dlIO2FlFsiwwHkELYDa2o4YCs= -github.com/aws/aws-sdk-go-v2/service/glacier v1.22.3 h1:2uNAuva/9zAQpa7nkASJupbhSOa+LLbi1rrM9Z9tfVM= -github.com/aws/aws-sdk-go-v2/service/glacier v1.22.3/go.mod h1:MrAlFtG1NbT8Bf9+qVI+Ui0D0IPMCm2JNRyUIr2QGnw= -github.com/aws/aws-sdk-go-v2/service/groundstation v1.26.3 h1:yR2tgroW8Ghgvfwn0PchQ0xTvCJU2P8Ik1+ig+nNtRg= -github.com/aws/aws-sdk-go-v2/service/groundstation v1.26.3/go.mod h1:cyYwH67rMNZMRp/eQ3vEZHpmkL3dpBFnigQKQnUrS3k= -github.com/aws/aws-sdk-go-v2/service/healthlake v1.23.3 h1:1EG6+DMRWZ9A6DEWelJA3fv3TDYyfChcTd/wTmlduzg= -github.com/aws/aws-sdk-go-v2/service/healthlake v1.23.3/go.mod h1:f2dN3a+I23UaZU5sMmrjsDjw8EmtSc/TL8XExaLj11Q= -github.com/aws/aws-sdk-go-v2/service/iam v1.31.3 h1:cJn9Snros9WmDA7/qCCN7jSkowcu1CqnwhFpv4ipHEE= -github.com/aws/aws-sdk-go-v2/service/iam v1.31.3/go.mod h1:+nAQlxsBxPFf6GrL93lvCuv5PxSTX3GO0RYrURyzl/Q= -github.com/aws/aws-sdk-go-v2/service/identitystore v1.23.4 h1:uFCRJd83qt/tN84xGLx/qI0AzfBczU1hKwXPHJhP0Ls= -github.com/aws/aws-sdk-go-v2/service/identitystore v1.23.4/go.mod h1:mb8GFnE31DX2yTwm5eRutF6tONGrpQW/9kiCKzsD2GU= -github.com/aws/aws-sdk-go-v2/service/inspector2 v1.24.3 h1:OcgV2rv7owA599Yw4IMvNf6KKnIcY0zmgLigPEwKnvs= -github.com/aws/aws-sdk-go-v2/service/inspector2 v1.24.3/go.mod h1:in5ayFJZfJpbeZm7szs/mRM+jGtWSlPVOGCU73ponpM= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.6 h1:NkHCgg0Ck86c5PTOzBZ0JRccI51suJDg5lgFtxBu1ek= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.6/go.mod h1:mjTpxjC8v4SeINTngrnKFgm2QUi+Jm+etTbCxh8W4uU= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.5 h1:4vkDuYdXXD2xLgWmNalqH3q4u/d1XnaBMBXdVdZXVp0= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.5/go.mod h1:Ko/RW/qUJyM1rdTzZa74uhE2I0t0VXH0ob/MLcc+q+w= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.4 h1:uDj2K47EM1reAYU9jVlQ1M5YENI1u6a/TxJpf6AeOLA= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.4/go.mod h1:XKCODf4RKHppc96c2EZBGV/oCUC7OClxAo2MEyg4pIk= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.12.3 h1:eDn9J7biTG3WZhLWJa7cofNzjrQilW5QyKrMTCMxw2g= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.12.3/go.mod h1:mI9vzNRjhMvYmPD3Yl/74QdDMGyB6QE+msnFXBE5ahs= -github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.3 h1:0iTKT43YbjxkfLWpDy53XNpX7LLa+23Z0RA8idMSa1g= -github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.3/go.mod h1:9KYRjzfuA+yQ94Z76xtyXijr6IAzSe7c4LPNgJ6RaHE= -github.com/aws/aws-sdk-go-v2/service/kafka v1.31.1 h1:kgmN23latoCf5DU+se+7yvaLFafN01wcFqH22/xw9xE= -github.com/aws/aws-sdk-go-v2/service/kafka v1.31.1/go.mod h1:OdramNEwVCr+Km5x6sY48EZfhMRi63Df3lMiFwq4r2o= -github.com/aws/aws-sdk-go-v2/service/kendra v1.49.3 h1:F40g16YlLu4QQEd75irG17VZBj8g1V7MiGJ7Ucv4DyI= -github.com/aws/aws-sdk-go-v2/service/kendra v1.49.3/go.mod h1:PO/o18WNjfiJ9gwAedE3e7W3YOhOT8uLLP0OZErG4sg= -github.com/aws/aws-sdk-go-v2/service/keyspaces v1.10.3 h1:0ZinUG7sHKMNsZ6s6x3ZwjZeBhs1fHpNpvgDp06JSEU= -github.com/aws/aws-sdk-go-v2/service/keyspaces v1.10.3/go.mod h1:eaMHeHF8TbqE03Fbp+6zo4FN2HZWHyRxHfsIFhtUCeQ= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.3 h1:F6ZNgFuVyS5c5XX/hzZOvCaU1s0lClTBOjALo4YZX+0= -github.com/aws/aws-sdk-go-v2/service/kinesis v1.27.3/go.mod h1:ysLqYFh1A4ozKdp9t7WF0xZGPh2Xc9OC7rTjNALEwXg= -github.com/aws/aws-sdk-go-v2/service/lakeformation v1.31.4 h1:npYyhH9faWy0hJc7QbB+IW0RTzWyFEMIkrLxLwP5CZo= -github.com/aws/aws-sdk-go-v2/service/lakeformation v1.31.4/go.mod h1:Bkyx5nGVUbQS7L5WyULc9FNoy0LtYZVl8MmnR/rgBy8= -github.com/aws/aws-sdk-go-v2/service/lambda v1.53.3 h1:KsKBuL+bIKhY7SMk+MXSBAj8PLHsTqlU2d0px98azyI= -github.com/aws/aws-sdk-go-v2/service/lambda v1.53.3/go.mod h1:trTURvQC8AJ41JYhFpVrZKY5tfzGgVUcSijVgfmgl8w= -github.com/aws/aws-sdk-go-v2/service/launchwizard v1.3.3 h1:1+rqC0UyxvWiqiMI0/K86l/LSMdwUbCCMnkEqqvhZBc= -github.com/aws/aws-sdk-go-v2/service/launchwizard v1.3.3/go.mod h1:QI/5bbibfVs8G/DQCwcD5h/SINPE6jIoqX+wyi0cJF8= -github.com/aws/aws-sdk-go-v2/service/lexmodelsv2 v1.43.2 h1:qIsU6de8m9Q69WkJyIeSCxLnewFUgEk9JoV0eNgVG/U= -github.com/aws/aws-sdk-go-v2/service/lexmodelsv2 v1.43.2/go.mod h1:xzEn1Vmlgvu4QHbHHNuhKyJsFyoIVVZ0jttnsvjTnHU= -github.com/aws/aws-sdk-go-v2/service/lightsail v1.36.3 h1:Xgmk7IJjeXcCWNC0L2v7qapbDBwg9d8lHaIS01eAKTE= -github.com/aws/aws-sdk-go-v2/service/lightsail v1.36.3/go.mod h1:gW5ikkvZZgbdBVQX3O2/5/IYrQl8ncFYHF8tl5tncSg= -github.com/aws/aws-sdk-go-v2/service/lookoutmetrics v1.27.3 h1:yTE2NvVx7lIh2i0G8U9q6gZ/6jiqOgGyctvMX5GlhAg= -github.com/aws/aws-sdk-go-v2/service/lookoutmetrics v1.27.3/go.mod h1:JqruV98qPX/lVj67PZN7LPEsHS1oz7nEDa2HokFN/sQ= -github.com/aws/aws-sdk-go-v2/service/m2 v1.12.3 h1:Lf0n1E8kjrsvSrT/qOQL+RHFSqSFML+krSQp1KrofTo= -github.com/aws/aws-sdk-go-v2/service/m2 v1.12.3/go.mod h1:8ZpMmMZVsDy8QVsCypk5XSZYTcX+Ijt7TEz6GGmdQko= -github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.28.3 h1:/JTpHrZ7WBCWkQk3141wK1tqosN+IrJkdH0YnLK04ng= -github.com/aws/aws-sdk-go-v2/service/mediaconnect v1.28.3/go.mod h1:r0aD0u2T/OVQQCLXfsYkMSw3HiulS4JlQq5sccgiTTQ= -github.com/aws/aws-sdk-go-v2/service/mediaconvert v1.52.3 h1:ZsJdb3QZxxkI+Yu9JK9w/Oc69eOF4Xnn9bcaqWoRUFM= -github.com/aws/aws-sdk-go-v2/service/mediaconvert v1.52.3/go.mod h1:0gs1QlrbxxEUJKbi2m/ij685F4TT4nTESvta+yfGafE= -github.com/aws/aws-sdk-go-v2/service/medialive v1.48.3 h1:naFLtSvfHpY8AfXXj1WPiW5+3cx8l2lRtclfvgT12tg= -github.com/aws/aws-sdk-go-v2/service/medialive v1.48.3/go.mod h1:G/trfuk73arlR8jln73j+ahGaUSttpNrkW+rSlwVMzQ= -github.com/aws/aws-sdk-go-v2/service/mediapackage v1.30.3 h1:YTpocP/tUCenvfYtF0PLnCaiWcBQXlrqOVEjvN8ri88= -github.com/aws/aws-sdk-go-v2/service/mediapackage v1.30.3/go.mod h1:zcDHNg37WsXPc+9Bi1an6YagYjZWZnhlTOKvhdKcBWo= -github.com/aws/aws-sdk-go-v2/service/mediapackagev2 v1.10.1 h1://PDaerL8FJjBvZ/Yu7CW/6fACKSezrGdF98W8h6Wmw= -github.com/aws/aws-sdk-go-v2/service/mediapackagev2 v1.10.1/go.mod h1:OQNeUPaqiCWIYKQKlxYCRgTRS+tnvwgVIRJzb7nclcQ= -github.com/aws/aws-sdk-go-v2/service/mediastore v1.20.3 h1:Ca6dRWD1VK0ptbIu0L6BStbeLCVmK7FEoc0hwM8rJac= -github.com/aws/aws-sdk-go-v2/service/mediastore v1.20.3/go.mod h1:/q8Cn5mJa6S8CzviuirwPoRNbBCtAtGth5Si8623nKs= -github.com/aws/aws-sdk-go-v2/service/mq v1.22.3 h1:WAOpy0fCM+6lzv86xDiWtM+tjBSnUgL6qsjA61mp/0Q= -github.com/aws/aws-sdk-go-v2/service/mq v1.22.3/go.mod h1:BmdNY+XOCG10c9GQFLsxffcwUpDT8ky7jfpwcZXL5tU= -github.com/aws/aws-sdk-go-v2/service/mwaa v1.26.4 h1:jjpxTB0W+6UQNzF0D3fcl9LGLWPEBje4QBJJiHIwHWc= -github.com/aws/aws-sdk-go-v2/service/mwaa v1.26.4/go.mod h1:4WHkaNsG0O2C1UALww5npTmfHb3bbfYJhpsjl0i8Kbo= -github.com/aws/aws-sdk-go-v2/service/oam v1.9.3 h1:39Li2+u7WO+KAZo8aPLo3p+APeGbYqGJMcZGRyhYqtY= -github.com/aws/aws-sdk-go-v2/service/oam v1.9.3/go.mod h1:aGGOSvYFvMVTg1pom32eUvr+TDSz24k2pFSiNbgtwc4= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.3 h1:Hl+6c8DUmnp8UUR4GxOlff6y0R3+7cZXpojP95y80SY= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.3/go.mod h1:SoK8aerBG8p08vK4N1QAPg+743VWbrcTACKCVFnyLFs= -github.com/aws/aws-sdk-go-v2/service/osis v1.8.3 h1:fETzs9pAxPp0gkIRJ1olOtN2M1Hi2oVF1QfewEjdr3g= -github.com/aws/aws-sdk-go-v2/service/osis v1.8.3/go.mod h1:ixCAnUrXx5eW7WSRm62k8pQ2XvqOi7bMKB9qMEPPPhs= -github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.3 h1:Itfj1epf35aUtsAoSrx1PMulQTrLsh6iidiF7/+07BM= -github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.3/go.mod h1:hw+93RlfeLZueByt54PWQFxqUSD7xTzyHFYc5xBuKR8= -github.com/aws/aws-sdk-go-v2/service/pipes v1.11.3 h1:Tbj7OCbZgkhnkByBcObF1B8ZHacttdLlz4jKzWI/JYs= -github.com/aws/aws-sdk-go-v2/service/pipes v1.11.3/go.mod h1:FORQ0HOx+V/5WCbSK79ZmX3NozruVMA0l6ySqYlndHQ= -github.com/aws/aws-sdk-go-v2/service/polly v1.39.5 h1:gz62DPzkIArtvmuQkGGHlLreLV1v/N1g1CkSHVwQTJk= -github.com/aws/aws-sdk-go-v2/service/polly v1.39.5/go.mod h1:1/WA2p90+p1n/COApBzAxN/XxpBbH0iho3HV5hLTzlU= -github.com/aws/aws-sdk-go-v2/service/pricing v1.27.3 h1:Fl50I7+QT9D1QgPsQqqXbo44YKFfGJ6h1ljZu+BGZoE= -github.com/aws/aws-sdk-go-v2/service/pricing v1.27.3/go.mod h1:oB3Na0szArXW5rngmmBdNdJN4jsMvRTFpWZ6sGaqDDk= -github.com/aws/aws-sdk-go-v2/service/qbusiness v1.4.3 h1:QZtPVqOTsJq+wj8K2QB29uZyrO2fWiU/hQZk/KjGm9U= -github.com/aws/aws-sdk-go-v2/service/qbusiness v1.4.3/go.mod h1:UFPEBRf7wpsUi4EMg9O4K/xuv39dVuzX+MXpt90mpIE= -github.com/aws/aws-sdk-go-v2/service/qldb v1.21.3 h1:b43pgguttg3h/X7urz3pMG2ColT7YC+lH5/FysHOIQU= -github.com/aws/aws-sdk-go-v2/service/qldb v1.21.3/go.mod h1:gakPROhEU/mkJTaDDL7GqP6XlrFju8dwTYvu9E3/fVI= -github.com/aws/aws-sdk-go-v2/service/rbin v1.16.3 h1:FEQLknIK+Db2+TEFhRdzYQtG1naSMmetFg5ReE6i/YU= -github.com/aws/aws-sdk-go-v2/service/rbin v1.16.3/go.mod h1:50NBbpMxyU/A6ZACxdU7RGM1FBZ3fAY3smBFSb4WrrA= -github.com/aws/aws-sdk-go-v2/service/rds v1.76.0 h1:cQUdm2sU/71O1vCCV627GrQz5b9RmfuxViYDiLsAdZg= -github.com/aws/aws-sdk-go-v2/service/rds v1.76.0/go.mod h1:TsRoxafRyxgt1c1JWQXmxj/dCEwOkBapTwskET8vgFo= -github.com/aws/aws-sdk-go-v2/service/redshift v1.43.4 h1:jBjR7hZti5DlXvxIhqbTtchY6H0zDBJPTLKgbnN6T8w= -github.com/aws/aws-sdk-go-v2/service/redshift v1.43.4/go.mod h1:+xubus3labXB+kdeLVzrg0Nmzkh3ciwXch8L7LjDtdg= -github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.3 h1:BOXvmJ7f5mgCwgjp7e7uqHLS7c2laMvJC4jZf9Jgqdk= -github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.3/go.mod h1:izyjwlsKeUscbN2uGUh9zW9wXHOJHRCYErOfVsJs6n4= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.3 h1:MLV8a4yAvYZBc70xEm7sKFHvPv+GydVVoZ4hZLUCQiM= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.3/go.mod h1:SuO+m7bzVnvatnyiLNZDZgcczlUnixfaFOEL7XPY6O4= -github.com/aws/aws-sdk-go-v2/service/rekognition v1.39.3 h1:7peTBuoUOGKtsypn6LUGcJCUcf1BGHoGV9y8L9J+Gas= -github.com/aws/aws-sdk-go-v2/service/rekognition v1.39.3/go.mod h1:GhYHT7uPYriu+zwu6z6I+qw6VeIk4CE//GVeJE7yT24= -github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.3 h1:+DHhL4AnQbOAdCUmQjn3QwYau/4tVKvC5Y+fNfCE690= -github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.3/go.mod h1:O0Ug6z9hWyRg3l681dICwExRtUI+m08f14Sa1C4bKoo= -github.com/aws/aws-sdk-go-v2/service/resourcegroups v1.21.3 h1:ruD/QNzA0SWFYf5v1rbdUvb/vvCbCMADaZlJQRPA84U= -github.com/aws/aws-sdk-go-v2/service/resourcegroups v1.21.3/go.mod h1:I+z4BKgG7tu84byzP/3pkU/QbDZuE7R1FphdHMYwUSA= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.3 h1:wM7sHeNGJ/TqW5y/IXYAxIGpabxDUMZBiJedm/eX7vU= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.3/go.mod h1:z7I7ESFGZuAaT8gMWZLKGS3h9BWPjW8iFni9eOJWwqs= -github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.8.4 h1:AuCtFQh5a8Uvi7r21jFFyNoPQt5X+bSa63NbMk7a2mE= -github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.8.4/go.mod h1:JfM0EhP2Z5ArefAfzgeJBkBOaee9mmyXtUqHTxnwZEE= -github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.3 h1:iuBYHWv0+2pF2qbM+UmnSwvcdOknXRi4yE9KBHhAItQ= -github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.3/go.mod h1:Ijqatnvuyx5IE/FmFJWJyWTcUY5XrlXgc6G7z1Fqk6o= -github.com/aws/aws-sdk-go-v2/service/s3 v1.53.0 h1:r3o2YsgW9zRcIP3Q0WCmttFVhTuugeKIvT5z9xDspc0= -github.com/aws/aws-sdk-go-v2/service/s3 v1.53.0/go.mod h1:w2E4f8PUfNtyjfL6Iu+mWI96FGttE03z3UdNcUEC4tA= -github.com/aws/aws-sdk-go-v2/service/s3control v1.44.3 h1:lSZEeke3ivp++MQ4a8Cd2G0Vh0aP+flLHXfMBe7ZWz0= -github.com/aws/aws-sdk-go-v2/service/s3control v1.44.3/go.mod h1:0wQ+7wiAWqWwksgmhV5KEUDKxpzqdVmrMPmvncWr9Pg= -github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.3 h1:PDlINUkjxH/eMLVDUMFOQJBMkB3BbTwNjUWKeq2xH8E= -github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.3/go.mod h1:vEBdLTVmJesS5DAiryn7zuJPpT2pyYBKsBN0pHb6SxE= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.4 h1:5GYToReUFSGP6/zqvG3fv8qNqeetyfsSiPHduHShjAc= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.4/go.mod h1:slgOMs1CQu8UVgwoFqEvCi71L4HVoZgM0r8MtcNP6Mc= -github.com/aws/aws-sdk-go-v2/service/securityhub v1.46.3 h1:0SaKuyc6OumR6eZfD4COFB3rvkgnsXvZhOXfilIBpDI= -github.com/aws/aws-sdk-go-v2/service/securityhub v1.46.3/go.mod h1:RWptadXBwlyIfgDAv7ExErIoLBbfieAkXKHycZXHyLM= -github.com/aws/aws-sdk-go-v2/service/securitylake v1.13.2 h1:JZvvXlBglot2ZDgtArByzqDNtF5GLiROPLbn7iIP4B8= -github.com/aws/aws-sdk-go-v2/service/securitylake v1.13.2/go.mod h1:b5qhz6hJZiRNRkBkzp+LL+LuxwR5ODvjSvNAPkqPnso= -github.com/aws/aws-sdk-go-v2/service/servicecatalogappregistry v1.26.3 h1:DvAKjQG35XV6Ll3dAlSA1+tJAJMNj6k1oZ9QQOd3aGY= -github.com/aws/aws-sdk-go-v2/service/servicecatalogappregistry v1.26.3/go.mod h1:ulYmH7KpqAcGB0K4y6o3ssuvClbyqjRv7JuOZOr+qr8= -github.com/aws/aws-sdk-go-v2/service/servicequotas v1.21.3 h1:TLma92i3/jxvHO7uGJCfqvlJsRNpjrv5+pnBZot+HJo= -github.com/aws/aws-sdk-go-v2/service/servicequotas v1.21.3/go.mod h1:zJheXnm0ujp9HwSMsk1r0UJN4zrt/WLYp7qjhW4r4Xo= -github.com/aws/aws-sdk-go-v2/service/sesv2 v1.27.2 h1:Izvc3jOqVNHXGpS+Ej/fHCvTSQhRY8ynQksQuz8JZ2o= -github.com/aws/aws-sdk-go-v2/service/sesv2 v1.27.2/go.mod h1:5hgpPTBatfyvJAylb/xOvgB8AAingmX9PM8plfCvpy4= -github.com/aws/aws-sdk-go-v2/service/shield v1.25.3 h1:ry4Z38h6YJFEt5prbnoY9Nt0PaRzpGPZ+Sg2YpJHA3k= -github.com/aws/aws-sdk-go-v2/service/shield v1.25.3/go.mod h1:IYaUiAzjqHCx4yjvbttKznxwyj3od4QJYFpsVl7s968= -github.com/aws/aws-sdk-go-v2/service/signer v1.22.4 h1:nN2HjMf32L752xvo6sd8va0afWS3DO+XQMgnCkHYqJU= -github.com/aws/aws-sdk-go-v2/service/signer v1.22.4/go.mod h1:dyEzeuDqIZ97hRC0EqcOr8BvL2Z9MiOU408xyqMRpLs= -github.com/aws/aws-sdk-go-v2/service/sns v1.29.3 h1:R2MIMza/lZex1wIawXmo6S+suwFv/JcxOFSJPpsSVBY= -github.com/aws/aws-sdk-go-v2/service/sns v1.29.3/go.mod h1:tr9l7BHYU/SvlJAL9CH56XZNcOBb/d24j3RrXkzzaTA= -github.com/aws/aws-sdk-go-v2/service/sqs v1.31.3 h1:AOQ5bXiVWqoEAv8Ag7zgJoDVhOz3lUrZyk1/M45/keU= -github.com/aws/aws-sdk-go-v2/service/sqs v1.31.3/go.mod h1:GCHwwK0RX9JVvLYzDDLHCvkD2lMihdqJSQ2kzkVbyhw= -github.com/aws/aws-sdk-go-v2/service/ssm v1.49.4 h1:2f1Gkbe9O15DntphmbdEInn6MGIZ3x2bbv8b0p/4awQ= -github.com/aws/aws-sdk-go-v2/service/ssm v1.49.4/go.mod h1:BlIdE/k0lwn8xyn8piK02oYjqKsxulo6yPV3BuIWuMI= -github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.3 h1:cu9PQrDPDMnlnvvTfDmG8z0ZPZGPD/VP4nnnJkDR7uk= -github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.3/go.mod h1:uHdnhSHibE+cmiMpYS30300IwVkhhDBXeh0mEKUqsok= -github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.3 h1:t8rAe2F1iQX/48F42W8YdZOyoiqz4gJMQTUV4p/idRo= -github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.3/go.mod h1:70IJ5R8efbsYhNN2uaB7LuV+l/GnF8/EY5RWuqDuGxE= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.3 h1:M5PU0hNhJtWBOS1dkJYlZ5q+IHsZ1NeNPR499EsldG8= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.3/go.mod h1:qo/SmgItdkL2Dw3/rNp25HDqdzQrpFFc46TIvVuJbUg= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs= -github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.3 h1:7wrjRxb5Hft+z7C9mQ64QpKuS08Z4Y3KDYrGQytfdKQ= -github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.3/go.mod h1:0Y/hgqNElihKXuOskBJh7l33WjBxG3JCeS875bSB1v4= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3/go.mod h1:b+qdhjnxj8GSR6t5YfphOffeoQSQ1KmpoVVuBn+PWxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 h1:J/PpTf/hllOjx8Xu9DMflff3FajfLxqM5+tepvVXmxg= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5/go.mod h1:0ih0Z83YDH/QeQ6Ori2yGE2XvWYv/Xm+cZc01LC6oK0= -github.com/aws/aws-sdk-go-v2/service/swf v1.22.3 h1:TS4L29KWEtqnrgF8kWvuQ9j/ep63smfpTF4tTL/T4Fw= -github.com/aws/aws-sdk-go-v2/service/swf v1.22.3/go.mod h1:3HHrn8OI/ZeYH3dPRBlv/29j2G3cxX2gLE96lg0d3kM= -github.com/aws/aws-sdk-go-v2/service/synthetics v1.24.3 h1:ctGVwYbbKbFGYHgmDEUVQQZFjX2SLc6+AQvQZ2zzY8A= -github.com/aws/aws-sdk-go-v2/service/synthetics v1.24.3/go.mod h1:XaNf88T2Qh/Xq+AdROTT0yoXZt74+uv6sxH5e2a4hFc= -github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.4 h1:c2+M6++3zJaBayRALJDbtyPwKXgoR1uUCqldrSUM5qU= -github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.4/go.mod h1:R7R0oGNGbQBf3oyKQ7HXmjiZeOYY1YW4WLI0Za5qeHw= -github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.3 h1:h4QtG7MkGwtxvgryVV7aAqLegkqeLzaDH/u58Exlfsw= -github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.3/go.mod h1:2Eyfj3gJleIZ9+ykepiVg2UQke9ULkYVdLvdAKCzmjk= -github.com/aws/aws-sdk-go-v2/service/transfer v1.44.1 h1:VgSUD1x8y65u3MlSBVcKoIlqKTLdnR6HIDkYhNYqSVA= -github.com/aws/aws-sdk-go-v2/service/transfer v1.44.1/go.mod h1:8PIjDhYksseczULN0DUzHhr1ywnkO7wQQYkFd6+drMk= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.11.2 h1:2B+sX0dePFD01V27oNEyZPnwu4w9J9Yf0qXTP/efTqQ= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.11.2/go.mod h1:/iuRs/lNI8s/Y8OPafrcQk8v/uiMOmblhXFxlgNs8Ps= -github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.3 h1:W1dTrf1OIA+kjvE5SD/3erlaffRgyQthAH6XDVFU0D8= -github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.3/go.mod h1:GNUo3ZPcUSgDkHRWmhwpzIOG/zgje/3Lq/8mOaETyuM= -github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.29.3 h1:mszAPtlEANhzpGhgA871gEIAKhFZ3kt8j+ik8d89SmM= -github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.29.3/go.mod h1:33Ws0ZS81lSOz7JH3GNqnd6LGE7nv+McbkbKvgvZq6U= -github.com/aws/aws-sdk-go-v2/service/workspaces v1.38.3 h1:WE6+zJiwHRuebNyb7k9ZeJ3FOsaVWPR5mUPKRU3oH90= -github.com/aws/aws-sdk-go-v2/service/workspaces v1.38.3/go.mod h1:C5g1LwXTgFeJM4r9mxoImtzhXWSzUlLYA29Up2b01Rc= -github.com/aws/aws-sdk-go-v2/service/xray v1.25.3 h1:/G8CJPxv+RTFLO/2TbPuVT3zcxMoqVKe70hO7Iunepg= -github.com/aws/aws-sdk-go-v2/service/xray v1.25.3/go.mod h1:/kSTwC1FP3sMVGqX8pKDMj4e3IglW5TsaaqbFQZkcHY= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -======= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 h1:81KE7vaZzrl7yHBYHVEzYB8sypz11NMOZ40YlWvPxsU= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5/go.mod h1:LIt2rg7Mcgn09Ygbdh/RdIm0rQ+3BNkbP1gyVMFtRK0= github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.1 h1:PL5AbOt4fBuqFOupjlJz7FNQv8Y9iq/3AlOiPFMcBhY= @@ -366,6 +66,8 @@ github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4 h1:xQyow1kdXLj4kcU9ja1MyZS github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4/go.mod h1:lc5I/jQCLi4eU5RsIe6P+0h/tva09lVpQP17+IpW61w= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4 h1:ARn6qYIxhMRnatsonKQ4y3Wgv9YDjiCIURsPtiuCgIM= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4/go.mod h1:EGStqkGOjo1Mm1IMelC8W3BPq6n3Qiw+aUCgYTwjV/o= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4 h1:B2DOglYz+zxaSrOfOTCX7bFp9J6LqvyIA25rpwYqOeQ= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4/go.mod h1:tvRY6xn3fG25GW4n1W76MqTViTTzVfCXKmURxXloT9o= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4 h1:WPPJVRvjvIHeFEqDyjX5yUocKOBAqDOJpvHIaN+LY30= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4/go.mod h1:HBEDVCiXAhDxrCJ8meNd1ao+PSQkkB02RfXaEuwyp6U= github.com/aws/aws-sdk-go-v2/service/athena v1.40.4 h1:tiHIjFXSyb5DbNfnu3ql2r86s6llLdzwWAVJkPgw/I0= @@ -668,7 +370,6 @@ github.com/aws/aws-sdk-go-v2/service/xray v1.25.4 h1:56m1lnJbOSjGposPRmCAAJ8uBM/ github.com/aws/aws-sdk-go-v2/service/xray v1.25.4/go.mod h1:B8TaYUDF5rQxS1t3KxrMNu074VGbxxgi/2YYsUBDsbA= github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= ->>>>>>> main github.com/beevik/etree v1.3.0 h1:hQTc+pylzIKDb23yYprodCWWTt+ojFfUZyzU09a/hmU= github.com/beevik/etree v1.3.0/go.mod h1:aiPf89g/1k3AShMVAzriilpcE4R/Vuor90y83zVZWFc= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= diff --git a/internal/conns/awsclient_gen.go b/internal/conns/awsclient_gen.go index 1a6c75ac341f..9d9abc720c11 100644 --- a/internal/conns/awsclient_gen.go +++ b/internal/conns/awsclient_gen.go @@ -160,15 +160,6 @@ import ( wellarchitected_sdkv2 "github.com/aws/aws-sdk-go-v2/service/wellarchitected" workspaces_sdkv2 "github.com/aws/aws-sdk-go-v2/service/workspaces" xray_sdkv2 "github.com/aws/aws-sdk-go-v2/service/xray" -<<<<<<< HEAD - acmpca_sdkv1 "github.com/aws/aws-sdk-go/service/acmpca" - amplify_sdkv1 "github.com/aws/aws-sdk-go/service/amplify" - apigateway_sdkv1 "github.com/aws/aws-sdk-go/service/apigateway" - apigatewayv2_sdkv1 "github.com/aws/aws-sdk-go/service/apigatewayv2" - appconfig_sdkv1 "github.com/aws/aws-sdk-go/service/appconfig" -======= - appintegrationsservice_sdkv1 "github.com/aws/aws-sdk-go/service/appintegrationsservice" ->>>>>>> main applicationautoscaling_sdkv1 "github.com/aws/aws-sdk-go/service/applicationautoscaling" applicationinsights_sdkv1 "github.com/aws/aws-sdk-go/service/applicationinsights" appmesh_sdkv1 "github.com/aws/aws-sdk-go/service/appmesh" From d91a0c471b6856b57bc0ef8d598f3675bee7aa35 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 12:36:57 -0400 Subject: [PATCH 093/137] d/aws_globalaccelerator_accelerator: Migrate to AWS SDK for GO v2. --- .../service/globalaccelerator/accelerator.go | 8 -- .../accelerator_data_source.go | 96 ++++++++----------- .../globalaccelerator/service_package_gen.go | 3 +- 3 files changed, 42 insertions(+), 65 deletions(-) diff --git a/internal/service/globalaccelerator/accelerator.go b/internal/service/globalaccelerator/accelerator.go index 5125deaa3bc5..0ac9acc97f34 100644 --- a/internal/service/globalaccelerator/accelerator.go +++ b/internal/service/globalaccelerator/accelerator.go @@ -335,10 +335,6 @@ func findAcceleratorByARN(ctx context.Context, conn *globalaccelerator.Client, a AcceleratorArn: aws.String(arn), } - return findAccelerator(ctx, conn, input) -} - -func findAccelerator(ctx context.Context, conn *globalaccelerator.Client, input *globalaccelerator.DescribeAcceleratorInput) (*awstypes.Accelerator, error) { output, err := conn.DescribeAccelerator(ctx, input) if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { @@ -364,10 +360,6 @@ func findAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator AcceleratorArn: aws.String(arn), } - return findAcceleratorAttributes(ctx, conn, input) -} - -func findAcceleratorAttributes(ctx context.Context, conn *globalaccelerator.Client, input *globalaccelerator.DescribeAcceleratorAttributesInput) (*awstypes.AcceleratorAttributes, error) { output, err := conn.DescribeAcceleratorAttributes(ctx, input) if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { diff --git a/internal/service/globalaccelerator/accelerator_data_source.go b/internal/service/globalaccelerator/accelerator_data_source.go index 043cf82226d2..bff370d14c3c 100644 --- a/internal/service/globalaccelerator/accelerator_data_source.go +++ b/internal/service/globalaccelerator/accelerator_data_source.go @@ -6,8 +6,9 @@ package globalaccelerator import ( "context" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -16,35 +17,34 @@ import ( "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/names" ) -// @FrameworkDataSource -func newDataSourceAccelerator(context.Context) (datasource.DataSourceWithConfigure, error) { - d := &dataSourceAccelerator{} +// @FrameworkDataSource(name="Accelerator") +func newAcceleratorDataSource(context.Context) (datasource.DataSourceWithConfigure, error) { + d := &acceleratorDataSource{} return d, nil } -type dataSourceAccelerator struct { +type acceleratorDataSource struct { framework.DataSourceWithConfigure } -// Metadata should return the full name of the data source, such as -// examplecloud_thing. -func (d *dataSourceAccelerator) Metadata(_ context.Context, request datasource.MetadataRequest, response *datasource.MetadataResponse) { +func (*acceleratorDataSource) Metadata(_ context.Context, request datasource.MetadataRequest, response *datasource.MetadataResponse) { response.TypeName = "aws_globalaccelerator_accelerator" } -// Schema returns the schema for this data source. -func (d *dataSourceAccelerator) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = schema.Schema{ +func (d *acceleratorDataSource) Schema(ctx context.Context, request datasource.SchemaRequest, response *datasource.SchemaResponse) { + response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "arn": schema.StringAttribute{ + names.AttrARN: schema.StringAttribute{ CustomType: fwtypes.ARNType, Optional: true, Computed: true, }, "attributes": schema.ListAttribute{ + Computed: true, ElementType: types.ObjectType{ AttrTypes: map[string]attr.Type{ "flow_logs_enabled": types.BoolType, @@ -52,7 +52,6 @@ func (d *dataSourceAccelerator) Schema(ctx context.Context, req datasource.Schem "flow_logs_s3_prefix": types.StringType, }, }, - Computed: true, }, "dns_name": schema.StringAttribute{ Computed: true, @@ -66,7 +65,7 @@ func (d *dataSourceAccelerator) Schema(ctx context.Context, req datasource.Schem "hosted_zone_id": schema.StringAttribute{ Computed: true, }, - "id": schema.StringAttribute{ + names.AttrID: schema.StringAttribute{ Optional: true, Computed: true, }, @@ -74,13 +73,13 @@ func (d *dataSourceAccelerator) Schema(ctx context.Context, req datasource.Schem Computed: true, }, "ip_sets": schema.ListAttribute{ + Computed: true, ElementType: types.ObjectType{ AttrTypes: map[string]attr.Type{ "ip_addresses": types.ListType{ElemType: types.StringType}, "ip_family": types.StringType, }, }, - Computed: true, }, "name": schema.StringAttribute{ Optional: true, @@ -91,49 +90,38 @@ func (d *dataSourceAccelerator) Schema(ctx context.Context, req datasource.Schem } } -// Read is called when the provider must read data source values in order to update state. -// Config values should be read from the ReadRequest and new state values set on the ReadResponse. -func (d *dataSourceAccelerator) Read(ctx context.Context, request datasource.ReadRequest, response *datasource.ReadResponse) { - var data dataSourceAcceleratorData - +func (d *acceleratorDataSource) Read(ctx context.Context, request datasource.ReadRequest, response *datasource.ReadResponse) { + var data acceleratorDataSourceModel response.Diagnostics.Append(request.Config.Get(ctx, &data)...) - if response.Diagnostics.HasError() { return } - conn := d.Meta().GlobalAcceleratorConn(ctx) + conn := d.Meta().GlobalAcceleratorClient(ctx) ignoreTagsConfig := d.Meta().IgnoreTagsConfig - var results []*globalaccelerator.Accelerator - err := conn.ListAcceleratorsPagesWithContext(ctx, &globalaccelerator.ListAcceleratorsInput{}, func(page *globalaccelerator.ListAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage - } + var results []awstypes.Accelerator + pages := globalaccelerator.NewListAcceleratorsPaginator(conn, &globalaccelerator.ListAcceleratorsInput{}) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) - for _, accelerator := range page.Accelerators { - if accelerator == nil { - continue - } + if err != nil { + response.Diagnostics.AddError("listing Global Accelerator Accelerators", err.Error()) - if !data.ARN.IsNull() && data.ARN.ValueString() != aws.StringValue(accelerator.AcceleratorArn) { + return + } + + for _, v := range page.Accelerators { + if !data.ARN.IsNull() && data.ARN.ValueString() != aws.ToString(v.AcceleratorArn) { continue } - if !data.Name.IsNull() && data.Name.ValueString() != aws.StringValue(accelerator.Name) { + if !data.Name.IsNull() && data.Name.ValueString() != aws.ToString(v.Name) { continue } - results = append(results, accelerator) + results = append(results, v) } - - return !lastPage - }) - - if err != nil { - response.Diagnostics.AddError("listing Global Accelerator Accelerators", err.Error()) - - return } if n := len(results); n == 0 { @@ -147,18 +135,18 @@ func (d *dataSourceAccelerator) Read(ctx context.Context, request datasource.Rea } accelerator := results[0] - acceleratorARN := aws.StringValue(accelerator.AcceleratorArn) + acceleratorARN := aws.ToString(accelerator.AcceleratorArn) data.ARN = flex.StringToFrameworkARN(ctx, accelerator.AcceleratorArn) data.DnsName = flex.StringToFrameworkLegacy(ctx, accelerator.DnsName) data.DualStackDNSName = flex.StringToFrameworkLegacy(ctx, accelerator.DualStackDnsName) data.Enabled = flex.BoolToFrameworkLegacy(ctx, accelerator.Enabled) data.HostedZoneID = types.StringValue(d.Meta().GlobalAcceleratorHostedZoneID(ctx)) data.ID = types.StringValue(acceleratorARN) - data.IpAddressType = flex.StringToFrameworkLegacy(ctx, accelerator.IpAddressType) + data.IpAddressType = flex.StringValueToFrameworkLegacy(ctx, accelerator.IpAddressType) data.IpSets = d.flattenIPSetsFramework(ctx, accelerator.IpSets) data.Name = flex.StringToFrameworkLegacy(ctx, accelerator.Name) - attributes, err := FindAcceleratorAttributesByARN(ctx, conn, acceleratorARN) + attributes, err := findAcceleratorAttributesByARN(ctx, conn, acceleratorARN) if err != nil { response.Diagnostics.AddError("reading Global Accelerator Accelerator attributes", err.Error()) @@ -181,7 +169,7 @@ func (d *dataSourceAccelerator) Read(ctx context.Context, request datasource.Rea response.Diagnostics.Append(response.State.Set(ctx, &data)...) } -func (d *dataSourceAccelerator) flattenIPSetFramework(ctx context.Context, apiObject *globalaccelerator.IpSet) types.Object { +func (d *acceleratorDataSource) flattenIPSetFramework(ctx context.Context, apiObject *awstypes.IpSet) types.Object { attributeTypes := map[string]attr.Type{ "ip_addresses": types.ListType{ElemType: types.StringType}, "ip_family": types.StringType, @@ -192,14 +180,14 @@ func (d *dataSourceAccelerator) flattenIPSetFramework(ctx context.Context, apiOb } attributes := map[string]attr.Value{ - "ip_addresses": flex.FlattenFrameworkStringListLegacy(ctx, apiObject.IpAddresses), + "ip_addresses": flex.FlattenFrameworkStringValueListLegacy(ctx, apiObject.IpAddresses), "ip_family": flex.StringToFrameworkLegacy(ctx, apiObject.IpFamily), } return types.ObjectValueMust(attributeTypes, attributes) } -func (d *dataSourceAccelerator) flattenIPSetsFramework(ctx context.Context, apiObjects []*globalaccelerator.IpSet) types.List { +func (d *acceleratorDataSource) flattenIPSetsFramework(ctx context.Context, apiObjects []awstypes.IpSet) types.List { elementType := types.ObjectType{AttrTypes: map[string]attr.Type{ "ip_addresses": types.ListType{ElemType: types.StringType}, "ip_family": types.StringType, @@ -207,17 +195,13 @@ func (d *dataSourceAccelerator) flattenIPSetsFramework(ctx context.Context, apiO var elements []attr.Value for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - elements = append(elements, d.flattenIPSetFramework(ctx, apiObject)) + elements = append(elements, d.flattenIPSetFramework(ctx, &apiObject)) } return types.ListValueMust(elementType, elements) } -func (d *dataSourceAccelerator) flattenAcceleratorAttributesFramework(ctx context.Context, apiObject *globalaccelerator.AcceleratorAttributes) types.List { +func (d *acceleratorDataSource) flattenAcceleratorAttributesFramework(ctx context.Context, apiObject *awstypes.AcceleratorAttributes) types.List { attributeTypes := map[string]attr.Type{ "flow_logs_enabled": types.BoolType, "flow_logs_s3_bucket": types.StringType, @@ -240,7 +224,7 @@ func (d *dataSourceAccelerator) flattenAcceleratorAttributesFramework(ctx contex return types.ListValueMust(elementType, []attr.Value{types.ObjectValueMust(attributeTypes, attributes)}) } -type dataSourceAcceleratorData struct { +type acceleratorDataSourceModel struct { ARN fwtypes.ARN `tfsdk:"arn"` Attributes types.List `tfsdk:"attributes"` DnsName types.String `tfsdk:"dns_name"` diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index ce15945e6793..6767f34bbd17 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -15,7 +15,8 @@ type servicePackage struct{} func (p *servicePackage) FrameworkDataSources(ctx context.Context) []*types.ServicePackageFrameworkDataSource { return []*types.ServicePackageFrameworkDataSource{ { - Factory: newDataSourceAccelerator, + Factory: newAcceleratorDataSource, + Name: "Accelerator", }, } } From 5393e431fe1de5b53ead8a2cc0ebfdf9281d2f6c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 12:39:08 -0400 Subject: [PATCH 094/137] globalaccelerator: Migrate ARN helpers to AWS SDK for Go v2. --- internal/service/globalaccelerator/arn.go | 10 +++++----- internal/service/globalaccelerator/arn_test.go | 7 +++---- .../globalaccelerator/custom_routing_endpoint_group.go | 6 +++--- .../globalaccelerator/custom_routing_listener.go | 2 +- internal/service/globalaccelerator/endpoint_group.go | 8 ++++---- internal/service/globalaccelerator/listener.go | 2 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/internal/service/globalaccelerator/arn.go b/internal/service/globalaccelerator/arn.go index e02a08306225..a6db91eabf1a 100644 --- a/internal/service/globalaccelerator/arn.go +++ b/internal/service/globalaccelerator/arn.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/aws/aws-sdk-go/aws/arn" + "github.com/aws/aws-sdk-go-v2/aws/arn" ) const ( @@ -15,9 +15,9 @@ const ( ARNService = "globalaccelerator" ) -// EndpointGroupARNToListenerARN converts an endpoint group ARN to a listener ARN. +// endpointGroupARNToListenerARN converts an endpoint group ARN to a listener ARN. // See https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsglobalaccelerator.html#awsglobalaccelerator-resources-for-iam-policies. -func EndpointGroupARNToListenerARN(inputARN string) (string, error) { +func endpointGroupARNToListenerARN(inputARN string) (string, error) { parsedARN, err := arn.Parse(inputARN) if err != nil { @@ -45,9 +45,9 @@ func EndpointGroupARNToListenerARN(inputARN string) (string, error) { return outputARN, nil } -// ListenerOrEndpointGroupARNToAcceleratorARN converts a listener or endpoint group ARN to an accelerator ARN. +// listenerOrEndpointGroupARNToAcceleratorARN converts a listener or endpoint group ARN to an accelerator ARN. // See https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsglobalaccelerator.html#awsglobalaccelerator-resources-for-iam-policies. -func ListenerOrEndpointGroupARNToAcceleratorARN(inputARN string) (string, error) { +func listenerOrEndpointGroupARNToAcceleratorARN(inputARN string) (string, error) { parsedARN, err := arn.Parse(inputARN) if err != nil { diff --git a/internal/service/globalaccelerator/arn_test.go b/internal/service/globalaccelerator/arn_test.go index 567bdd92a29c..52b533ec04d8 100644 --- a/internal/service/globalaccelerator/arn_test.go +++ b/internal/service/globalaccelerator/arn_test.go @@ -1,14 +1,13 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package globalaccelerator_test +package globalaccelerator import ( "regexp" "testing" "github.com/YakDriver/regexache" - tfglobalaccelerator "github.com/hashicorp/terraform-provider-aws/internal/service/globalaccelerator" ) func TestEndpointGroupARNToListenerARN(t *testing.T) { @@ -52,7 +51,7 @@ func TestEndpointGroupARNToListenerARN(t *testing.T) { t.Run(testCase.TestName, func(t *testing.T) { t.Parallel() - got, err := tfglobalaccelerator.EndpointGroupARNToListenerARN(testCase.InputARN) + got, err := endpointGroupARNToListenerARN(testCase.InputARN) if err == nil && testCase.ExpectedError != nil { t.Fatalf("expected error %s, got no error", testCase.ExpectedError.String()) @@ -119,7 +118,7 @@ func TestListenerOrEndpointGroupARNToAcceleratorARN(t *testing.T) { t.Run(testCase.TestName, func(t *testing.T) { t.Parallel() - got, err := tfglobalaccelerator.ListenerOrEndpointGroupARNToAcceleratorARN(testCase.InputARN) + got, err := listenerOrEndpointGroupARNToAcceleratorARN(testCase.InputARN) if err == nil && testCase.ExpectedError != nil { t.Fatalf("expected error %s, got no error", testCase.ExpectedError.String()) diff --git a/internal/service/globalaccelerator/custom_routing_endpoint_group.go b/internal/service/globalaccelerator/custom_routing_endpoint_group.go index 4b7e2f58980b..a0789b36996b 100644 --- a/internal/service/globalaccelerator/custom_routing_endpoint_group.go +++ b/internal/service/globalaccelerator/custom_routing_endpoint_group.go @@ -125,7 +125,7 @@ func resourceCustomRoutingEndpointGroupCreate(ctx context.Context, d *schema.Res d.SetId(aws.StringValue(output.EndpointGroup.EndpointGroupArn)) - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -171,7 +171,7 @@ func resourceCustomRoutingEndpointGroupRead(ctx context.Context, d *schema.Resou return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Custom Routing Endpoint Group (%s): %s", d.Id(), err) } - listenerARN, err := EndpointGroupARNToListenerARN(d.Id()) + listenerARN, err := endpointGroupARNToListenerARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -207,7 +207,7 @@ func resourceCustomRoutingEndpointGroupDelete(ctx context.Context, d *schema.Res return sdkdiag.AppendErrorf(diags, "deleting Global Accelerator Custom Routing Endpoint Group (%s): %s", d.Id(), err) } - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) diff --git a/internal/service/globalaccelerator/custom_routing_listener.go b/internal/service/globalaccelerator/custom_routing_listener.go index 6862da3a2e64..25bf0aa00c04 100644 --- a/internal/service/globalaccelerator/custom_routing_listener.go +++ b/internal/service/globalaccelerator/custom_routing_listener.go @@ -112,7 +112,7 @@ func resourceCustomRoutingListenerRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Custom Routing Listener (%s): %s", d.Id(), err) } - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) diff --git a/internal/service/globalaccelerator/endpoint_group.go b/internal/service/globalaccelerator/endpoint_group.go index 7cb4e21839f9..d758b635a5ea 100644 --- a/internal/service/globalaccelerator/endpoint_group.go +++ b/internal/service/globalaccelerator/endpoint_group.go @@ -195,7 +195,7 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, me d.SetId(aws.StringValue(resp.EndpointGroup.EndpointGroupArn)) - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -225,7 +225,7 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Endpoint Group (%s): %s", d.Id(), err) } - listenerARN, err := EndpointGroupARNToListenerARN(d.Id()) + listenerARN, err := endpointGroupARNToListenerARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -301,7 +301,7 @@ func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, me return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Endpoint Group (%s): %s", d.Id(), err) } - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -332,7 +332,7 @@ func resourceEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, me return sdkdiag.AppendErrorf(diags, "deleting Global Accelerator Endpoint Group (%s): %s", d.Id(), err) } - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) diff --git a/internal/service/globalaccelerator/listener.go b/internal/service/globalaccelerator/listener.go index 07895de892d8..18f4b4309715 100644 --- a/internal/service/globalaccelerator/listener.go +++ b/internal/service/globalaccelerator/listener.go @@ -127,7 +127,7 @@ func resourceListenerRead(ctx context.Context, d *schema.ResourceData, meta inte return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Listener (%s): %s", d.Id(), err) } - acceleratorARN, err := ListenerOrEndpointGroupARNToAcceleratorARN(d.Id()) + acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) From ca5c417e1b2ce7323c42a146e5bb9b9acb444e2b Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 23 Apr 2024 11:49:19 -0500 Subject: [PATCH 095/137] aws_appintegration_event_integration: fix failing test --- internal/service/appintegrations/event_integration.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index ccf92b93568e..5a11eb496b0f 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -185,6 +185,10 @@ func resourceEventIntegrationDelete(ctx context.Context, d *schema.ResourceData, Name: aws.String(name), }) + if errs.IsA[*awstypes.ResourceNotFoundException](err) { + return diags + } + if err != nil { return sdkdiag.AppendErrorf(diags, "deleting EventIntegration (%s): %s", d.Id(), err) } From 6a815b2e6345ddc5d51a0edb0111311dbd81c16c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 13:26:59 -0400 Subject: [PATCH 096/137] r/aws_globalaccelerator_listener: Migrate to AWS SDK for GO v2. --- .../service/globalaccelerator/exports_test.go | 2 + .../service/globalaccelerator/listener.go | 105 ++++++++---------- .../globalaccelerator/listener_test.go | 8 +- .../globalaccelerator/service_package_gen.go | 3 +- 4 files changed, 53 insertions(+), 65 deletions(-) diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index d341722a046c..2df12350df7f 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -7,7 +7,9 @@ package globalaccelerator var ( ResourceAccelerator = resourceAccelerator ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + ResourceListener = resourceListener FindAcceleratorByARN = findAcceleratorByARN FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN + FindListenerByARN = findListenerByARN ) diff --git a/internal/service/globalaccelerator/listener.go b/internal/service/globalaccelerator/listener.go index 18f4b4309715..dfb5a3223299 100644 --- a/internal/service/globalaccelerator/listener.go +++ b/internal/service/globalaccelerator/listener.go @@ -8,21 +8,23 @@ import ( "log" "time" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -// @SDKResource("aws_globalaccelerator_listener") -func ResourceListener() *schema.Resource { +// @SDKResource("aws_globalaccelerator_listener", name="Listener") +func resourceListener() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceListenerCreate, ReadWithoutTimeout: resourceListenerRead, @@ -46,10 +48,10 @@ func ResourceListener() *schema.Resource { ForceNew: true, }, "client_affinity": { - Type: schema.TypeString, - Optional: true, - Default: globalaccelerator.ClientAffinityNone, - ValidateFunc: validation.StringInSlice(globalaccelerator.ClientAffinity_Values(), false), + Type: schema.TypeString, + Optional: true, + Default: awstypes.ClientAffinityNone, + ValidateDiagFunc: enum.Validate[awstypes.ClientAffinity](), }, "port_range": { Type: schema.TypeSet, @@ -72,9 +74,9 @@ func ResourceListener() *schema.Resource { }, }, "protocol": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice(globalaccelerator.Protocol_Values(), false), + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[awstypes.Protocol](), }, }, } @@ -82,29 +84,28 @@ func ResourceListener() *schema.Resource { func resourceListenerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) acceleratorARN := d.Get("accelerator_arn").(string) - input := &globalaccelerator.CreateListenerInput{ AcceleratorArn: aws.String(acceleratorARN), - ClientAffinity: aws.String(d.Get("client_affinity").(string)), + ClientAffinity: awstypes.ClientAffinity(d.Get("client_affinity").(string)), IdempotencyToken: aws.String(id.UniqueId()), PortRanges: expandPortRanges(d.Get("port_range").(*schema.Set).List()), - Protocol: aws.String(d.Get("protocol").(string)), + Protocol: awstypes.Protocol(d.Get("protocol").(string)), } - resp, err := conn.CreateListenerWithContext(ctx, input) + output, err := conn.CreateListener(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Listener: %s", err) } - d.SetId(aws.StringValue(resp.Listener.ListenerArn)) + d.SetId(aws.ToString(output.Listener.ListenerArn)) // Creating a listener triggers the accelerator to change status to InPending. if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceListenerRead(ctx, d, meta)...) @@ -112,10 +113,9 @@ func resourceListenerCreate(ctx context.Context, d *schema.ResourceData, meta in func resourceListenerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) - - listener, err := FindListenerByARN(ctx, conn, d.Id()) + listener, err := findListenerByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator Listener (%s) not found, removing from state", d.Id()) @@ -128,7 +128,6 @@ func resourceListenerRead(ctx context.Context, d *schema.ResourceData, meta inte } acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -145,18 +144,17 @@ func resourceListenerRead(ctx context.Context, d *schema.ResourceData, meta inte func resourceListenerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) acceleratorARN := d.Get("accelerator_arn").(string) - input := &globalaccelerator.UpdateListenerInput{ - ClientAffinity: aws.String(d.Get("client_affinity").(string)), + ClientAffinity: awstypes.ClientAffinity(d.Get("client_affinity").(string)), ListenerArn: aws.String(d.Id()), PortRanges: expandPortRanges(d.Get("port_range").(*schema.Set).List()), - Protocol: aws.String(d.Get("protocol").(string)), + Protocol: awstypes.Protocol(d.Get("protocol").(string)), } - _, err := conn.UpdateListenerWithContext(ctx, input) + _, err := conn.UpdateListener(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Listener (%s): %s", d.Id(), err) @@ -164,7 +162,7 @@ func resourceListenerUpdate(ctx context.Context, d *schema.ResourceData, meta in // Updating a listener triggers the accelerator to change status to InPending. if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceListenerRead(ctx, d, meta)...) @@ -172,16 +170,14 @@ func resourceListenerUpdate(ctx context.Context, d *schema.ResourceData, meta in func resourceListenerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) - acceleratorARN := d.Get("accelerator_arn").(string) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) log.Printf("[DEBUG] Deleting Global Accelerator Listener: %s", d.Id()) - _, err := conn.DeleteListenerWithContext(ctx, &globalaccelerator.DeleteListenerInput{ + _, err := conn.DeleteListener(ctx, &globalaccelerator.DeleteListenerInput{ ListenerArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeListenerNotFoundException) { + if errs.IsA[*awstypes.ListenerNotFoundException](err) { return diags } @@ -190,25 +186,22 @@ func resourceListenerDelete(ctx context.Context, d *schema.ResourceData, meta in } // Deleting a listener triggers the accelerator to change status to InPending. + acceleratorARN := d.Get("accelerator_arn").(string) if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutDelete)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return diags } -func FindListenerByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.Listener, error) { +func findListenerByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.Listener, error) { input := &globalaccelerator.DescribeListenerInput{ ListenerArn: aws.String(arn), } - return findListener(ctx, conn, input) -} - -func findListener(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeListenerInput) (*globalaccelerator.Listener, error) { - output, err := conn.DescribeListenerWithContext(ctx, input) + output, err := conn.DescribeListener(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeListenerNotFoundException) { + if errs.IsA[*awstypes.ListenerNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -226,30 +219,30 @@ func findListener(ctx context.Context, conn *globalaccelerator.GlobalAccelerator return output.Listener, nil } -func expandPortRange(tfMap map[string]interface{}) *globalaccelerator.PortRange { +func expandPortRange(tfMap map[string]interface{}) *awstypes.PortRange { if tfMap == nil { return nil } - apiObject := &globalaccelerator.PortRange{} + apiObject := &awstypes.PortRange{} if v, ok := tfMap["from_port"].(int); ok && v != 0 { - apiObject.FromPort = aws.Int64(int64(v)) + apiObject.FromPort = aws.Int32(int32(v)) } if v, ok := tfMap["to_port"].(int); ok && v != 0 { - apiObject.ToPort = aws.Int64(int64(v)) + apiObject.ToPort = aws.Int32(int32(v)) } return apiObject } -func expandPortRanges(tfList []interface{}) []*globalaccelerator.PortRange { +func expandPortRanges(tfList []interface{}) []awstypes.PortRange { if len(tfList) == 0 { return nil } - var apiObjects []*globalaccelerator.PortRange + var apiObjects []awstypes.PortRange for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]interface{}) @@ -264,13 +257,13 @@ func expandPortRanges(tfList []interface{}) []*globalaccelerator.PortRange { continue } - apiObjects = append(apiObjects, apiObject) + apiObjects = append(apiObjects, *apiObject) } return apiObjects } -func flattenPortRange(apiObject *globalaccelerator.PortRange) map[string]interface{} { +func flattenPortRange(apiObject *awstypes.PortRange) map[string]interface{} { if apiObject == nil { return nil } @@ -278,17 +271,17 @@ func flattenPortRange(apiObject *globalaccelerator.PortRange) map[string]interfa tfMap := map[string]interface{}{} if v := apiObject.FromPort; v != nil { - tfMap["from_port"] = aws.Int64Value(v) + tfMap["from_port"] = aws.ToInt32(v) } if v := apiObject.ToPort; v != nil { - tfMap["to_port"] = aws.Int64Value(v) + tfMap["to_port"] = aws.ToInt32(v) } return tfMap } -func flattenPortRanges(apiObjects []*globalaccelerator.PortRange) []interface{} { +func flattenPortRanges(apiObjects []awstypes.PortRange) []interface{} { if len(apiObjects) == 0 { return nil } @@ -296,11 +289,7 @@ func flattenPortRanges(apiObjects []*globalaccelerator.PortRange) []interface{} var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenPortRange(apiObject)) + tfList = append(tfList, flattenPortRange(&apiObject)) } return tfList diff --git a/internal/service/globalaccelerator/listener_test.go b/internal/service/globalaccelerator/listener_test.go index 0d39c5f000a3..7cb988d6aafa 100644 --- a/internal/service/globalaccelerator/listener_test.go +++ b/internal/service/globalaccelerator/listener_test.go @@ -112,16 +112,12 @@ func TestAccGlobalAcceleratorListener_update(t *testing.T) { func testAccCheckListenerExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Listener ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) _, err := tfglobalaccelerator.FindListenerByARN(ctx, conn, rs.Primary.ID) @@ -131,7 +127,7 @@ func testAccCheckListenerExists(ctx context.Context, n string) resource.TestChec func testAccCheckListenerDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_listener" { diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 6767f34bbd17..52fe2dad43a2 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -73,8 +73,9 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka TypeName: "aws_globalaccelerator_endpoint_group", }, { - Factory: ResourceListener, + Factory: resourceListener, TypeName: "aws_globalaccelerator_listener", + Name: "Listener", }, } } From b5e99b11bcff65a16d188bd6512a33af6d47a3b5 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 13:38:11 -0400 Subject: [PATCH 097/137] r/aws_globalaccelerator_endpoint_group: Migrate to AWS SDK for GO v2. --- .../globalaccelerator/endpoint_group.go | 142 ++++++++---------- .../globalaccelerator/endpoint_group_test.go | 34 ++--- .../service/globalaccelerator/exports_test.go | 1 + .../globalaccelerator/service_package_gen.go | 3 +- 4 files changed, 80 insertions(+), 100 deletions(-) diff --git a/internal/service/globalaccelerator/endpoint_group.go b/internal/service/globalaccelerator/endpoint_group.go index d758b635a5ea..5f8346f6391b 100644 --- a/internal/service/globalaccelerator/endpoint_group.go +++ b/internal/service/globalaccelerator/endpoint_group.go @@ -8,22 +8,24 @@ import ( "log" "time" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" ) -// @SDKResource("aws_globalaccelerator_endpoint_group") -func ResourceEndpointGroup() *schema.Resource { +// @SDKResource("aws_globalaccelerator_endpoint_group", name="Endpoint Group") +func resourceEndpointGroup() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceEndpointGroupCreate, ReadWithoutTimeout: resourceEndpointGroupRead, @@ -94,10 +96,10 @@ func ResourceEndpointGroup() *schema.Resource { ValidateFunc: validation.IsPortNumber, }, "health_check_protocol": { - Type: schema.TypeString, - Optional: true, - Default: globalaccelerator.HealthCheckProtocolTcp, - ValidateFunc: validation.StringInSlice(globalaccelerator.HealthCheckProtocol_Values(), false), + Type: schema.TypeString, + Optional: true, + Default: awstypes.HealthCheckProtocolTcp, + ValidateDiagFunc: enum.Validate[awstypes.HealthCheckProtocol](), }, "listener_arn": { Type: schema.TypeString, @@ -142,8 +144,7 @@ func ResourceEndpointGroup() *schema.Resource { func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.CreateEndpointGroupInput{ EndpointGroupRegion: aws.String(meta.(*conns.AWSClient).Region), @@ -160,7 +161,7 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, me } if v, ok := d.GetOk("health_check_interval_seconds"); ok { - input.HealthCheckIntervalSeconds = aws.Int64(int64(v.(int))) + input.HealthCheckIntervalSeconds = aws.Int32(int32(v.(int))) } if v, ok := d.GetOk("health_check_path"); ok { @@ -168,11 +169,11 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, me } if v, ok := d.GetOk("health_check_port"); ok { - input.HealthCheckPort = aws.Int64(int64(v.(int))) + input.HealthCheckPort = aws.Int32(int32(v.(int))) } if v, ok := d.GetOk("health_check_protocol"); ok { - input.HealthCheckProtocol = aws.String(v.(string)) + input.HealthCheckProtocol = awstypes.HealthCheckProtocol(v.(string)) } if v, ok := d.GetOk("port_override"); ok && v.(*schema.Set).Len() > 0 { @@ -180,29 +181,28 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, me } if v, ok := d.GetOk("threshold_count"); ok { - input.ThresholdCount = aws.Int64(int64(v.(int))) + input.ThresholdCount = aws.Int32(int32(v.(int))) } if v, ok := d.Get("traffic_dial_percentage").(float64); ok { - input.TrafficDialPercentage = aws.Float64(v) + input.TrafficDialPercentage = aws.Float32(float32(v)) } - resp, err := conn.CreateEndpointGroupWithContext(ctx, input) + output, err := conn.CreateEndpointGroup(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Endpoint Group: %s", err) } - d.SetId(aws.StringValue(resp.EndpointGroup.EndpointGroupArn)) + d.SetId(aws.ToString(output.EndpointGroup.EndpointGroupArn)) acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceEndpointGroupRead(ctx, d, meta)...) @@ -210,8 +210,7 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, me func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) endpointGroup, err := FindEndpointGroupByARN(ctx, conn, d.Id()) @@ -226,7 +225,6 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta } listenerARN, err := endpointGroupARNToListenerARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -252,8 +250,7 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.UpdateEndpointGroupInput{ EndpointGroupArn: aws.String(d.Id()), @@ -262,11 +259,11 @@ func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, me if v, ok := d.GetOk("endpoint_configuration"); ok && v.(*schema.Set).Len() > 0 { input.EndpointConfigurations = expandEndpointConfigurations(v.(*schema.Set).List()) } else { - input.EndpointConfigurations = []*globalaccelerator.EndpointConfiguration{} + input.EndpointConfigurations = []awstypes.EndpointConfiguration{} } if v, ok := d.GetOk("health_check_interval_seconds"); ok { - input.HealthCheckIntervalSeconds = aws.Int64(int64(v.(int))) + input.HealthCheckIntervalSeconds = aws.Int32(int32(v.(int))) } if v, ok := d.GetOk("health_check_path"); ok { @@ -274,41 +271,40 @@ func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, me } if v, ok := d.GetOk("health_check_port"); ok { - input.HealthCheckPort = aws.Int64(int64(v.(int))) + input.HealthCheckPort = aws.Int32(int32(v.(int))) } if v, ok := d.GetOk("health_check_protocol"); ok { - input.HealthCheckProtocol = aws.String(v.(string)) + input.HealthCheckProtocol = awstypes.HealthCheckProtocol(v.(string)) } if v, ok := d.GetOk("port_override"); ok && v.(*schema.Set).Len() > 0 { input.PortOverrides = expandPortOverrides(v.(*schema.Set).List()) } else { - input.PortOverrides = []*globalaccelerator.PortOverride{} + input.PortOverrides = []awstypes.PortOverride{} } if v, ok := d.GetOk("threshold_count"); ok { - input.ThresholdCount = aws.Int64(int64(v.(int))) + input.ThresholdCount = aws.Int32(int32(v.(int))) } if v, ok := d.Get("traffic_dial_percentage").(float64); ok { - input.TrafficDialPercentage = aws.Float64(v) + input.TrafficDialPercentage = aws.Float32(float32(v)) } - _, err := conn.UpdateEndpointGroupWithContext(ctx, input) + _, err := conn.UpdateEndpointGroup(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Endpoint Group (%s): %s", d.Id(), err) } acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceEndpointGroupRead(ctx, d, meta)...) @@ -316,15 +312,14 @@ func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, me func resourceEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) log.Printf("[DEBUG] Deleting Global Accelerator Endpoint Group: %s", d.Id()) - _, err := conn.DeleteEndpointGroupWithContext(ctx, &globalaccelerator.DeleteEndpointGroupInput{ + _, err := conn.DeleteEndpointGroup(ctx, &globalaccelerator.DeleteEndpointGroupInput{ EndpointGroupArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeEndpointGroupNotFoundException) { + if errs.IsA[*awstypes.EndpointGroupNotFoundException](err) { return diags } @@ -333,30 +328,25 @@ func resourceEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, me } acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } if _, err := waitAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutDelete)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Accelerator (%s) deploy: %s", acceleratorARN, err) } return diags } -func FindEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.EndpointGroup, error) { +func FindEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.EndpointGroup, error) { input := &globalaccelerator.DescribeEndpointGroupInput{ EndpointGroupArn: aws.String(arn), } - return findEndpointGroup(ctx, conn, input) -} - -func findEndpointGroup(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeEndpointGroupInput) (*globalaccelerator.EndpointGroup, error) { - output, err := conn.DescribeEndpointGroupWithContext(ctx, input) + output, err := conn.DescribeEndpointGroup(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeEndpointGroupNotFoundException) { + if errs.IsA[*awstypes.EndpointGroupNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -374,12 +364,12 @@ func findEndpointGroup(ctx context.Context, conn *globalaccelerator.GlobalAccele return output.EndpointGroup, nil } -func expandEndpointConfiguration(tfMap map[string]interface{}) *globalaccelerator.EndpointConfiguration { +func expandEndpointConfiguration(tfMap map[string]interface{}) *awstypes.EndpointConfiguration { if tfMap == nil { return nil } - apiObject := &globalaccelerator.EndpointConfiguration{} + apiObject := &awstypes.EndpointConfiguration{} if v, ok := tfMap["client_ip_preservation_enabled"].(bool); ok { apiObject.ClientIPPreservationEnabled = aws.Bool(v) @@ -390,18 +380,18 @@ func expandEndpointConfiguration(tfMap map[string]interface{}) *globalaccelerato } if v, ok := tfMap["weight"].(int); ok { - apiObject.Weight = aws.Int64(int64(v)) + apiObject.Weight = aws.Int32(int32(v)) } return apiObject } -func expandEndpointConfigurations(tfList []interface{}) []*globalaccelerator.EndpointConfiguration { +func expandEndpointConfigurations(tfList []interface{}) []awstypes.EndpointConfiguration { if len(tfList) == 0 { return nil } - var apiObjects []*globalaccelerator.EndpointConfiguration + var apiObjects []awstypes.EndpointConfiguration for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]interface{}) @@ -416,36 +406,36 @@ func expandEndpointConfigurations(tfList []interface{}) []*globalaccelerator.End continue } - apiObjects = append(apiObjects, apiObject) + apiObjects = append(apiObjects, *apiObject) } return apiObjects } -func expandPortOverride(tfMap map[string]interface{}) *globalaccelerator.PortOverride { +func expandPortOverride(tfMap map[string]interface{}) *awstypes.PortOverride { if tfMap == nil { return nil } - apiObject := &globalaccelerator.PortOverride{} + apiObject := &awstypes.PortOverride{} if v, ok := tfMap["endpoint_port"].(int); ok && v != 0 { - apiObject.EndpointPort = aws.Int64(int64(v)) + apiObject.EndpointPort = aws.Int32(int32(v)) } if v, ok := tfMap["listener_port"].(int); ok && v != 0 { - apiObject.ListenerPort = aws.Int64(int64(v)) + apiObject.ListenerPort = aws.Int32(int32(v)) } return apiObject } -func expandPortOverrides(tfList []interface{}) []*globalaccelerator.PortOverride { +func expandPortOverrides(tfList []interface{}) []awstypes.PortOverride { if len(tfList) == 0 { return nil } - var apiObjects []*globalaccelerator.PortOverride + var apiObjects []awstypes.PortOverride for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]interface{}) @@ -460,13 +450,13 @@ func expandPortOverrides(tfList []interface{}) []*globalaccelerator.PortOverride continue } - apiObjects = append(apiObjects, apiObject) + apiObjects = append(apiObjects, *apiObject) } return apiObjects } -func flattenEndpointDescription(apiObject *globalaccelerator.EndpointDescription) map[string]interface{} { +func flattenEndpointDescription(apiObject *awstypes.EndpointDescription) map[string]interface{} { if apiObject == nil { return nil } @@ -474,21 +464,21 @@ func flattenEndpointDescription(apiObject *globalaccelerator.EndpointDescription tfMap := map[string]interface{}{} if v := apiObject.ClientIPPreservationEnabled; v != nil { - tfMap["client_ip_preservation_enabled"] = aws.BoolValue(v) + tfMap["client_ip_preservation_enabled"] = aws.ToBool(v) } if v := apiObject.EndpointId; v != nil { - tfMap["endpoint_id"] = aws.StringValue(v) + tfMap["endpoint_id"] = aws.ToString(v) } if v := apiObject.Weight; v != nil { - tfMap["weight"] = aws.Int64Value(v) + tfMap["weight"] = aws.ToInt32(v) } return tfMap } -func flattenEndpointDescriptions(apiObjects []*globalaccelerator.EndpointDescription) []interface{} { +func flattenEndpointDescriptions(apiObjects []awstypes.EndpointDescription) []interface{} { if len(apiObjects) == 0 { return nil } @@ -496,17 +486,13 @@ func flattenEndpointDescriptions(apiObjects []*globalaccelerator.EndpointDescrip var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenEndpointDescription(apiObject)) + tfList = append(tfList, flattenEndpointDescription(&apiObject)) } return tfList } -func flattenPortOverride(apiObject *globalaccelerator.PortOverride) map[string]interface{} { +func flattenPortOverride(apiObject *awstypes.PortOverride) map[string]interface{} { if apiObject == nil { return nil } @@ -514,17 +500,17 @@ func flattenPortOverride(apiObject *globalaccelerator.PortOverride) map[string]i tfMap := map[string]interface{}{} if v := apiObject.EndpointPort; v != nil { - tfMap["endpoint_port"] = aws.Int64Value(v) + tfMap["endpoint_port"] = aws.ToInt32(v) } if v := apiObject.ListenerPort; v != nil { - tfMap["listener_port"] = aws.Int64Value(v) + tfMap["listener_port"] = aws.ToInt32(v) } return tfMap } -func flattenPortOverrides(apiObjects []*globalaccelerator.PortOverride) []interface{} { +func flattenPortOverrides(apiObjects []awstypes.PortOverride) []interface{} { if len(apiObjects) == 0 { return nil } @@ -532,11 +518,7 @@ func flattenPortOverrides(apiObjects []*globalaccelerator.PortOverride) []interf var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenPortOverride(apiObject)) + tfList = append(tfList, flattenPortOverride(&apiObject)) } return tfList diff --git a/internal/service/globalaccelerator/endpoint_group_test.go b/internal/service/globalaccelerator/endpoint_group_test.go index 94a0d7e3f225..daba75804e60 100644 --- a/internal/service/globalaccelerator/endpoint_group_test.go +++ b/internal/service/globalaccelerator/endpoint_group_test.go @@ -9,9 +9,9 @@ import ( "testing" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go-v2/aws" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/globalaccelerator" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -25,7 +25,7 @@ import ( func TestAccGlobalAcceleratorEndpointGroup_basic(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -63,7 +63,7 @@ func TestAccGlobalAcceleratorEndpointGroup_basic(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_disappears(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -87,7 +87,7 @@ func TestAccGlobalAcceleratorEndpointGroup_disappears(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_ALBEndpoint_clientIP(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup var vpc ec2.Vpc resourceName := "aws_globalaccelerator_endpoint_group.test" albResourceName := "aws_lb.test" @@ -162,7 +162,7 @@ func TestAccGlobalAcceleratorEndpointGroup_ALBEndpoint_clientIP(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_instanceEndpoint(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup var vpc ec2.Vpc resourceName := "aws_globalaccelerator_endpoint_group.test" instanceResourceName := "aws_instance.test" @@ -215,7 +215,7 @@ func TestAccGlobalAcceleratorEndpointGroup_instanceEndpoint(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_multiRegion(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" eipResourceName := "aws_eip.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -259,7 +259,7 @@ func TestAccGlobalAcceleratorEndpointGroup_multiRegion(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_portOverrides(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -326,7 +326,7 @@ func TestAccGlobalAcceleratorEndpointGroup_portOverrides(t *testing.T) { func TestAccGlobalAcceleratorEndpointGroup_tcpHealthCheckProtocol(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" eipResourceName := "aws_eip.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -370,7 +370,7 @@ func TestAccGlobalAcceleratorEndpointGroup_tcpHealthCheckProtocol(t *testing.T) func TestAccGlobalAcceleratorEndpointGroup_update(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.EndpointGroup + var v awstypes.EndpointGroup resourceName := "aws_globalaccelerator_endpoint_group.test" eipResourceName := "aws_eip.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -429,18 +429,14 @@ func TestAccGlobalAcceleratorEndpointGroup_update(t *testing.T) { }) } -func testAccCheckEndpointGroupExists(ctx context.Context, name string, v *globalaccelerator.EndpointGroup) resource.TestCheckFunc { +func testAccCheckEndpointGroupExists(ctx context.Context, name string, v *awstypes.EndpointGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[name] if !ok { return fmt.Errorf("Not found: %s", name) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Endpoint Group ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) endpointGroup, err := tfglobalaccelerator.FindEndpointGroupByARN(ctx, conn, rs.Primary.ID) @@ -456,7 +452,7 @@ func testAccCheckEndpointGroupExists(ctx context.Context, name string, v *global func testAccCheckEndpointGroupDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_endpoint_group" { @@ -486,7 +482,7 @@ func testAccCheckEndpointGroupDeleteSecurityGroup(ctx context.Context, vpc *ec2. meta := acctest.Provider.Meta() conn := meta.(*conns.AWSClient).EC2Conn(ctx) - v, err := tfec2.FindSecurityGroupByNameAndVPCIDAndOwnerID(ctx, conn, "GlobalAccelerator", aws.StringValue(vpc.VpcId), aws.StringValue(vpc.OwnerId)) + v, err := tfec2.FindSecurityGroupByNameAndVPCIDAndOwnerID(ctx, conn, "GlobalAccelerator", aws.ToString(vpc.VpcId), aws.ToString(vpc.OwnerId)) if tfresource.NotFound(err) { // Already gone. @@ -499,7 +495,7 @@ func testAccCheckEndpointGroupDeleteSecurityGroup(ctx context.Context, vpc *ec2. r := tfec2.ResourceSecurityGroup() d := r.Data(nil) - d.SetId(aws.StringValue(v.GroupId)) + d.SetId(aws.ToString(v.GroupId)) d.Set("revoke_rules_on_delete", true) err = acctest.DeleteResource(ctx, r, d, meta) diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index 2df12350df7f..d430e69de713 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -7,6 +7,7 @@ package globalaccelerator var ( ResourceAccelerator = resourceAccelerator ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + ResourceEndpointGroup = resourceEndpointGroup ResourceListener = resourceListener FindAcceleratorByARN = findAcceleratorByARN diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 52fe2dad43a2..ba475605fd28 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -69,8 +69,9 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka TypeName: "aws_globalaccelerator_custom_routing_listener", }, { - Factory: ResourceEndpointGroup, + Factory: resourceEndpointGroup, TypeName: "aws_globalaccelerator_endpoint_group", + Name: "Endpoint Group", }, { Factory: resourceListener, From a3c0f4474e69aac81aa7130f9de85410794819c5 Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:39:09 -0500 Subject: [PATCH 098/137] Replace Terraform Cloud with HCP Terraform --- .../continuous-validation-examples.html.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/website/docs/guides/continuous-validation-examples.html.markdown b/website/docs/guides/continuous-validation-examples.html.markdown index 048aeec1b2dc..9e69bb5878ee 100644 --- a/website/docs/guides/continuous-validation-examples.html.markdown +++ b/website/docs/guides/continuous-validation-examples.html.markdown @@ -1,16 +1,16 @@ --- subcategory: "" layout: "aws" -page_title: "Using Terraform Cloud's Continuous Validation feature with the AWS Provider" +page_title: "Using HCP Terraform's Continuous Validation feature with the AWS Provider" description: |- - Using Terraform Cloud's Continuous Validation feature with the AWS Provider + Using HCP Terraform's Continuous Validation feature with the AWS Provider --- -# Using Terraform Cloud's Continuous Validation feature with the AWS Provider +# Using HCP Terraform's Continuous Validation feature with the AWS Provider -## Continuous Validation in Terraform Cloud +## Continuous Validation in HCP Terraform -The Continuous Validation feature in Terraform Cloud (TFC) allows users to make assertions about their infrastructure between applied runs. This helps users to identify issues at the time they first appear and avoid situations where a change is only identified once it causes a customer-facing problem. +The Continuous Validation feature in HCP Terraform allows users to make assertions about their infrastructure between applied runs. This helps users to identify issues at the time they first appear and avoid situations where a change is only identified once it causes a customer-facing problem. Users can add checks to their Terraform configuration using check blocks. Check blocks contain assertions that are defined with a custom condition expression and an error message. When the condition expression evaluates to true the check passes, but when the expression evaluates to false Terraform will show a warning message that includes the user-defined error message. @@ -54,12 +54,12 @@ If the budget exceeds the set limit, the check block assertion will return a war ``` │ Warning: Check block assertion failed -│ +│ │ on main.tf line 43, in check "check_budget_exceeded": │ 43: condition = !data.aws_budgets_budget.example.budget_exceeded │ ├──────────────── │ │ data.aws_budgets_budget.example.budget_exceeded is true -│ +│ │ AWS budget has been exceeded! Calculated spend: '1550.0' and budget limit: '1200.0' ``` From 3d4bedd482c8832343b814f33172d30dc37e7b54 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 15:23:53 -0400 Subject: [PATCH 099/137] r/aws_globalaccelerator_custom_routing_listener: Migrate to AWS SDK for GO v2. --- .../custom_routing_listener.go | 53 +++++++++---------- .../custom_routing_listener_test.go | 16 +++--- .../service/globalaccelerator/exports_test.go | 2 + .../globalaccelerator/service_package_gen.go | 3 +- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/internal/service/globalaccelerator/custom_routing_listener.go b/internal/service/globalaccelerator/custom_routing_listener.go index 25bf0aa00c04..3f4e50137ca8 100644 --- a/internal/service/globalaccelerator/custom_routing_listener.go +++ b/internal/service/globalaccelerator/custom_routing_listener.go @@ -8,21 +8,22 @@ import ( "log" "time" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -// @SDKResource("aws_globalaccelerator_custom_routing_listener") -func ResourceCustomRoutingListener() *schema.Resource { +// @SDKResource("aws_globalaccelerator_custom_routing_listener", name="Custom Routing Listener") +func resourceCustomRoutingListener() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceCustomRoutingListenerCreate, ReadWithoutTimeout: resourceCustomRoutingListenerRead, @@ -71,7 +72,7 @@ func ResourceCustomRoutingListener() *schema.Resource { func resourceCustomRoutingListenerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) acceleratorARN := d.Get("accelerator_arn").(string) input := &globalaccelerator.CreateCustomRoutingListenerInput{ @@ -80,17 +81,17 @@ func resourceCustomRoutingListenerCreate(ctx context.Context, d *schema.Resource PortRanges: expandPortRanges(d.Get("port_range").(*schema.Set).List()), } - output, err := conn.CreateCustomRoutingListenerWithContext(ctx, input) + output, err := conn.CreateCustomRoutingListener(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Custom Routing Listener: %s", err) } - d.SetId(aws.StringValue(output.Listener.ListenerArn)) + d.SetId(aws.ToString(output.Listener.ListenerArn)) // Creating a listener triggers the accelerator to change status to InPending. if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceCustomRoutingListenerRead(ctx, d, meta)...) @@ -98,9 +99,9 @@ func resourceCustomRoutingListenerCreate(ctx context.Context, d *schema.Resource func resourceCustomRoutingListenerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - listener, err := FindCustomRoutingListenerByARN(ctx, conn, d.Id()) + listener, err := findCustomRoutingListenerByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator Custom Routing Listener (%s) not found, removing from state", d.Id()) @@ -113,7 +114,6 @@ func resourceCustomRoutingListenerRead(ctx context.Context, d *schema.ResourceDa } acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -128,15 +128,15 @@ func resourceCustomRoutingListenerRead(ctx context.Context, d *schema.ResourceDa func resourceCustomRoutingListenerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) - acceleratorARN := d.Get("accelerator_arn").(string) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) + acceleratorARN := d.Get("accelerator_arn").(string) input := &globalaccelerator.UpdateCustomRoutingListenerInput{ ListenerArn: aws.String(d.Id()), PortRanges: expandPortRanges(d.Get("port_range").(*schema.Set).List()), } - _, err := conn.UpdateCustomRoutingListenerWithContext(ctx, input) + _, err := conn.UpdateCustomRoutingListener(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Custom Routing Listener (%s): %s", d.Id(), err) @@ -144,7 +144,7 @@ func resourceCustomRoutingListenerUpdate(ctx context.Context, d *schema.Resource // Updating a listener triggers the accelerator to change status to InPending. if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } return append(diags, resourceCustomRoutingListenerRead(ctx, d, meta)...) @@ -152,16 +152,14 @@ func resourceCustomRoutingListenerUpdate(ctx context.Context, d *schema.Resource func resourceCustomRoutingListenerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) - - acceleratorARN := d.Get("accelerator_arn").(string) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) log.Printf("[DEBUG] Deleting Global Accelerator Custom Routing Listener (%s)", d.Id()) - _, err := conn.DeleteCustomRoutingListenerWithContext(ctx, &globalaccelerator.DeleteCustomRoutingListenerInput{ + _, err := conn.DeleteCustomRoutingListener(ctx, &globalaccelerator.DeleteCustomRoutingListenerInput{ ListenerArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeListenerNotFoundException) { + if errs.IsA[*awstypes.ListenerNotFoundException](err) { return diags } @@ -170,25 +168,22 @@ func resourceCustomRoutingListenerDelete(ctx context.Context, d *schema.Resource } // Deleting a listener triggers the accelerator to change status to InPending. + acceleratorARN := d.Get("accelerator_arn").(string) if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutDelete)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } return diags } -func FindCustomRoutingListenerByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.CustomRoutingListener, error) { +func findCustomRoutingListenerByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.CustomRoutingListener, error) { input := &globalaccelerator.DescribeCustomRoutingListenerInput{ ListenerArn: aws.String(arn), } - return findCustomRoutingListener(ctx, conn, input) -} - -func findCustomRoutingListener(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCustomRoutingListenerInput) (*globalaccelerator.CustomRoutingListener, error) { - output, err := conn.DescribeCustomRoutingListenerWithContext(ctx, input) + output, err := conn.DescribeCustomRoutingListener(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeListenerNotFoundException) { + if errs.IsA[*awstypes.ListenerNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, diff --git a/internal/service/globalaccelerator/custom_routing_listener_test.go b/internal/service/globalaccelerator/custom_routing_listener_test.go index 426776943ae6..157500351cbc 100644 --- a/internal/service/globalaccelerator/custom_routing_listener_test.go +++ b/internal/service/globalaccelerator/custom_routing_listener_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -21,7 +21,7 @@ import ( func TestAccGlobalAcceleratorCustomRoutingListener_basic(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingListener + var v awstypes.CustomRoutingListener resourceName := "aws_globalaccelerator_custom_routing_listener.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -57,7 +57,7 @@ func TestAccGlobalAcceleratorCustomRoutingListener_basic(t *testing.T) { func TestAccGlobalAcceleratorCustomRoutingListener_disappears(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingListener + var v awstypes.CustomRoutingListener resourceName := "aws_globalaccelerator_custom_routing_listener.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -79,18 +79,14 @@ func TestAccGlobalAcceleratorCustomRoutingListener_disappears(t *testing.T) { }) } -func testAccCheckCustomRoutingListenerExists(ctx context.Context, n string, v *globalaccelerator.CustomRoutingListener) resource.TestCheckFunc { +func testAccCheckCustomRoutingListenerExists(ctx context.Context, n string, v *awstypes.CustomRoutingListener) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Custom Routing Listener ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) output, err := tfglobalaccelerator.FindCustomRoutingListenerByARN(ctx, conn, rs.Primary.ID) @@ -106,7 +102,7 @@ func testAccCheckCustomRoutingListenerExists(ctx context.Context, n string, v *g func testAccCheckCustomRoutingListenerDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_custom_routing_listener" { diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index d430e69de713..56e06b25568e 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -7,10 +7,12 @@ package globalaccelerator var ( ResourceAccelerator = resourceAccelerator ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + ResourceCustomRoutingListener = resourceCustomRoutingListener ResourceEndpointGroup = resourceEndpointGroup ResourceListener = resourceListener FindAcceleratorByARN = findAcceleratorByARN FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN + FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN FindListenerByARN = findListenerByARN ) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index ba475605fd28..412e8c2c0f3f 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -65,8 +65,9 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka TypeName: "aws_globalaccelerator_custom_routing_endpoint_group", }, { - Factory: ResourceCustomRoutingListener, + Factory: resourceCustomRoutingListener, TypeName: "aws_globalaccelerator_custom_routing_listener", + Name: "Custom Routing Listener", }, { Factory: resourceEndpointGroup, From 3500bd6ab91464e31935ee7a912fdf39434fe083 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 15:32:29 -0400 Subject: [PATCH 100/137] r/aws_globalaccelerator_custom_routing_accelerator: Migrate to AWS SDK for GO v2. --- .../custom_routing_accelerator.go | 110 +++++++++--------- .../custom_routing_accelerator_data_source.go | 2 +- .../custom_routing_accelerator_test.go | 8 +- .../service/globalaccelerator/exports_test.go | 20 ++-- .../globalaccelerator/service_package_gen.go | 2 +- 5 files changed, 67 insertions(+), 75 deletions(-) diff --git a/internal/service/globalaccelerator/custom_routing_accelerator.go b/internal/service/globalaccelerator/custom_routing_accelerator.go index 4563c437c637..444de99c2cac 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator.go @@ -9,15 +9,17 @@ import ( "time" "github.com/YakDriver/regexache" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" @@ -28,7 +30,7 @@ import ( // @SDKResource("aws_globalaccelerator_custom_routing_accelerator", name="Custom Routing Accelerator") // @Tags(identifierAttribute="id") -func ResourceCustomRoutingAccelerator() *schema.Resource { +func resourceCustomRoutingAccelerator() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceCustomRoutingAcceleratorCreate, ReadWithoutTimeout: resourceCustomRoutingAcceleratorRead, @@ -84,10 +86,10 @@ func ResourceCustomRoutingAccelerator() *schema.Resource { Computed: true, }, "ip_address_type": { - Type: schema.TypeString, - Optional: true, - Default: globalaccelerator.IpAddressTypeIpv4, - ValidateFunc: validation.StringInSlice(globalaccelerator.IpAddressType_Values(), false), + Type: schema.TypeString, + Optional: true, + Default: awstypes.IpAddressTypeIpv4, + ValidateDiagFunc: enum.Validate[awstypes.IpAddressType](), }, "ip_addresses": { Type: schema.TypeList, @@ -132,46 +134,46 @@ func ResourceCustomRoutingAccelerator() *schema.Resource { func resourceCustomRoutingAcceleratorCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) name := d.Get("name").(string) input := &globalaccelerator.CreateCustomRoutingAcceleratorInput{ + Enabled: aws.Bool(d.Get("enabled").(bool)), Name: aws.String(name), IdempotencyToken: aws.String(id.UniqueId()), - Enabled: aws.Bool(d.Get("enabled").(bool)), Tags: getTagsIn(ctx), } if v, ok := d.GetOk("ip_address_type"); ok { - input.IpAddressType = aws.String(v.(string)) + input.IpAddressType = awstypes.IpAddressType(v.(string)) } if v, ok := d.GetOk("ip_addresses"); ok && len(v.([]interface{})) > 0 { - input.IpAddresses = flex.ExpandStringList(v.([]interface{})) + input.IpAddresses = flex.ExpandStringValueList(v.([]interface{})) } - output, err := conn.CreateCustomRoutingAcceleratorWithContext(ctx, input) + output, err := conn.CreateCustomRoutingAccelerator(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Custom Routing Accelerator (%s): %s", name, err) } - d.SetId(aws.StringValue(output.Accelerator.AcceleratorArn)) + d.SetId(aws.ToString(output.Accelerator.AcceleratorArn)) if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } if v, ok := d.GetOk("attributes"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input := expandUpdateAcceleratorAttributesInput(v.([]interface{})[0].(map[string]interface{})) input.AcceleratorArn = aws.String(d.Id()) - if _, err := conn.UpdateAcceleratorAttributesWithContext(ctx, input); err != nil { + if _, err := conn.UpdateAcceleratorAttributes(ctx, input); err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Custom Routing Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } } @@ -180,9 +182,9 @@ func resourceCustomRoutingAcceleratorCreate(ctx context.Context, d *schema.Resou func resourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - accelerator, err := FindCustomRoutingAcceleratorByARN(ctx, conn, d.Id()) + accelerator, err := findCustomRoutingAcceleratorByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator Custom Routing Accelerator (%s) not found, removing from state", d.Id()) @@ -203,7 +205,7 @@ func resourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resourc } d.Set("name", accelerator.Name) - acceleratorAttributes, err := FindCustomRoutingAcceleratorAttributesByARN(ctx, conn, d.Id()) + acceleratorAttributes, err := findCustomRoutingAcceleratorAttributesByARN(ctx, conn, d.Id()) if err != nil { return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Custom Routing Accelerator (%s) attributes: %s", d.Id(), err) @@ -218,7 +220,7 @@ func resourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resourc func resourceCustomRoutingAcceleratorUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) if d.HasChanges("name", "ip_address_type", "enabled") { input := &globalaccelerator.UpdateCustomRoutingAcceleratorInput{ @@ -228,17 +230,17 @@ func resourceCustomRoutingAcceleratorUpdate(ctx context.Context, d *schema.Resou } if v, ok := d.GetOk("ip_address_type"); ok { - input.IpAddressType = aws.String(v.(string)) + input.IpAddressType = awstypes.IpAddressType(v.(string)) } - _, err := conn.UpdateCustomRoutingAcceleratorWithContext(ctx, input) + _, err := conn.UpdateCustomRoutingAccelerator(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Custom Routing Accelerator (%s): %s", d.Id(), err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } } @@ -252,28 +254,28 @@ func resourceCustomRoutingAcceleratorUpdate(ctx context.Context, d *schema.Resou nInput.AcceleratorArn = aws.String(d.Id()) // To change flow logs bucket and prefix attributes while flows are enabled, first disable flow logs. - if aws.BoolValue(oInput.FlowLogsEnabled) && aws.BoolValue(nInput.FlowLogsEnabled) { + if aws.ToBool(oInput.FlowLogsEnabled) && aws.ToBool(nInput.FlowLogsEnabled) { oInput.FlowLogsEnabled = aws.Bool(false) - _, err := conn.UpdateCustomRoutingAcceleratorAttributesWithContext(ctx, oInput) + _, err := conn.UpdateCustomRoutingAcceleratorAttributes(ctx, oInput) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Custom Routing Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } } - _, err := conn.UpdateCustomRoutingAcceleratorAttributesWithContext(ctx, nInput) + _, err := conn.UpdateCustomRoutingAcceleratorAttributes(ctx, nInput) if err != nil { return sdkdiag.AppendErrorf(diags, "updating Global Accelerator Custom Routing Accelerator (%s) attributes: %s", d.Id(), err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } } } @@ -284,16 +286,16 @@ func resourceCustomRoutingAcceleratorUpdate(ctx context.Context, d *schema.Resou func resourceCustomRoutingAcceleratorDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.UpdateCustomRoutingAcceleratorInput{ AcceleratorArn: aws.String(d.Id()), Enabled: aws.Bool(false), } - _, err := conn.UpdateCustomRoutingAcceleratorWithContext(ctx, input) + _, err := conn.UpdateCustomRoutingAccelerator(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return diags } @@ -302,15 +304,15 @@ func resourceCustomRoutingAcceleratorDelete(ctx context.Context, d *schema.Resou } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", d.Id(), err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", d.Id(), err) } log.Printf("[DEBUG] Deleting Global Accelerator Custom Routing Accelerator (%s)", d.Id()) - _, err = conn.DeleteCustomRoutingAcceleratorWithContext(ctx, &globalaccelerator.DeleteCustomRoutingAcceleratorInput{ + _, err = conn.DeleteCustomRoutingAccelerator(ctx, &globalaccelerator.DeleteCustomRoutingAcceleratorInput{ AcceleratorArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return diags } @@ -321,18 +323,14 @@ func resourceCustomRoutingAcceleratorDelete(ctx context.Context, d *schema.Resou return diags } -func FindCustomRoutingAcceleratorByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.CustomRoutingAccelerator, error) { +func findCustomRoutingAcceleratorByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.CustomRoutingAccelerator, error) { input := &globalaccelerator.DescribeCustomRoutingAcceleratorInput{ AcceleratorArn: aws.String(arn), } - return findCustomRoutingAccelerator(ctx, conn, input) -} + output, err := conn.DescribeCustomRoutingAccelerator(ctx, input) -func findCustomRoutingAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCustomRoutingAcceleratorInput) (*globalaccelerator.CustomRoutingAccelerator, error) { - output, err := conn.DescribeCustomRoutingAcceleratorWithContext(ctx, input) - - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -350,18 +348,14 @@ func findCustomRoutingAccelerator(ctx context.Context, conn *globalaccelerator.G return output.Accelerator, nil } -func FindCustomRoutingAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.CustomRoutingAcceleratorAttributes, error) { +func findCustomRoutingAcceleratorAttributesByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.CustomRoutingAcceleratorAttributes, error) { input := &globalaccelerator.DescribeCustomRoutingAcceleratorAttributesInput{ AcceleratorArn: aws.String(arn), } - return findCustomRoutingAcceleratorAttributes(ctx, conn, input) -} - -func findCustomRoutingAcceleratorAttributes(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCustomRoutingAcceleratorAttributesInput) (*globalaccelerator.CustomRoutingAcceleratorAttributes, error) { - output, err := conn.DescribeCustomRoutingAcceleratorAttributesWithContext(ctx, input) + output, err := conn.DescribeCustomRoutingAcceleratorAttributes(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAcceleratorNotFoundException) { + if errs.IsA[*awstypes.AcceleratorNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -379,9 +373,9 @@ func findCustomRoutingAcceleratorAttributes(ctx context.Context, conn *globalacc return output.AcceleratorAttributes, nil } -func statusCustomRoutingAccelerator(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) retry.StateRefreshFunc { +func statusCustomRoutingAccelerator(ctx context.Context, conn *globalaccelerator.Client, arn string) retry.StateRefreshFunc { return func() (interface{}, string, error) { - accelerator, err := FindCustomRoutingAcceleratorByARN(ctx, conn, arn) + accelerator, err := findCustomRoutingAcceleratorByARN(ctx, conn, arn) if tfresource.NotFound(err) { return nil, "", nil @@ -391,21 +385,21 @@ func statusCustomRoutingAccelerator(ctx context.Context, conn *globalaccelerator return nil, "", err } - return accelerator, aws.StringValue(accelerator.Status), nil + return accelerator, string(accelerator.Status), nil } } -func waitCustomRoutingAcceleratorDeployed(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string, timeout time.Duration) (*globalaccelerator.CustomRoutingAccelerator, error) { //nolint:unparam +func waitCustomRoutingAcceleratorDeployed(ctx context.Context, conn *globalaccelerator.Client, arn string, timeout time.Duration) (*awstypes.CustomRoutingAccelerator, error) { //nolint:unparam stateConf := &retry.StateChangeConf{ - Pending: []string{globalaccelerator.AcceleratorStatusInProgress}, - Target: []string{globalaccelerator.AcceleratorStatusDeployed}, + Pending: enum.Slice(awstypes.AcceleratorStatusInProgress), + Target: enum.Slice(awstypes.AcceleratorStatusDeployed), Refresh: statusCustomRoutingAccelerator(ctx, conn, arn), Timeout: timeout, } outputRaw, err := stateConf.WaitForStateContext(ctx) - if output, ok := outputRaw.(*globalaccelerator.CustomRoutingAccelerator); ok { + if output, ok := outputRaw.(*awstypes.CustomRoutingAccelerator); ok { return output, err } @@ -416,6 +410,6 @@ func expandUpdateCustomRoutingAcceleratorAttributesInput(tfMap map[string]interf return (*globalaccelerator.UpdateCustomRoutingAcceleratorAttributesInput)(expandUpdateAcceleratorAttributesInput(tfMap)) } -func flattenCustomRoutingAcceleratorAttributes(apiObject *globalaccelerator.CustomRoutingAcceleratorAttributes) map[string]interface{} { - return flattenAcceleratorAttributes((*globalaccelerator.AcceleratorAttributes)(apiObject)) +func flattenCustomRoutingAcceleratorAttributes(apiObject *awstypes.CustomRoutingAcceleratorAttributes) map[string]interface{} { + return flattenAcceleratorAttributes((*awstypes.AcceleratorAttributes)(apiObject)) } diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go index 4a10c5ef5a0a..d0901a3defae 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go @@ -140,7 +140,7 @@ func dataSourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resou } d.Set("name", accelerator.Name) - acceleratorAttributes, err := FindCustomRoutingAcceleratorAttributesByARN(ctx, conn, d.Id()) + acceleratorAttributes, err := findCustomRoutingAcceleratorAttributesByARN(ctx, conn, d.Id()) if err != nil { return sdkdiag.AppendErrorf(diags, "reading Global Accelerator Custom Routing Accelerator (%s) attributes: %s", d.Id(), err) diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_test.go b/internal/service/globalaccelerator/custom_routing_accelerator_test.go index 845f39f5612b..dff9a1406139 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_test.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_test.go @@ -168,16 +168,12 @@ func TestAccGlobalAcceleratorCustomRoutingAccelerator_update(t *testing.T) { func testAccCheckCustomRoutingAcceleratorExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Custom Routing Accelerator ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) _, err := tfglobalaccelerator.FindCustomRoutingAcceleratorByARN(ctx, conn, rs.Primary.ID) @@ -187,7 +183,7 @@ func testAccCheckCustomRoutingAcceleratorExists(ctx context.Context, n string) r func testAccCheckCustomRoutingAcceleratorDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_custom_routing_accelerator" { diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index 56e06b25568e..0581232fc164 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -5,14 +5,16 @@ package globalaccelerator // Exports for use in tests only. var ( - ResourceAccelerator = resourceAccelerator - ResourceCrossAccountAttachment = newCrossAccountAttachmentResource - ResourceCustomRoutingListener = resourceCustomRoutingListener - ResourceEndpointGroup = resourceEndpointGroup - ResourceListener = resourceListener + ResourceAccelerator = resourceAccelerator + ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + ResourceCustomRoutingAccelerator = resourceCustomRoutingAccelerator + ResourceCustomRoutingListener = resourceCustomRoutingListener + ResourceEndpointGroup = resourceEndpointGroup + ResourceListener = resourceListener - FindAcceleratorByARN = findAcceleratorByARN - FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN - FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN - FindListenerByARN = findListenerByARN + FindAcceleratorByARN = findAcceleratorByARN + FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN + FindCustomRoutingAcceleratorByARN = findCustomRoutingAcceleratorByARN + FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN + FindListenerByARN = findListenerByARN ) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index 412e8c2c0f3f..d58c7963b61b 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceCustomRoutingAccelerator, + Factory: resourceCustomRoutingAccelerator, TypeName: "aws_globalaccelerator_custom_routing_accelerator", Name: "Custom Routing Accelerator", Tags: &types.ServicePackageResourceTags{ From e88cd40f3b239926415edca979679d561ba89e05 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 15:38:14 -0400 Subject: [PATCH 101/137] d/aws_globalaccelerator_custom_routing_accelerator: Migrate to AWS SDK for GO v2. --- .../custom_routing_accelerator_data_source.go | 41 ++++++++----------- .../globalaccelerator/service_package_gen.go | 3 +- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go index d0901a3defae..7d22888cf8c7 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go @@ -6,8 +6,9 @@ package globalaccelerator import ( "context" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -15,8 +16,8 @@ import ( tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" ) -// @SDKDataSource("aws_globalaccelerator_custom_routing_accelerator") -func DataSourceCustomRoutingAccelerator() *schema.Resource { +// @SDKDataSource("aws_globalaccelerator_custom_routing_accelerator", name="Custom Routing Accelerator") +func dataSourceCustomRoutingAccelerator() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceCustomRoutingAcceleratorRead, @@ -91,37 +92,29 @@ func DataSourceCustomRoutingAccelerator() *schema.Resource { func dataSourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig - var results []*globalaccelerator.CustomRoutingAccelerator + var results []awstypes.CustomRoutingAccelerator + pages := globalaccelerator.NewListCustomRoutingAcceleratorsPaginator(conn, &globalaccelerator.ListCustomRoutingAcceleratorsInput{}) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) - err := conn.ListCustomRoutingAcceleratorsPagesWithContext(ctx, &globalaccelerator.ListCustomRoutingAcceleratorsInput{}, func(page *globalaccelerator.ListCustomRoutingAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + if err != nil { + return sdkdiag.AppendErrorf(diags, "listing Global Accelerator Custom Routing Accelerators: %s", err) } - for _, l := range page.Accelerators { - if l == nil { + for _, accelerator := range page.Accelerators { + if v, ok := d.GetOk("arn"); ok && v.(string) != aws.ToString(accelerator.AcceleratorArn) { continue } - if v, ok := d.GetOk("arn"); ok && v.(string) != aws.StringValue(l.AcceleratorArn) { + if v, ok := d.GetOk("name"); ok && v.(string) != aws.ToString(accelerator.Name) { continue } - if v, ok := d.GetOk("name"); ok && v.(string) != aws.StringValue(l.Name) { - continue - } - - results = append(results, l) + results = append(results, accelerator) } - - return !lastPage - }) - - if err != nil { - return sdkdiag.AppendErrorf(diags, "listing Global Accelerator Custom Routing Accelerators: %s", err) } if count := len(results); count != 1 { @@ -129,7 +122,7 @@ func dataSourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resou } accelerator := results[0] - d.SetId(aws.StringValue(accelerator.AcceleratorArn)) + d.SetId(aws.ToString(accelerator.AcceleratorArn)) d.Set("arn", accelerator.AcceleratorArn) d.Set("dns_name", accelerator.DnsName) d.Set("enabled", accelerator.Enabled) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index d58c7963b61b..c5e8f072e0ae 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -36,8 +36,9 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { return []*types.ServicePackageSDKDataSource{ { - Factory: DataSourceCustomRoutingAccelerator, + Factory: dataSourceCustomRoutingAccelerator, TypeName: "aws_globalaccelerator_custom_routing_accelerator", + Name: "Custom Routing Accelerator", }, } } From 5f40b12698dc8a0127c68141a569ecef6ec7c622 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 16:09:13 -0400 Subject: [PATCH 102/137] r/aws_globalaccelerator_custom_routing_endpoint_group: Migrate to AWS SDK for GO v2. --- .../custom_routing_endpoint_group.go | 109 ++++++++---------- .../custom_routing_endpoint_group_test.go | 20 ++-- .../service/globalaccelerator/exports_test.go | 24 ++-- .../globalaccelerator/service_package_gen.go | 3 +- 4 files changed, 71 insertions(+), 85 deletions(-) diff --git a/internal/service/globalaccelerator/custom_routing_endpoint_group.go b/internal/service/globalaccelerator/custom_routing_endpoint_group.go index a0789b36996b..ab59747d2b3b 100644 --- a/internal/service/globalaccelerator/custom_routing_endpoint_group.go +++ b/internal/service/globalaccelerator/custom_routing_endpoint_group.go @@ -8,23 +8,25 @@ import ( "log" "time" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" + "github.com/hashicorp/terraform-provider-aws/internal/enum" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" ) -// @SDKResource("aws_globalaccelerator_custom_routing_endpoint_group") -func ResourceCustomRoutingEndpointGroup() *schema.Resource { +// @SDKResource("aws_globalaccelerator_custom_routing_endpoint_group", name="Custom Routing Endpoint Group") +func resourceCustomRoutingEndpointGroup() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceCustomRoutingEndpointGroupCreate, ReadWithoutTimeout: resourceCustomRoutingEndpointGroupRead, @@ -59,8 +61,8 @@ func ResourceCustomRoutingEndpointGroup() *schema.Resource { Type: schema.TypeSet, Required: true, Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice(globalaccelerator.CustomRoutingProtocol_Values(), false), + Type: schema.TypeString, + ValidateDiagFunc: enum.Validate[awstypes.CustomRoutingProtocol](), }, }, "to_port": { @@ -104,7 +106,7 @@ func ResourceCustomRoutingEndpointGroup() *schema.Resource { func resourceCustomRoutingEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) input := &globalaccelerator.CreateCustomRoutingEndpointGroupInput{ DestinationConfigurations: expandCustomRoutingDestinationConfigurations(d.Get("destination_configuration").(*schema.Set).List()), @@ -117,38 +119,37 @@ func resourceCustomRoutingEndpointGroupCreate(ctx context.Context, d *schema.Res input.EndpointGroupRegion = aws.String(v.(string)) } - output, err := conn.CreateCustomRoutingEndpointGroupWithContext(ctx, input) + output, err := conn.CreateCustomRoutingEndpointGroup(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Global Accelerator Custom Routing Endpoint Group: %s", err) } - d.SetId(aws.StringValue(output.EndpointGroup.EndpointGroupArn)) + d.SetId(aws.ToString(output.EndpointGroup.EndpointGroupArn)) acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } if v, ok := d.GetOk("endpoint_configuration"); ok { input := &globalaccelerator.AddCustomRoutingEndpointsInput{ - EndpointGroupArn: aws.String(d.Id()), EndpointConfigurations: expandCustomRoutingEndpointConfigurations(v.(*schema.Set).List()), + EndpointGroupArn: aws.String(d.Id()), } - _, err := conn.AddCustomRoutingEndpointsWithContext(ctx, input) + _, err := conn.AddCustomRoutingEndpoints(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "adding Global Accelerator Custom Routing Endpoint Group (%s) endpoints: %s", d.Id(), err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutCreate)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } } @@ -157,9 +158,9 @@ func resourceCustomRoutingEndpointGroupCreate(ctx context.Context, d *schema.Res func resourceCustomRoutingEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - endpointGroup, err := FindCustomRoutingEndpointGroupByARN(ctx, conn, d.Id()) + endpointGroup, err := findCustomRoutingEndpointGroupByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator Custom Routing Endpoint Group (%s) not found, removing from state", d.Id()) @@ -172,7 +173,6 @@ func resourceCustomRoutingEndpointGroupRead(ctx context.Context, d *schema.Resou } listenerARN, err := endpointGroupARNToListenerARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -192,14 +192,14 @@ func resourceCustomRoutingEndpointGroupRead(ctx context.Context, d *schema.Resou func resourceCustomRoutingEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - conn := meta.(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) log.Printf("[DEBUG] Deleting Global Accelerator Custom Routing Endpoint Group (%s)", d.Id()) - _, err := conn.DeleteCustomRoutingEndpointGroupWithContext(ctx, &globalaccelerator.DeleteCustomRoutingEndpointGroupInput{ + _, err := conn.DeleteCustomRoutingEndpointGroup(ctx, &globalaccelerator.DeleteCustomRoutingEndpointGroupInput{ EndpointGroupArn: aws.String(d.Id()), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeEndpointGroupNotFoundException) { + if errs.IsA[*awstypes.EndpointGroupNotFoundException](err) { return diags } @@ -208,30 +208,25 @@ func resourceCustomRoutingEndpointGroupDelete(ctx context.Context, d *schema.Res } acceleratorARN, err := listenerOrEndpointGroupARNToAcceleratorARN(d.Id()) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } if _, err := waitCustomRoutingAcceleratorDeployed(ctx, conn, acceleratorARN, d.Timeout(schema.TimeoutDelete)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deployment: %s", acceleratorARN, err) + return sdkdiag.AppendErrorf(diags, "waiting for Global Accelerator Custom Routing Accelerator (%s) deploy: %s", acceleratorARN, err) } return diags } -func FindCustomRoutingEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.CustomRoutingEndpointGroup, error) { +func findCustomRoutingEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.CustomRoutingEndpointGroup, error) { input := &globalaccelerator.DescribeCustomRoutingEndpointGroupInput{ EndpointGroupArn: aws.String(arn), } - return findCustomRoutingEndpointGroup(ctx, conn, input) -} - -func findCustomRoutingEndpointGroup(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCustomRoutingEndpointGroupInput) (*globalaccelerator.CustomRoutingEndpointGroup, error) { - output, err := conn.DescribeCustomRoutingEndpointGroupWithContext(ctx, input) + output, err := conn.DescribeCustomRoutingEndpointGroup(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeEndpointGroupNotFoundException) { + if errs.IsA[*awstypes.EndpointGroupNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, @@ -249,34 +244,34 @@ func findCustomRoutingEndpointGroup(ctx context.Context, conn *globalaccelerator return output.EndpointGroup, nil } -func expandCustomRoutingEndpointDestinationConfiguration(tfMap map[string]interface{}) *globalaccelerator.CustomRoutingDestinationConfiguration { +func expandCustomRoutingEndpointDestinationConfiguration(tfMap map[string]interface{}) *awstypes.CustomRoutingDestinationConfiguration { if tfMap == nil { return nil } - apiObject := &globalaccelerator.CustomRoutingDestinationConfiguration{} + apiObject := &awstypes.CustomRoutingDestinationConfiguration{} if v, ok := tfMap["from_port"].(int); ok && v != 0 { - apiObject.FromPort = aws.Int64(int64(v)) + apiObject.FromPort = aws.Int32(int32(v)) } if v, ok := tfMap["protocols"].(*schema.Set); ok { - apiObject.Protocols = flex.ExpandStringSet(v) + apiObject.Protocols = flex.ExpandStringyValueSet[awstypes.CustomRoutingProtocol](v) } if v, ok := tfMap["to_port"].(int); ok && v != 0 { - apiObject.ToPort = aws.Int64(int64(v)) + apiObject.ToPort = aws.Int32(int32(v)) } return apiObject } -func expandCustomRoutingDestinationConfigurations(tfList []interface{}) []*globalaccelerator.CustomRoutingDestinationConfiguration { +func expandCustomRoutingDestinationConfigurations(tfList []interface{}) []awstypes.CustomRoutingDestinationConfiguration { if len(tfList) == 0 { return nil } - var apiObjects []*globalaccelerator.CustomRoutingDestinationConfiguration + var apiObjects []awstypes.CustomRoutingDestinationConfiguration for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]interface{}) @@ -291,18 +286,18 @@ func expandCustomRoutingDestinationConfigurations(tfList []interface{}) []*globa continue } - apiObjects = append(apiObjects, apiObject) + apiObjects = append(apiObjects, *apiObject) } return apiObjects } -func expandCustomRoutingEndpointConfiguration(tfMap map[string]interface{}) *globalaccelerator.CustomRoutingEndpointConfiguration { +func expandCustomRoutingEndpointConfiguration(tfMap map[string]interface{}) *awstypes.CustomRoutingEndpointConfiguration { if tfMap == nil { return nil } - apiObject := &globalaccelerator.CustomRoutingEndpointConfiguration{} + apiObject := &awstypes.CustomRoutingEndpointConfiguration{} if v, ok := tfMap["endpoint_id"].(string); ok && v != "" { apiObject.EndpointId = aws.String(v) @@ -311,12 +306,12 @@ func expandCustomRoutingEndpointConfiguration(tfMap map[string]interface{}) *glo return apiObject } -func expandCustomRoutingEndpointConfigurations(tfList []interface{}) []*globalaccelerator.CustomRoutingEndpointConfiguration { +func expandCustomRoutingEndpointConfigurations(tfList []interface{}) []awstypes.CustomRoutingEndpointConfiguration { if len(tfList) == 0 { return nil } - var apiObjects []*globalaccelerator.CustomRoutingEndpointConfiguration + var apiObjects []awstypes.CustomRoutingEndpointConfiguration for _, tfMapRaw := range tfList { tfMap, ok := tfMapRaw.(map[string]interface{}) @@ -331,13 +326,13 @@ func expandCustomRoutingEndpointConfigurations(tfList []interface{}) []*globalac continue } - apiObjects = append(apiObjects, apiObject) + apiObjects = append(apiObjects, *apiObject) } return apiObjects } -func flattenCustomRoutingDestinationDescription(apiObject *globalaccelerator.CustomRoutingDestinationDescription) map[string]interface{} { +func flattenCustomRoutingDestinationDescription(apiObject *awstypes.CustomRoutingDestinationDescription) map[string]interface{} { if apiObject == nil { return nil } @@ -345,21 +340,21 @@ func flattenCustomRoutingDestinationDescription(apiObject *globalaccelerator.Cus tfMap := map[string]interface{}{} if v := apiObject.FromPort; v != nil { - tfMap["from_port"] = aws.Int64Value(v) + tfMap["from_port"] = aws.ToInt32(v) } if v := apiObject.Protocols; v != nil { - tfMap["protocols"] = aws.StringValueSlice(v) + tfMap["protocols"] = v } if v := apiObject.ToPort; v != nil { - tfMap["to_port"] = aws.Int64Value(v) + tfMap["to_port"] = aws.ToInt32(v) } return tfMap } -func flattenCustomRoutingDestinationDescriptions(apiObjects []*globalaccelerator.CustomRoutingDestinationDescription) []interface{} { +func flattenCustomRoutingDestinationDescriptions(apiObjects []awstypes.CustomRoutingDestinationDescription) []interface{} { if len(apiObjects) == 0 { return nil } @@ -367,17 +362,13 @@ func flattenCustomRoutingDestinationDescriptions(apiObjects []*globalaccelerator var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenCustomRoutingDestinationDescription(apiObject)) + tfList = append(tfList, flattenCustomRoutingDestinationDescription(&apiObject)) } return tfList } -func flattenCustomRoutingEndpointDescription(apiObject *globalaccelerator.CustomRoutingEndpointDescription) map[string]interface{} { +func flattenCustomRoutingEndpointDescription(apiObject *awstypes.CustomRoutingEndpointDescription) map[string]interface{} { if apiObject == nil { return nil } @@ -385,13 +376,13 @@ func flattenCustomRoutingEndpointDescription(apiObject *globalaccelerator.Custom tfMap := map[string]interface{}{} if v := apiObject.EndpointId; v != nil { - tfMap["endpoint_id"] = aws.StringValue(v) + tfMap["endpoint_id"] = aws.ToString(v) } return tfMap } -func flattenCustomRoutingEndpointDescriptions(apiObjects []*globalaccelerator.CustomRoutingEndpointDescription) []interface{} { +func flattenCustomRoutingEndpointDescriptions(apiObjects []awstypes.CustomRoutingEndpointDescription) []interface{} { if len(apiObjects) == 0 { return nil } @@ -399,11 +390,7 @@ func flattenCustomRoutingEndpointDescriptions(apiObjects []*globalaccelerator.Cu var tfList []interface{} for _, apiObject := range apiObjects { - if apiObject == nil { - continue - } - - tfList = append(tfList, flattenCustomRoutingEndpointDescription(apiObject)) + tfList = append(tfList, flattenCustomRoutingEndpointDescription(&apiObject)) } return tfList diff --git a/internal/service/globalaccelerator/custom_routing_endpoint_group_test.go b/internal/service/globalaccelerator/custom_routing_endpoint_group_test.go index 2fcb3d9bc743..6e3aaf43d73c 100644 --- a/internal/service/globalaccelerator/custom_routing_endpoint_group_test.go +++ b/internal/service/globalaccelerator/custom_routing_endpoint_group_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -21,7 +21,7 @@ import ( func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_basic(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingEndpointGroup + var v awstypes.CustomRoutingEndpointGroup resourceName := "aws_globalaccelerator_custom_routing_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -56,7 +56,7 @@ func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_basic(t *testing.T) { func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_disappears(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingEndpointGroup + var v awstypes.CustomRoutingEndpointGroup resourceName := "aws_globalaccelerator_custom_routing_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -80,7 +80,7 @@ func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_disappears(t *testing.T) func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_endpointConfiguration(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingEndpointGroup + var v awstypes.CustomRoutingEndpointGroup resourceName := "aws_globalaccelerator_custom_routing_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -116,7 +116,7 @@ func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_endpointConfiguration(t func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_endpointGroupRegion(t *testing.T) { ctx := acctest.Context(t) - var v globalaccelerator.CustomRoutingEndpointGroup + var v awstypes.CustomRoutingEndpointGroup resourceName := "aws_globalaccelerator_custom_routing_endpoint_group.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -149,18 +149,14 @@ func TestAccGlobalAcceleratorCustomRoutingEndpointGroup_endpointGroupRegion(t *t }) } -func testAccCheckCustomRoutingEndpointGroupExists(ctx context.Context, n string, v *globalaccelerator.CustomRoutingEndpointGroup) resource.TestCheckFunc { +func testAccCheckCustomRoutingEndpointGroupExists(ctx context.Context, n string, v *awstypes.CustomRoutingEndpointGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) - rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Global Accelerator Custom Routing Endpoint Group ID is set") - } + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) output, err := tfglobalaccelerator.FindCustomRoutingEndpointGroupByARN(ctx, conn, rs.Primary.ID) @@ -176,7 +172,7 @@ func testAccCheckCustomRoutingEndpointGroupExists(ctx context.Context, n string, func testAccCheckCustomRoutingEndpointGroupDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_custom_routing_endpoint_group" { diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index 0581232fc164..4eb813d91aad 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -5,16 +5,18 @@ package globalaccelerator // Exports for use in tests only. var ( - ResourceAccelerator = resourceAccelerator - ResourceCrossAccountAttachment = newCrossAccountAttachmentResource - ResourceCustomRoutingAccelerator = resourceCustomRoutingAccelerator - ResourceCustomRoutingListener = resourceCustomRoutingListener - ResourceEndpointGroup = resourceEndpointGroup - ResourceListener = resourceListener + ResourceAccelerator = resourceAccelerator + ResourceCrossAccountAttachment = newCrossAccountAttachmentResource + ResourceCustomRoutingAccelerator = resourceCustomRoutingAccelerator + ResourceCustomRoutingEndpointGroup = resourceCustomRoutingEndpointGroup + ResourceCustomRoutingListener = resourceCustomRoutingListener + ResourceEndpointGroup = resourceEndpointGroup + ResourceListener = resourceListener - FindAcceleratorByARN = findAcceleratorByARN - FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN - FindCustomRoutingAcceleratorByARN = findCustomRoutingAcceleratorByARN - FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN - FindListenerByARN = findListenerByARN + FindAcceleratorByARN = findAcceleratorByARN + FindCrossAccountAttachmentByARN = findCrossAccountAttachmentByARN + FindCustomRoutingAcceleratorByARN = findCustomRoutingAcceleratorByARN + FindCustomRoutingEndpointGroupByARN = findCustomRoutingEndpointGroupByARN + FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN + FindListenerByARN = findListenerByARN ) diff --git a/internal/service/globalaccelerator/service_package_gen.go b/internal/service/globalaccelerator/service_package_gen.go index c5e8f072e0ae..f94220966ad9 100644 --- a/internal/service/globalaccelerator/service_package_gen.go +++ b/internal/service/globalaccelerator/service_package_gen.go @@ -62,8 +62,9 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceCustomRoutingEndpointGroup, + Factory: resourceCustomRoutingEndpointGroup, TypeName: "aws_globalaccelerator_custom_routing_endpoint_group", + Name: "Custom Routing Endpoint Group", }, { Factory: resourceCustomRoutingListener, From 13e92cef0038f4e682b35ec74c1d03b16ef5a90a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 16:15:04 -0400 Subject: [PATCH 103/137] r/aws_globalaccelerator_cross_account_attachment: Migrate to AWS SDK for GO v2. --- .../cross_account_attachment.go | 43 +++++++++---------- .../cross_account_attachment_test.go | 16 +++---- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index 39cf5ee950d5..5bc7b2eaa411 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" + "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/framework" @@ -98,7 +99,7 @@ func (r *crossAccountAttachmentResource) Create(ctx context.Context, request res return } - conn := r.Meta().GlobalAcceleratorConn(ctx) + conn := r.Meta().GlobalAcceleratorClient(ctx) input := &globalaccelerator.CreateCrossAccountAttachmentInput{} response.Diagnostics.Append(fwflex.Expand(ctx, data, input)...) @@ -109,7 +110,7 @@ func (r *crossAccountAttachmentResource) Create(ctx context.Context, request res input.IdempotencyToken = aws.String(id.UniqueId()) input.Tags = getTagsIn(ctx) - output, err := conn.CreateCrossAccountAttachmentWithContext(ctx, input) + output, err := conn.CreateCrossAccountAttachment(ctx, input) if err != nil { response.Diagnostics.AddError("creating Global Accelerator Cross-account Attachment", err.Error()) @@ -139,7 +140,7 @@ func (r *crossAccountAttachmentResource) Read(ctx context.Context, request resou return } - conn := r.Meta().GlobalAcceleratorConn(ctx) + conn := r.Meta().GlobalAcceleratorClient(ctx) output, err := findCrossAccountAttachmentByARN(ctx, conn, data.ID.ValueString()) @@ -180,7 +181,7 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res return } - conn := r.Meta().GlobalAcceleratorConn(ctx) + conn := r.Meta().GlobalAcceleratorClient(ctx) if !new.Name.Equal(old.Name) || !new.Principals.Equal(old.Principals) || @@ -195,7 +196,7 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res if !new.Principals.Equal(old.Principals) { oldPrincipals, newPrincipals := fwflex.ExpandFrameworkStringValueSet(ctx, old.Principals), fwflex.ExpandFrameworkStringValueSet(ctx, new.Principals) - input.AddPrincipals, input.RemovePrincipals = aws.StringSlice(newPrincipals.Difference(oldPrincipals)), aws.StringSlice(oldPrincipals.Difference(newPrincipals)) + input.AddPrincipals, input.RemovePrincipals = newPrincipals.Difference(oldPrincipals), oldPrincipals.Difference(newPrincipals) } if !new.Resources.Equal(old.Resources) { @@ -215,21 +216,21 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res return v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region) }) - input.AddResources = tfslices.ApplyToAll(add, func(v *resourceModel) *globalaccelerator.Resource { - return &globalaccelerator.Resource{ + input.AddResources = tfslices.ApplyToAll(add, func(v *resourceModel) awstypes.Resource { + return awstypes.Resource{ EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID), Region: fwflex.StringFromFramework(ctx, v.Region), } }) - input.RemoveResources = tfslices.ApplyToAll(remove, func(v *resourceModel) *globalaccelerator.Resource { - return &globalaccelerator.Resource{ + input.RemoveResources = tfslices.ApplyToAll(remove, func(v *resourceModel) awstypes.Resource { + return awstypes.Resource{ EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID), Region: fwflex.StringFromFramework(ctx, v.Region), } }) } - output, err := conn.UpdateCrossAccountAttachmentWithContext(ctx, input) + output, err := conn.UpdateCrossAccountAttachment(ctx, input) if err != nil { response.Diagnostics.AddError(fmt.Sprintf("updating Global Accelerator Cross-account Attachment (%s)", new.ID.ValueString()), err.Error()) @@ -252,13 +253,13 @@ func (r *crossAccountAttachmentResource) Delete(ctx context.Context, request res return } - conn := r.Meta().GlobalAcceleratorConn(ctx) + conn := r.Meta().GlobalAcceleratorClient(ctx) - _, err := conn.DeleteCrossAccountAttachmentWithContext(ctx, &globalaccelerator.DeleteCrossAccountAttachmentInput{ + _, err := conn.DeleteCrossAccountAttachment(ctx, &globalaccelerator.DeleteCrossAccountAttachmentInput{ AttachmentArn: fwflex.StringFromFramework(ctx, data.ID), }) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAttachmentNotFoundException) { + if errs.IsA[*awstypes.AttachmentNotFoundException](err) { return } @@ -273,18 +274,14 @@ func (r *crossAccountAttachmentResource) ModifyPlan(ctx context.Context, request r.SetTagsAll(ctx, request, response) } -func findCrossAccountAttachmentByARN(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, arn string) (*globalaccelerator.Attachment, error) { +func findCrossAccountAttachmentByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.Attachment, error) { input := &globalaccelerator.DescribeCrossAccountAttachmentInput{ AttachmentArn: aws.String(arn), } - return findCrossAccountAttachment(ctx, conn, input) -} - -func findCrossAccountAttachment(ctx context.Context, conn *globalaccelerator.GlobalAccelerator, input *globalaccelerator.DescribeCrossAccountAttachmentInput) (*globalaccelerator.Attachment, error) { - output, err := conn.DescribeCrossAccountAttachmentWithContext(ctx, input) + output, err := conn.DescribeCrossAccountAttachment(ctx, input) - if tfawserr.ErrCodeEquals(err, globalaccelerator.ErrCodeAttachmentNotFoundException) { + if errs.IsA[*awstypes.AttachmentNotFoundException](err) { return nil, &retry.NotFoundError{ LastError: err, LastRequest: input, diff --git a/internal/service/globalaccelerator/cross_account_attachment_test.go b/internal/service/globalaccelerator/cross_account_attachment_test.go index 63840f72cf58..2b01ae971787 100644 --- a/internal/service/globalaccelerator/cross_account_attachment_test.go +++ b/internal/service/globalaccelerator/cross_account_attachment_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/aws/aws-sdk-go/service/globalaccelerator" + awstypes "github.com/aws/aws-sdk-go-v2/service/globalaccelerator/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -24,7 +24,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_basic(t *testing.T) { resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v globalaccelerator.Attachment + var v awstypes.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, @@ -66,7 +66,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_principals(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rAccountID1 := sdkacctest.RandStringFromCharSet(12, "012346789") rAccountID2 := sdkacctest.RandStringFromCharSet(12, "012346789") - var v globalaccelerator.Attachment + var v awstypes.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, @@ -135,7 +135,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_disappears(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v globalaccelerator.Attachment + var v awstypes.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, @@ -159,7 +159,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_tags(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_globalaccelerator_cross_account_attachment.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - var v globalaccelerator.Attachment + var v awstypes.Attachment resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, @@ -204,7 +204,7 @@ func TestAccGlobalAcceleratorCrossAccountAttachment_tags(t *testing.T) { func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) for _, rs := range s.RootModule().Resources { if rs.Type != "aws_globalaccelerator_cross_account_attachment" { @@ -228,14 +228,14 @@ func testAccCheckCrossAccountAttachmentDestroy(ctx context.Context) resource.Tes } } -func testAccCheckCrossAccountAttachmentExists(ctx context.Context, n string, v *globalaccelerator.Attachment) resource.TestCheckFunc { +func testAccCheckCrossAccountAttachmentExists(ctx context.Context, n string, v *awstypes.Attachment) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorConn(ctx) + conn := acctest.Provider.Meta().(*conns.AWSClient).GlobalAcceleratorClient(ctx) output, err := tfglobalaccelerator.FindCrossAccountAttachmentByARN(ctx, conn, rs.Primary.ID) From ee9e525b9602672001646087d443c3a99e81332c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 16:18:48 -0400 Subject: [PATCH 104/137] globalaccelerator: Some clean up. --- internal/service/globalaccelerator/arn.go | 16 ++++++++-------- .../service/globalaccelerator/endpoint_group.go | 4 ++-- .../service/globalaccelerator/exports_test.go | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/service/globalaccelerator/arn.go b/internal/service/globalaccelerator/arn.go index a6db91eabf1a..d842e5c22083 100644 --- a/internal/service/globalaccelerator/arn.go +++ b/internal/service/globalaccelerator/arn.go @@ -11,8 +11,8 @@ import ( ) const ( - ARNSeparator = "/" - ARNService = "globalaccelerator" + arnSeparator = "/" + arnService = "globalaccelerator" ) // endpointGroupARNToListenerARN converts an endpoint group ARN to a listener ARN. @@ -24,11 +24,11 @@ func endpointGroupARNToListenerARN(inputARN string) (string, error) { return "", fmt.Errorf("parsing ARN (%s): %w", inputARN, err) } - if actual, expected := parsedARN.Service, ARNService; actual != expected { + if actual, expected := parsedARN.Service, arnService; actual != expected { return "", fmt.Errorf("expected service %s in ARN (%s), got: %s", expected, inputARN, actual) } - resourceParts := strings.Split(parsedARN.Resource, ARNSeparator) + resourceParts := strings.Split(parsedARN.Resource, arnSeparator) if actual, expected := len(resourceParts), 6; actual < expected { return "", fmt.Errorf("expected at least %d resource parts in ARN (%s), got: %d", expected, inputARN, actual) @@ -39,7 +39,7 @@ func endpointGroupARNToListenerARN(inputARN string) (string, error) { Service: parsedARN.Service, Region: parsedARN.Region, AccountID: parsedARN.AccountID, - Resource: strings.Join(resourceParts[0:4], ARNSeparator), + Resource: strings.Join(resourceParts[0:4], arnSeparator), }.String() return outputARN, nil @@ -54,11 +54,11 @@ func listenerOrEndpointGroupARNToAcceleratorARN(inputARN string) (string, error) return "", fmt.Errorf("parsing ARN (%s): %w", inputARN, err) } - if actual, expected := parsedARN.Service, ARNService; actual != expected { + if actual, expected := parsedARN.Service, arnService; actual != expected { return "", fmt.Errorf("expected service %s in ARN (%s), got: %s", expected, inputARN, actual) } - resourceParts := strings.Split(parsedARN.Resource, ARNSeparator) + resourceParts := strings.Split(parsedARN.Resource, arnSeparator) if actual, expected := len(resourceParts), 4; actual < expected { return "", fmt.Errorf("expected at least %d resource parts in ARN (%s), got: %d", expected, inputARN, actual) @@ -69,7 +69,7 @@ func listenerOrEndpointGroupARNToAcceleratorARN(inputARN string) (string, error) Service: parsedARN.Service, Region: parsedARN.Region, AccountID: parsedARN.AccountID, - Resource: strings.Join(resourceParts[0:2], ARNSeparator), + Resource: strings.Join(resourceParts[0:2], arnSeparator), }.String() return outputARN, nil diff --git a/internal/service/globalaccelerator/endpoint_group.go b/internal/service/globalaccelerator/endpoint_group.go index 5f8346f6391b..271baf23c57d 100644 --- a/internal/service/globalaccelerator/endpoint_group.go +++ b/internal/service/globalaccelerator/endpoint_group.go @@ -212,7 +212,7 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).GlobalAcceleratorClient(ctx) - endpointGroup, err := FindEndpointGroupByARN(ctx, conn, d.Id()) + endpointGroup, err := findEndpointGroupByARN(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] Global Accelerator endpoint group (%s) not found, removing from state", d.Id()) @@ -339,7 +339,7 @@ func resourceEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, me return diags } -func FindEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.EndpointGroup, error) { +func findEndpointGroupByARN(ctx context.Context, conn *globalaccelerator.Client, arn string) (*awstypes.EndpointGroup, error) { input := &globalaccelerator.DescribeEndpointGroupInput{ EndpointGroupArn: aws.String(arn), } diff --git a/internal/service/globalaccelerator/exports_test.go b/internal/service/globalaccelerator/exports_test.go index 4eb813d91aad..2a5c6fee917d 100644 --- a/internal/service/globalaccelerator/exports_test.go +++ b/internal/service/globalaccelerator/exports_test.go @@ -18,5 +18,6 @@ var ( FindCustomRoutingAcceleratorByARN = findCustomRoutingAcceleratorByARN FindCustomRoutingEndpointGroupByARN = findCustomRoutingEndpointGroupByARN FindCustomRoutingListenerByARN = findCustomRoutingListenerByARN + FindEndpointGroupByARN = findEndpointGroupByARN FindListenerByARN = findListenerByARN ) From 6aa0bbdc35c4a519d3244c018a3e95b35a3fde76 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 16:33:38 -0400 Subject: [PATCH 105/137] globalaccelerator: Migrate sweepers to AWS SDK for Go v2. --- internal/service/globalaccelerator/sweep.go | 327 ++++++++------------ 1 file changed, 131 insertions(+), 196 deletions(-) diff --git a/internal/service/globalaccelerator/sweep.go b/internal/service/globalaccelerator/sweep.go index 5a82f7406b09..a340596bb430 100644 --- a/internal/service/globalaccelerator/sweep.go +++ b/internal/service/globalaccelerator/sweep.go @@ -7,12 +7,11 @@ import ( "fmt" "log" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/globalaccelerator" - multierror "github.com/hashicorp/go-multierror" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" - "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv1" + "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" ) func RegisterSweepers() { @@ -65,33 +64,30 @@ func sweepAccelerators(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListAcceleratorsInput{} sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Accelerator sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { - r := ResourceAccelerator() + r := resourceAccelerator() d := r.Data(nil) - d.SetId(aws.StringValue(v.AcceleratorArn)) + d.SetId(aws.ToString(v.AcceleratorArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global Accelerator Accelerator sweep for %s: %s", region, err) - return nil - } - - if err != nil { - return fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err) } err = sweep.SweepOrchestrator(ctx, sweepResources) @@ -109,14 +105,21 @@ func sweepEndpointGroups(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListAcceleratorsInput{} - var sweeperErrs *multierror.Error sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Endpoint Group sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { @@ -124,9 +127,12 @@ func sweepEndpointGroups(region string) error { AcceleratorArn: v.AcceleratorArn, } - err := conn.ListListenersPagesWithContext(ctx, input, func(page *globalaccelerator.ListListenersOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListListenersPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.Listeners { @@ -134,62 +140,34 @@ func sweepEndpointGroups(region string) error { ListenerArn: v.ListenerArn, } - err := conn.ListEndpointGroupsPagesWithContext(ctx, input, func(page *globalaccelerator.ListEndpointGroupsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListEndpointGroupsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.EndpointGroups { - r := ResourceEndpointGroup() + r := resourceEndpointGroup() d := r.Data(nil) - d.SetId(aws.StringValue(v.EndpointGroupArn)) + d.SetId(aws.ToString(v.EndpointGroupArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Endpoint Groups (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Listeners (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global Accelerator Endpoint Group sweep for %s: %s", region, err) - return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err)) } err = sweep.SweepOrchestrator(ctx, sweepResources) if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error sweeping Global Accelerator Endpoint Groups (%s): %w", region, err)) + return fmt.Errorf("error sweeping Global Accelerator Endpoint Groups (%s): %w", region, err) } - return sweeperErrs.ErrorOrNil() + return nil } func sweepListeners(region string) error { @@ -198,14 +176,21 @@ func sweepListeners(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListAcceleratorsInput{} - var sweeperErrs *multierror.Error sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Endpoint Group sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { @@ -213,50 +198,32 @@ func sweepListeners(region string) error { AcceleratorArn: v.AcceleratorArn, } - err := conn.ListListenersPagesWithContext(ctx, input, func(page *globalaccelerator.ListListenersOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListListenersPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.Listeners { - r := ResourceListener() + r := resourceListener() d := r.Data(nil) - d.SetId(aws.StringValue(v.ListenerArn)) + d.SetId(aws.ToString(v.ListenerArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Listeners (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global Accelerator Listener sweep for %s: %s", region, err) - return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Accelerators (%s): %w", region, err)) } err = sweep.SweepOrchestrator(ctx, sweepResources) if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error sweeping Global Accelerator Listeners (%s): %w", region, err)) + return fmt.Errorf("error sweeping Global Accelerator Listeners (%s): %w", region, err) } - return sweeperErrs.ErrorOrNil() + return nil } func sweepCustomRoutingAccelerators(region string) error { @@ -265,33 +232,30 @@ func sweepCustomRoutingAccelerators(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListCustomRoutingAcceleratorsInput{} sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListCustomRoutingAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Custom Routing Accelerator sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { - r := ResourceCustomRoutingAccelerator() + r := resourceCustomRoutingAccelerator() d := r.Data(nil) - d.SetId(aws.StringValue(v.AcceleratorArn)) + d.SetId(aws.ToString(v.AcceleratorArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global Accelerator Custom Routing Accelerator sweep for %s: %s", region, err) - return nil - } - - if err != nil { - return fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err) } err = sweep.SweepOrchestrator(ctx, sweepResources) @@ -309,14 +273,21 @@ func sweepCustomRoutingEndpointGroups(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListCustomRoutingAcceleratorsInput{} - var sweeperErrs *multierror.Error sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListCustomRoutingAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Custom Routing Accelerator sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { @@ -324,9 +295,12 @@ func sweepCustomRoutingEndpointGroups(region string) error { AcceleratorArn: v.AcceleratorArn, } - err := conn.ListCustomRoutingListenersPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingListenersOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingListenersPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.Listeners { @@ -334,62 +308,34 @@ func sweepCustomRoutingEndpointGroups(region string) error { ListenerArn: v.ListenerArn, } - err := conn.ListCustomRoutingEndpointGroupsPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingEndpointGroupsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingEndpointGroupsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.EndpointGroups { - r := ResourceCustomRoutingEndpointGroup() + r := resourceCustomRoutingEndpointGroup() d := r.Data(nil) - d.SetId(aws.StringValue(v.EndpointGroupArn)) + d.SetId(aws.ToString(v.EndpointGroupArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Custom Routing Endpoint Groups (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Custom Routing Listeners (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global AcceleratorCustom Routing Endpoint Group sweep for %s: %s", region, err) - return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err)) } err = sweep.SweepOrchestrator(ctx, sweepResources) if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error sweeping Global Accelerator Custom Routing Endpoint Groups (%s): %w", region, err)) + return fmt.Errorf("error sweeping Global Accelerator Custom Routing Endpoint Groups (%s): %w", region, err) } - return sweeperErrs.ErrorOrNil() + return nil } func sweepCustomRoutingListeners(region string) error { @@ -398,14 +344,21 @@ func sweepCustomRoutingListeners(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.GlobalAcceleratorConn(ctx) + conn := client.GlobalAcceleratorClient(ctx) input := &globalaccelerator.ListCustomRoutingAcceleratorsInput{} - var sweeperErrs *multierror.Error sweepResources := make([]sweep.Sweepable, 0) - err = conn.ListCustomRoutingAcceleratorsPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingAcceleratorsOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingAcceleratorsPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if awsv2.SkipSweepError(err) { + log.Printf("[WARN] Skipping Global Accelerator Custom Routing Accelerator sweep for %s: %s", region, err) + return nil + } + + if err != nil { + return fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err) } for _, v := range page.Accelerators { @@ -413,48 +366,30 @@ func sweepCustomRoutingListeners(region string) error { AcceleratorArn: v.AcceleratorArn, } - err := conn.ListCustomRoutingListenersPagesWithContext(ctx, input, func(page *globalaccelerator.ListCustomRoutingListenersOutput, lastPage bool) bool { - if page == nil { - return !lastPage + pages := globalaccelerator.NewListCustomRoutingListenersPaginator(conn, input) + for pages.HasMorePages() { + page, err := pages.NextPage(ctx) + + if err != nil { + continue } for _, v := range page.Listeners { - r := ResourceCustomRoutingListener() + r := resourceCustomRoutingListener() d := r.Data(nil) - d.SetId(aws.StringValue(v.ListenerArn)) + d.SetId(aws.ToString(v.ListenerArn)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - continue - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Custom Routing Listeners (%s): %w", region, err)) } } - - return !lastPage - }) - - if awsv1.SkipSweepError(err) { - log.Printf("[WARN] Skipping Global Accelerator Custom Routing Listener sweep for %s: %s", region, err) - return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors - } - - if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Global Accelerator Custom Routing Accelerators (%s): %w", region, err)) } err = sweep.SweepOrchestrator(ctx, sweepResources) if err != nil { - sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error sweeping Global Accelerator Custom Routing Listeners (%s): %w", region, err)) + return fmt.Errorf("error sweeping Global Accelerator Custom Routing Listeners (%s): %w", region, err) } - return sweeperErrs.ErrorOrNil() + return nil } From 3577e156e120eb9307977db8dcbf1bc3eecd94f1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Apr 2024 16:45:31 -0400 Subject: [PATCH 106/137] globalaccelerator: Add 'NewClient'. --- .../globalaccelerator/service_package.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/globalaccelerator/service_package.go b/internal/service/globalaccelerator/service_package.go index 4126e2656234..f6ebfa80016b 100644 --- a/internal/service/globalaccelerator/service_package.go +++ b/internal/service/globalaccelerator/service_package.go @@ -6,21 +6,21 @@ package globalaccelerator import ( "context" - aws_sdkv1 "github.com/aws/aws-sdk-go/aws" - endpoints_sdkv1 "github.com/aws/aws-sdk-go/aws/endpoints" - session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" - globalaccelerator_sdkv1 "github.com/aws/aws-sdk-go/service/globalaccelerator" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/globalaccelerator" + "github.com/hashicorp/terraform-provider-aws/names" ) -// NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. -func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*globalaccelerator_sdkv1.GlobalAccelerator, error) { - sess := m["session"].(*session_sdkv1.Session) - config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m["endpoint"].(string))} +// NewConn returns a new AWS SDK for Go v2 client for this service package's AWS API. +func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) (*globalaccelerator.Client, error) { + cfg := *(config["aws_sdkv2_config"].(*aws.Config)) - // Force "global" services to correct Regions. - if m["partition"].(string) == endpoints_sdkv1.AwsPartitionID { - config.Region = aws_sdkv1.String(endpoints_sdkv1.UsWest2RegionID) - } - - return globalaccelerator_sdkv1.New(sess.Copy(config)), nil + return globalaccelerator.NewFromConfig(cfg, func(o *globalaccelerator.Options) { + if endpoint := config["endpoint"].(string); endpoint != "" { + o.BaseEndpoint = aws.String(endpoint) + } else if config["partition"].(string) == names.StandardPartitionID { + // Global Accelerator endpoint is only available in AWS Commercial us-west-2 Region. + o.Region = names.USWest2RegionID + } + }), nil } From 79ea06838813330f6728e9a7be45cca29834f213 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Tue, 23 Apr 2024 13:56:13 -0700 Subject: [PATCH 107/137] Adds CHANGELOG entry --- .changelog/37066.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changelog/37066.txt diff --git a/.changelog/37066.txt b/.changelog/37066.txt new file mode 100644 index 000000000000..ea793f913d4c --- /dev/null +++ b/.changelog/37066.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_servicecatalog_provisioned_product: Fixes error where tag values are not applied to products when tag values don't change. +``` + +```release-note:bug +resource/aws_servicecatalog_portfolio: Fixes error where deletion fails if resource was deleted out of band. +``` From b51a14f18b8983b117862aec09068eb4175e0338 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Tue, 23 Apr 2024 14:00:04 -0700 Subject: [PATCH 108/137] `copywrite headers` --- internal/acctest/s3.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/acctest/s3.go b/internal/acctest/s3.go index 4debc3a9c6f3..f27fd049124b 100644 --- a/internal/acctest/s3.go +++ b/internal/acctest/s3.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package acctest import ( From efcc2dac8f4b7f19a9cef0f536320712dc43e238 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Tue, 23 Apr 2024 21:39:15 +0000 Subject: [PATCH 109/137] Update CHANGELOG.md for #37040 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7570381c410..a600d0c84f22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,14 @@ FEATURES: * **New Resource:** `aws_bedrockagent_agent` ([#36851](https://github.com/hashicorp/terraform-provider-aws/issues/36851)) * **New Resource:** `aws_bedrockagent_agent_action_group` ([#36935](https://github.com/hashicorp/terraform-provider-aws/issues/36935)) * **New Resource:** `aws_bedrockagent_agent_alias` ([#36905](https://github.com/hashicorp/terraform-provider-aws/issues/36905)) +* **New Resource:** `aws_globalaccelerator_cross_account_attachment` ([#35991](https://github.com/hashicorp/terraform-provider-aws/issues/35991)) * **New Resource:** `aws_verifiedpermissions_policy` ([#35413](https://github.com/hashicorp/terraform-provider-aws/issues/35413)) ENHANCEMENTS: +* data-source/aws_eip: Add `arn` attribute ([#35991](https://github.com/hashicorp/terraform-provider-aws/issues/35991)) +* resource/aws_api_gateway_rest_api: Correct set `root_resource_id` on resource Read ([#37040](https://github.com/hashicorp/terraform-provider-aws/issues/37040)) +* resource/aws_eip: Add `arn` attribute ([#35991](https://github.com/hashicorp/terraform-provider-aws/issues/35991)) * resource/aws_elasticache_replication_group: Add `transit_encryption_mode` argument ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) * resource/aws_elasticache_replication_group: Changes to the `transit_encryption_enabled` argument can now be done in-place for engine versions > `7.0.5` ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) * resource/aws_kinesis_firehose_delivery_stream: Add `snowflake_configuration` argument ([#36646](https://github.com/hashicorp/terraform-provider-aws/issues/36646)) From 80ae7b1f71ca01f262f41a2c339b6648d8efa83e Mon Sep 17 00:00:00 2001 From: changelogbot Date: Tue, 23 Apr 2024 22:02:18 +0000 Subject: [PATCH 110/137] Update CHANGELOG.md for #37066 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a600d0c84f22..ace7c48cb804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ BUG FIXES: * resource/aws_ce_cost_category: Allow up to 3 levels of `and`, not` and `or` operand nesting for the `rule` argument ([#30862](https://github.com/hashicorp/terraform-provider-aws/issues/30862)) * resource/aws_elasticache_replication_group: Fix excessive delay on read ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) +* resource/aws_servicecatalog_portfolio: Fixes error where deletion fails if resource was deleted out of band. ([#37066](https://github.com/hashicorp/terraform-provider-aws/issues/37066)) +* resource/aws_servicecatalog_provisioned_product: Fixes error where tag values are not applied to products when tag values don't change. ([#37066](https://github.com/hashicorp/terraform-provider-aws/issues/37066)) ## 5.46.0 (April 18, 2024) From 3d202b75c9de2c4e54ccf512143de079941ee06f Mon Sep 17 00:00:00 2001 From: breathingdust <282361+breathingdust@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:04:12 +0000 Subject: [PATCH 111/137] docs: update resource counts --- website/docs/index.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 8c4aab1e03c6..98517bf28a00 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -11,7 +11,7 @@ Use the Amazon Web Services (AWS) provider to interact with the many resources supported by AWS. You must configure the provider with the proper credentials before you can use it. -Use the navigation to the left to read about the available resources. There are currently 1358 resources and 556 data sources available in the provider. +Use the navigation to the left to read about the available resources. There are currently 1359 resources and 556 data sources available in the provider. To learn the basics of Terraform using this provider, follow the hands-on [get started tutorials](https://learn.hashicorp.com/tutorials/terraform/infrastructure-as-code?in=terraform/aws-get-started&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS). Interact with AWS services, From 1c42fb6803bb5c78744b231197f82eed87901f5f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 07:57:03 -0400 Subject: [PATCH 112/137] Run 'go get github.com/aws/aws-sdk-go-v2/service/route53profiles@v1.0.0 && go mod tidy'. --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 4dbff4d28814..937a20010be9 100644 --- a/go.mod +++ b/go.mod @@ -139,6 +139,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.4 github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 + github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.4 diff --git a/go.sum b/go.sum index d20dc4a02401..0fe59678a578 100644 --- a/go.sum +++ b/go.sum @@ -308,6 +308,8 @@ github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 h1:znBjrg7qGF7DOXpJ1Z github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0/go.mod h1:RHFmC9Lds1jS1zBvnFq1GDh3yxFXH++n+2sI9TE53Cc= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 h1:Qb7EiHvGJZGU43aCMahEJrP5sJjV62gGXm4y9x/syRQ= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4/go.mod h1:8wjITSWOCR+G7DhS2WraZnZ/geFYxXLLP0KKTfZtRGQ= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 h1:on9+rCVnTcfYtz4i7sVsNuJYCAQO9xucyGtaWtlbIXY= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0/go.mod h1:tTj/YUqvGBhnxNh8gMjf31pSJF1L3STJwdPkjhSyl5I= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o= github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 h1:J6weNKyH2/bVlQ4dWpfprtIGf1tor3Ht5xurx+GXJjs= From 071716687a967138d1ba0a5db2e82615627d17bc Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 07:57:47 -0400 Subject: [PATCH 113/137] Run 'make cleantidy'. --- tools/tfsdk2fw/go.mod | 18 +++++++++++------- tools/tfsdk2fw/go.sum | 36 ++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/tools/tfsdk2fw/go.mod b/tools/tfsdk2fw/go.mod index a0aa3ff3490e..375f61f221a2 100644 --- a/tools/tfsdk2fw/go.mod +++ b/tools/tfsdk2fw/go.mod @@ -5,7 +5,7 @@ go 1.22.0 require ( github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 github.com/hashicorp/terraform-provider-aws v1.60.1-0.20220322001452-8f7a597d0c24 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 ) require ( @@ -18,7 +18,7 @@ require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.51.24 // indirect + github.com/aws/aws-sdk-go v1.51.26 // indirect github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect github.com/aws/aws-sdk-go-v2/config v1.27.11 // indirect @@ -40,6 +40,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/appconfig v1.29.2 // indirect github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4 // indirect github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4 // indirect + github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4 // indirect github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4 // indirect github.com/aws/aws-sdk-go-v2/service/athena v1.40.4 // indirect github.com/aws/aws-sdk-go-v2/service/auditmanager v1.32.4 // indirect @@ -48,7 +49,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/batch v1.37.0 // indirect github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 // indirect github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 // indirect - github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0 // indirect + github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 // indirect github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 // indirect github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 // indirect github.com/aws/aws-sdk-go-v2/service/chimesdkvoice v1.14.4 // indirect @@ -106,6 +107,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/fis v1.24.2 // indirect github.com/aws/aws-sdk-go-v2/service/fms v1.31.4 // indirect github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4 // indirect + github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1 // indirect github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0 // indirect github.com/aws/aws-sdk-go-v2/service/healthlake v1.24.0 // indirect github.com/aws/aws-sdk-go-v2/service/iam v1.32.0 // indirect @@ -116,7 +118,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.6 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 // indirect - github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0 // indirect github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5 // indirect github.com/aws/aws-sdk-go-v2/service/kafka v1.31.3 // indirect github.com/aws/aws-sdk-go-v2/service/kendra v1.50.1 // indirect @@ -141,7 +143,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/oam v1.10.1 // indirect github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4 // indirect github.com/aws/aws-sdk-go-v2/service/osis v1.8.4 // indirect - github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4 // indirect + github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0 // indirect github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4 // indirect github.com/aws/aws-sdk-go-v2/service/pipes v1.11.4 // indirect github.com/aws/aws-sdk-go-v2/service/polly v1.39.6 // indirect @@ -152,13 +154,14 @@ require ( github.com/aws/aws-sdk-go-v2/service/rds v1.77.1 // indirect github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 // indirect github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 // indirect - github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4 // indirect + github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5 // indirect github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0 // indirect github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.5 // indirect github.com/aws/aws-sdk-go-v2/service/resourcegroups v1.22.0 // indirect github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.4 // indirect github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 // indirect github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 // indirect + github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 // indirect github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 // indirect github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 // indirect github.com/aws/aws-sdk-go-v2/service/scheduler v1.8.4 // indirect @@ -184,7 +187,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/synthetics v1.24.4 // indirect github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5 // indirect github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4 // indirect - github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0 // indirect + github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0 // indirect github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1 // indirect github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.5 // indirect github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.30.0 // indirect @@ -193,6 +196,7 @@ require ( github.com/aws/smithy-go v1.20.2 // indirect github.com/beevik/etree v1.3.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/cedar-policy/cedar-go v0.0.0-20240318205125-470d1fe984bb // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/color v1.16.0 // indirect diff --git a/tools/tfsdk2fw/go.sum b/tools/tfsdk2fw/go.sum index c30cf6bc841e..d7172a7d41a1 100644 --- a/tools/tfsdk2fw/go.sum +++ b/tools/tfsdk2fw/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.51.24 h1:nwL5MaommPkwb7Ixk24eWkdx5HY4of1gD10kFFVAl6A= -github.com/aws/aws-sdk-go v1.51.24/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.26 h1:fYud+95lh9B89fAlRtgYpY8CcJF4T7JrWkLMq4GGCOo= +github.com/aws/aws-sdk-go v1.51.26/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -66,6 +66,8 @@ github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4 h1:xQyow1kdXLj4kcU9ja1MyZS github.com/aws/aws-sdk-go-v2/service/appfabric v1.7.4/go.mod h1:lc5I/jQCLi4eU5RsIe6P+0h/tva09lVpQP17+IpW61w= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4 h1:ARn6qYIxhMRnatsonKQ4y3Wgv9YDjiCIURsPtiuCgIM= github.com/aws/aws-sdk-go-v2/service/appflow v1.41.4/go.mod h1:EGStqkGOjo1Mm1IMelC8W3BPq6n3Qiw+aUCgYTwjV/o= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4 h1:B2DOglYz+zxaSrOfOTCX7bFp9J6LqvyIA25rpwYqOeQ= +github.com/aws/aws-sdk-go-v2/service/appintegrations v1.25.4/go.mod h1:tvRY6xn3fG25GW4n1W76MqTViTTzVfCXKmURxXloT9o= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4 h1:WPPJVRvjvIHeFEqDyjX5yUocKOBAqDOJpvHIaN+LY30= github.com/aws/aws-sdk-go-v2/service/apprunner v1.28.4/go.mod h1:HBEDVCiXAhDxrCJ8meNd1ao+PSQkkB02RfXaEuwyp6U= github.com/aws/aws-sdk-go-v2/service/athena v1.40.4 h1:tiHIjFXSyb5DbNfnu3ql2r86s6llLdzwWAVJkPgw/I0= @@ -82,8 +84,8 @@ github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 h1:WJEEIYSDCqNeG/q0OU github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4/go.mod h1:QdNvYtC3DYswfkhnlWXa0Oib+8jugRL/a+5Nbhw4v/g= github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 h1:3omHt2KuI7K58mb2r3BwKPF0ph0MOXZZ48XIthXhHcI= github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7/go.mod h1:/D6V245MG0yEqSULoBf/zLdQk8lmsMZXR3d/vc2mOdo= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0 h1:TUV3Ih0U+1EaNH8I3OjQl15iOSR94QyXBBELZt2izlk= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.6.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 h1:f2hDre6hySnv5RTcV9zqHdCUp8EmusEIHB81aPFGaAo= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 h1:sVv+p2Wo+sUXa8dC1pCMJ/+9ncOriq8EiRWvAkOuaLY= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4/go.mod h1:JFS3MaNoisHXHQm5/xRQjj1tICixIgT8Vv32D0lV5NE= github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 h1:FgeK3aPbB/ARkhxUXfSn9d2ibb4Q9kUhHl/dWwqIy8Y= @@ -198,6 +200,8 @@ github.com/aws/aws-sdk-go-v2/service/fms v1.31.4 h1:gY+Dp2QdphY6m5IVkETmsNauYztd github.com/aws/aws-sdk-go-v2/service/fms v1.31.4/go.mod h1:X4DjA4sm8cobhR9DtHn947+dLYxU1oWq3zwRZUmFSLo= github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4 h1:y0/RN8LwIbyDTPe/dnDBdsCw89ko8ZNFPW4vStye4aE= github.com/aws/aws-sdk-go-v2/service/glacier v1.22.4/go.mod h1:8ofkOuh1SZLKR5EdfxPhQ1UgaQuCBAZzUwbeIBmeKIM= +github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1 h1:E48tPAIKptyIb8OFOAsZ3xSzjwou8A63f40ao1H3tVU= +github.com/aws/aws-sdk-go-v2/service/globalaccelerator v1.23.1/go.mod h1:6morRSCgJD400qAu5DCEtvoaAC1owS5t6oq8ddLLwxw= github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0 h1:joAdQdtfg8Yy/e5Pq5qwAe0hjH3+EJUzd1jPrlXE3SA= github.com/aws/aws-sdk-go-v2/service/groundstation v1.27.0/go.mod h1:yGNTqdu48YxjsCyLpalmwHCQF52GGERK7+J3nTcvJ3A= github.com/aws/aws-sdk-go-v2/service/healthlake v1.24.0 h1:HRcwttYPNlE5mv6uDlcsk9m4oV3fxV8+a+V4U3jIMd4= @@ -218,8 +222,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/g github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 h1:f9RyWNtS8oH7cZlbn+/JNPpjUk5+5fLd5lM9M0i49Ys= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5/go.mod h1:h5CoMZV2VF297/VLhRhO1WF+XYWOzXo+4HsObA4HjBQ= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0 h1:AnbQdsKqNM5yxpWsJFH69cTuQvCAhF1jlA6mWGcNqbM= -github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.13.0/go.mod h1:71th0isZef+quIOFAqbzFzV67NFkCpMhqogzqPCFSUE= +github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0 h1:6qjUIJWzm5CCOs/F2ZjC5TY/fmy+Ed6P9rJGXJjDg04= +github.com/aws/aws-sdk-go-v2/service/internetmonitor v1.14.0/go.mod h1:71th0isZef+quIOFAqbzFzV67NFkCpMhqogzqPCFSUE= github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5 h1:g5m7QODn5LRm9gWyL2AZl1De7QQQnNEeb5g1o3qmHio= github.com/aws/aws-sdk-go-v2/service/ivschat v1.12.5/go.mod h1:DWOHVe8yf0vrA6DStGG7FQ6GslgVPZljr13WjO3eGo0= github.com/aws/aws-sdk-go-v2/service/kafka v1.31.3 h1:B5/wxR5V2LIUKU7B6vS7RvP2GZg8Dn65NxmaeLgfOGk= @@ -268,8 +272,8 @@ github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4 h1:XHtavC0Lrm5 github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.4/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= github.com/aws/aws-sdk-go-v2/service/osis v1.8.4 h1:ZQyG9HtH9s6+U3rXPHaHq2ICArNtlqEy5HJIiqHChr4= github.com/aws/aws-sdk-go-v2/service/osis v1.8.4/go.mod h1:MHw9zAnU6CaZXqe/J1UNcxcEZLF5oXs21Efdxw0K5tY= -github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4 h1:3Eu2DIvWbjsAUuK47p+5+AZoacf4W5Y3LDawbkI5/es= -github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.9.4/go.mod h1:PCzPetpCllCUXLpDIZ+OKrosD3LGP14/Zr6BLJwc0fo= +github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0 h1:sfVZeQi5tw/2ZZj7n0TyQATIovkxQ/sL2Sow8kBLXYA= +github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.0/go.mod h1:PCzPetpCllCUXLpDIZ+OKrosD3LGP14/Zr6BLJwc0fo= github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4 h1:yv+usWRleYprm877J3eOAJZcNgz2n9NbV/qVk65m2oQ= github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.4/go.mod h1:2NtRjk9YR/8M08R9A7TSpysazsSeDBWk1uQCe5yO8dc= github.com/aws/aws-sdk-go-v2/service/pipes v1.11.4 h1:xOLwoRZoNFTNeM1W6jafNh9xFmvpi7pK2u8cwgO22D0= @@ -290,8 +294,8 @@ github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 h1:j18lTPPqe+qlapn1R8//+uj github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0/go.mod h1:8ldsMsikORLj0GZUozSvbQdctrumAPYhizmj/3AAATI= github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 h1:Rnz5skILimGue5zJ8txb5Mr9JLjznYJFKgK0r/n3AI0= github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4/go.mod h1:rTgaFmfqdMVM4JpBoYZndATNpUguvyjDgUOT9h4qUUs= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4 h1:aCgDTg7NalOIbcz26fFRsz7JtxDUvBHm5/YBT/5J2S8= -github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.4/go.mod h1:XIPGtb7MKsA/uAfS9pngCspt+NfjDxlIAg1hSwvtQQs= +github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5 h1:QxPQnoPHEQbU44AZCIaQCFQ63xxk2eLLCY5cj+yOJU0= +github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5/go.mod h1:XIPGtb7MKsA/uAfS9pngCspt+NfjDxlIAg1hSwvtQQs= github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0 h1:dQsPc/8oqQGe3tWFbCxkujcDtOqprC2i0ssvJeD6tEg= github.com/aws/aws-sdk-go-v2/service/rekognition v1.40.0/go.mod h1:z84+kK5mDuKu7muAIuop201/BOL7XsGwlg+2xtp6XRQ= github.com/aws/aws-sdk-go-v2/service/resourceexplorer2 v1.10.5 h1:jZRmSjW91mFQ6BNUu9wTZ41ZBtEwWH7HNCGLjus2uos= @@ -304,6 +308,8 @@ github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0 h1:znBjrg7qGF7DOXpJ1Z github.com/aws/aws-sdk-go-v2/service/rolesanywhere v1.11.0/go.mod h1:RHFmC9Lds1jS1zBvnFq1GDh3yxFXH++n+2sI9TE53Cc= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4 h1:Qb7EiHvGJZGU43aCMahEJrP5sJjV62gGXm4y9x/syRQ= github.com/aws/aws-sdk-go-v2/service/route53domains v1.23.4/go.mod h1:8wjITSWOCR+G7DhS2WraZnZ/geFYxXLLP0KKTfZtRGQ= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0 h1:on9+rCVnTcfYtz4i7sVsNuJYCAQO9xucyGtaWtlbIXY= +github.com/aws/aws-sdk-go-v2/service/route53profiles v1.0.0/go.mod h1:tTj/YUqvGBhnxNh8gMjf31pSJF1L3STJwdPkjhSyl5I= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 h1:6cnno47Me9bRykw9AEv9zkXE+5or7jz8TsskTTccbgc= github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1/go.mod h1:qmdkIIAC+GCLASF7R2whgNrJADz0QZPX+Seiw/i4S3o= github.com/aws/aws-sdk-go-v2/service/s3control v1.44.6 h1:J6weNKyH2/bVlQ4dWpfprtIGf1tor3Ht5xurx+GXJjs= @@ -354,8 +360,8 @@ github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5 h1:0Ty3j3QkLoqkZ+Va github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.5/go.mod h1:9R1IlrgiivwTCZdbKgMPkseFS+moUM+DLh0TEjO6pvE= github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4 h1:5SSnbzdOLeiFe/n38kjIRc5TKglEs7598sZkFYw9X78= github.com/aws/aws-sdk-go-v2/service/transcribe v1.36.4/go.mod h1:k8u3Uj5KgSM4eUoGXyvLNNf1Y/mLMM7jJM4o9kIazEc= -github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0 h1:4M9wPu5RLDLqo9fUHYvm0Nq+sbnx7fPW9wM273iqYVI= -github.com/aws/aws-sdk-go-v2/service/transfer v1.46.0/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= +github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0 h1:0u+kisnXkglzOMqYQd9xmBDzXELJZFgxT653oMGE+Pg= +github.com/aws/aws-sdk-go-v2/service/transfer v1.47.0/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1 h1:uEKMCWNCbKIEn+en/BqTxJmO/gdMVqzW5VJwhyaG76A= github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.1/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.5 h1:k7JPfsAWnc4vbO/6nksfKdz8lClDacQe5x6fen3vn1A= @@ -376,6 +382,8 @@ github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyX github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= +github.com/cedar-policy/cedar-go v0.0.0-20240318205125-470d1fe984bb h1:WaOlZeLno47GR/TvgUNCqB6itqhT7kMLsUwlIjxWW4Y= +github.com/cedar-policy/cedar-go v0.0.0-20240318205125-470d1fe984bb/go.mod h1:qZuNWmkhx7pxkYvgmNPcBE4NtfGBF6nmI+bjecaQp14= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= @@ -603,8 +611,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= From 1fe612af4d7ed69c82d05419d8dc68c42b014016 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:03:27 -0400 Subject: [PATCH 114/137] Tweak CHANGELOG entry. --- .changelog/37042.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/37042.txt b/.changelog/37042.txt index 8265dec96272..5a675a90dd1d 100644 --- a/.changelog/37042.txt +++ b/.changelog/37042.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -resource/aws_appmesh_mesh: Add serviceDiscovery object to service mesh specification +resource/aws_appmesh_mesh: Add `spec.service_discovery` argument ``` \ No newline at end of file From b99d39e09691d3ac15a3293983d4e26927760d8b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:07:32 -0400 Subject: [PATCH 115/137] r/aws_appmesh_mesh: Document 'spec.service_discovery'. --- website/docs/r/appmesh_mesh.html.markdown | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/website/docs/r/appmesh_mesh.html.markdown b/website/docs/r/appmesh_mesh.html.markdown index 236034f2e426..2f0299630d5a 100644 --- a/website/docs/r/appmesh_mesh.html.markdown +++ b/website/docs/r/appmesh_mesh.html.markdown @@ -40,17 +40,12 @@ This resource supports the following arguments: * `name` - (Required) Name to use for the service mesh. Must be between 1 and 255 characters in length. * `spec` - (Optional) Service mesh specification to apply. + * `egress_filter`- (Optional) Egress filter rules for the service mesh. + * `type` - (Optional) Egress filter type. By default, the type is `DROP_ALL`. Valid values are `ALLOW_ALL` and `DROP_ALL`. + * `service_discovery`- (Optional) The service discovery information for the service mesh. + * `ip_preference` - (Optional) The IP version to use to control traffic within the mesh. Valid values are `IPv6_PREFERRED`, `IPv4_PREFERRED`, `IPv4_ONLY`, and `IPv6_ONLY`. * `tags` - (Optional) Map of tags to assign to the resource. 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. -The `spec` object supports the following: - -* `egress_filter`- (Optional) Egress filter rules for the service mesh. - -The `egress_filter` object supports the following: - -* `type` - (Optional) Egress filter type. By default, the type is `DROP_ALL`. -Valid values are `ALLOW_ALL` and `DROP_ALL`. - ## Attribute Reference This resource exports the following attributes in addition to the arguments above: From 292131f45c98cf3dadd0d702ebc4f15df6d5068f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:09:11 -0400 Subject: [PATCH 116/137] Tweak 'testAccMesh_egressFilter'. --- internal/service/appmesh/mesh_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/service/appmesh/mesh_test.go b/internal/service/appmesh/mesh_test.go index 5b2679fd1017..e227b923add7 100644 --- a/internal/service/appmesh/mesh_test.go +++ b/internal/service/appmesh/mesh_test.go @@ -97,6 +97,7 @@ func testAccMesh_egressFilter(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.egress_filter.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.egress_filter.0.type", "ALLOW_ALL"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "0"), ), }, { From 7a3a965c13962d4032477b5f37cb82ddc19ee64d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:11:09 -0400 Subject: [PATCH 117/137] d/aws_appmesh_gateway_route: Reduce visibility. --- .../appmesh/gateway_route_data_source.go | 78 ++++++++++--------- .../service/appmesh/service_package_gen.go | 3 +- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/internal/service/appmesh/gateway_route_data_source.go b/internal/service/appmesh/gateway_route_data_source.go index dc669bf116b3..466011d890cd 100644 --- a/internal/service/appmesh/gateway_route_data_source.go +++ b/internal/service/appmesh/gateway_route_data_source.go @@ -17,47 +17,49 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_gateway_route") -func DataSourceGatewayRoute() *schema.Resource { +// @SDKDataSource("aws_appmesh_gateway_route", name="Gateway Route") +func dataSourceGatewayRoute() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceGatewayRouteRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceGatewayRouteSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), - "virtual_gateway_name": { - Type: schema.TypeString, - Required: true, - }, + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceGatewayRouteSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + "virtual_gateway_name": { + Type: schema.TypeString, + Required: true, + }, + } }, } } diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index a09059d9d567..3ea768fa8c67 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -26,8 +26,9 @@ func (p *servicePackage) FrameworkResources(ctx context.Context) []*types.Servic func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePackageSDKDataSource { return []*types.ServicePackageSDKDataSource{ { - Factory: DataSourceGatewayRoute, + Factory: dataSourceGatewayRoute, TypeName: "aws_appmesh_gateway_route", + Name: "Gateway Route", }, { Factory: DataSourceMesh, From 79e33ba90ef8dd500d16e9978cc074ce8e1267b3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:15:19 -0400 Subject: [PATCH 118/137] r/aws_appmesh_gateway_route: Reduce visibility. --- internal/service/appmesh/exports_test.go | 11 ++ internal/service/appmesh/gateway_route.go | 100 +++++++++--------- .../appmesh/gateway_route_data_source.go | 2 +- .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- 5 files changed, 65 insertions(+), 52 deletions(-) create mode 100644 internal/service/appmesh/exports_test.go diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go new file mode 100644 index 000000000000..4a67811cdbbf --- /dev/null +++ b/internal/service/appmesh/exports_test.go @@ -0,0 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package appmesh + +// Exports for use in tests only. +var ( + ResourceGatewayRoute = resourceGatewayRoute + + FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey +) diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index dd7b8722d4af..e9cb0c4f123c 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -28,7 +28,7 @@ import ( // @SDKResource("aws_appmesh_gateway_route", name="Gateway Route") // @Tags(identifierAttribute="arn") -func ResourceGatewayRoute() *schema.Resource { +func resourceGatewayRoute() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceGatewayRouteCreate, ReadWithoutTimeout: resourceGatewayRouteRead, @@ -39,51 +39,53 @@ func ResourceGatewayRoute() *schema.Resource { StateContext: resourceGatewayRouteImport, }, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceGatewayRouteSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), - "virtual_gateway_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceGatewayRouteSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + "virtual_gateway_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + } }, CustomizeDiff: verify.SetTagsDiff, @@ -536,7 +538,7 @@ func resourceGatewayRouteRead(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindGatewayRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_gateway_name").(string), d.Get("name").(string)) + return findGatewayRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_gateway_name").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -632,7 +634,7 @@ func resourceGatewayRouteImport(ctx context.Context, d *schema.ResourceData, met virtualGatewayName := parts[1] name := parts[2] - gatewayRoute, err := FindGatewayRouteByFourPartKey(ctx, conn, meshName, "", virtualGatewayName, name) + gatewayRoute, err := findGatewayRouteByFourPartKey(ctx, conn, meshName, "", virtualGatewayName, name) if err != nil { return nil, err @@ -646,7 +648,7 @@ func resourceGatewayRouteImport(ctx context.Context, d *schema.ResourceData, met return []*schema.ResourceData{d}, nil } -func FindGatewayRouteByFourPartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, virtualGatewayName, name string) (*appmesh.GatewayRouteData, error) { +func findGatewayRouteByFourPartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, virtualGatewayName, name string) (*appmesh.GatewayRouteData, error) { input := &appmesh.DescribeGatewayRouteInput{ GatewayRouteName: aws.String(name), MeshName: aws.String(meshName), diff --git a/internal/service/appmesh/gateway_route_data_source.go b/internal/service/appmesh/gateway_route_data_source.go index 466011d890cd..998c3ffb8c8d 100644 --- a/internal/service/appmesh/gateway_route_data_source.go +++ b/internal/service/appmesh/gateway_route_data_source.go @@ -70,7 +70,7 @@ func dataSourceGatewayRouteRead(ctx context.Context, d *schema.ResourceData, met ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig gatewayRouteName := d.Get("name").(string) - gatewayRoute, err := FindGatewayRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_gateway_name").(string), gatewayRouteName) + gatewayRoute, err := findGatewayRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_gateway_name").(string), gatewayRouteName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Gateway Route (%s): %s", gatewayRouteName, err) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 3ea768fa8c67..98545bac349f 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -60,7 +60,7 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePackageSDKResource { return []*types.ServicePackageSDKResource{ { - Factory: ResourceGatewayRoute, + Factory: resourceGatewayRoute, TypeName: "aws_appmesh_gateway_route", Name: "Gateway Route", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index bccaf0a689a3..a85332e181dc 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -433,7 +433,7 @@ func sweepGatewayRoutes(region string) error { for _, v := range page.GatewayRoutes { gatewayRouteName := aws.StringValue(v.GatewayRouteName) - r := ResourceGatewayRoute() + r := resourceGatewayRoute() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s/%s", meshName, virtualGatewayName, gatewayRouteName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) From 222573c34c527d24fcfca47321f6d640511c9d75 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:16:45 -0400 Subject: [PATCH 119/137] d/aws_appmesh_mesh: Reduce visibility. --- internal/service/appmesh/mesh_data_source.go | 62 ++++++++++--------- .../service/appmesh/service_package_gen.go | 3 +- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/internal/service/appmesh/mesh_data_source.go b/internal/service/appmesh/mesh_data_source.go index 327d81654aaf..5ed8d8fa3c41 100644 --- a/internal/service/appmesh/mesh_data_source.go +++ b/internal/service/appmesh/mesh_data_source.go @@ -17,39 +17,41 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_mesh") -func DataSourceMesh() *schema.Resource { +// @SDKDataSource("aws_appmesh_mesh", name="Service Mesh") +func dataSourceMesh() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceMeshRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceMeshSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceMeshSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + } }, } } diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 98545bac349f..96c8d6b088d6 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -31,8 +31,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Gateway Route", }, { - Factory: DataSourceMesh, + Factory: dataSourceMesh, TypeName: "aws_appmesh_mesh", + Name: "Service Mesh", }, { Factory: DataSourceRoute, From 675d5cdcd9d53c9a8b21e425bb9095f2711097b2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:18:43 -0400 Subject: [PATCH 120/137] r/aws_appmesh_mesh: Reduce visibility. --- internal/service/appmesh/exports_test.go | 2 + internal/service/appmesh/mesh.go | 68 ++++++++++--------- internal/service/appmesh/mesh_data_source.go | 2 +- .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- 5 files changed, 40 insertions(+), 36 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index 4a67811cdbbf..d5d36b2ba163 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -6,6 +6,8 @@ package appmesh // Exports for use in tests only. var ( ResourceGatewayRoute = resourceGatewayRoute + ResourceMesh = resourceMesh FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey + FindMeshByTwoPartKey = findMeshByTwoPartKey ) diff --git a/internal/service/appmesh/mesh.go b/internal/service/appmesh/mesh.go index c8f15685c1b3..c5660f2e4c81 100644 --- a/internal/service/appmesh/mesh.go +++ b/internal/service/appmesh/mesh.go @@ -25,7 +25,7 @@ import ( // @SDKResource("aws_appmesh_mesh", name="Service Mesh") // @Tags(identifierAttribute="arn") -func ResourceMesh() *schema.Resource { +func resourceMesh() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceMeshCreate, ReadWithoutTimeout: resourceMeshRead, @@ -36,36 +36,38 @@ func ResourceMesh() *schema.Resource { StateContext: schema.ImportStatePassthroughContext, }, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceMeshSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceMeshSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + } }, CustomizeDiff: verify.SetTagsDiff, @@ -144,7 +146,7 @@ func resourceMeshRead(ctx context.Context, d *schema.ResourceData, meta interfac conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindMeshByTwoPartKey(ctx, conn, d.Id(), d.Get("mesh_owner").(string)) + return findMeshByTwoPartKey(ctx, conn, d.Id(), d.Get("mesh_owner").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -212,7 +214,7 @@ func resourceMeshDelete(ctx context.Context, d *schema.ResourceData, meta interf return diags } -func FindMeshByTwoPartKey(ctx context.Context, conn *appmesh.AppMesh, name, owner string) (*appmesh.MeshData, error) { +func findMeshByTwoPartKey(ctx context.Context, conn *appmesh.AppMesh, name, owner string) (*appmesh.MeshData, error) { input := &appmesh.DescribeMeshInput{ MeshName: aws.String(name), } diff --git a/internal/service/appmesh/mesh_data_source.go b/internal/service/appmesh/mesh_data_source.go index 5ed8d8fa3c41..cf465f10d570 100644 --- a/internal/service/appmesh/mesh_data_source.go +++ b/internal/service/appmesh/mesh_data_source.go @@ -62,7 +62,7 @@ func dataSourceMeshRead(ctx context.Context, d *schema.ResourceData, meta interf ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig meshName := d.Get("name").(string) - mesh, err := FindMeshByTwoPartKey(ctx, conn, meshName, d.Get("mesh_owner").(string)) + mesh, err := findMeshByTwoPartKey(ctx, conn, meshName, d.Get("mesh_owner").(string)) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Service Mesh (%s): %s", meshName, err) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 96c8d6b088d6..d8601cccf849 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -69,7 +69,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceMesh, + Factory: resourceMesh, TypeName: "aws_appmesh_mesh", Name: "Service Mesh", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index a85332e181dc..d798e66aabcf 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -80,7 +80,7 @@ func sweepMeshes(region string) error { } for _, v := range page.Meshes { - r := ResourceMesh() + r := resourceMesh() d := r.Data(nil) d.SetId(aws.StringValue(v.MeshName)) From f967dd8de0546ebaf2ff225578d5c60912a8598f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:20:15 -0400 Subject: [PATCH 121/137] d/aws_appmesh_route: Reduce visibility. --- internal/service/appmesh/route_data_source.go | 78 ++++++++++--------- .../service/appmesh/service_package_gen.go | 3 +- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/internal/service/appmesh/route_data_source.go b/internal/service/appmesh/route_data_source.go index 2fdf20de7248..283d3ea7e65a 100644 --- a/internal/service/appmesh/route_data_source.go +++ b/internal/service/appmesh/route_data_source.go @@ -17,47 +17,49 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_route") -func DataSourceRoute() *schema.Resource { +// @SDKDataSource("aws_appmesh_route", name="Route") +func dataSourceRoute() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceRouteRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceRouteSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), - "virtual_router_name": { - Type: schema.TypeString, - Required: true, - }, + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceRouteSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + "virtual_router_name": { + Type: schema.TypeString, + Required: true, + }, + } }, } } diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index d8601cccf849..4a4fc365e2aa 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -36,8 +36,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Service Mesh", }, { - Factory: DataSourceRoute, + Factory: dataSourceRoute, TypeName: "aws_appmesh_route", + Name: "Route", }, { Factory: DataSourceVirtualGateway, From 61f241dd9ef6b498c43507ddc476da1f826efc1e Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:22:02 -0400 Subject: [PATCH 122/137] r/aws_appmesh_route: Reduce visibility. --- internal/service/appmesh/exports_test.go | 2 + internal/service/appmesh/route.go | 100 +++++++++--------- internal/service/appmesh/route_data_source.go | 2 +- .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- 5 files changed, 56 insertions(+), 52 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index d5d36b2ba163..7e6d19c48779 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -7,7 +7,9 @@ package appmesh var ( ResourceGatewayRoute = resourceGatewayRoute ResourceMesh = resourceMesh + ResourceRoute = resourceRoute FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey FindMeshByTwoPartKey = findMeshByTwoPartKey + FindRouteByFourPartKey = findRouteByFourPartKey ) diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index 06e11f8f63ad..34c23815fe0f 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -28,7 +28,7 @@ import ( // @SDKResource("aws_appmesh_route", name="Route") // @Tags(identifierAttribute="arn") -func ResourceRoute() *schema.Resource { +func resourceRoute() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceRouteCreate, ReadWithoutTimeout: resourceRouteRead, @@ -39,51 +39,53 @@ func ResourceRoute() *schema.Resource { StateContext: resourceRouteImport, }, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceRouteSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), - "virtual_router_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceRouteSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + "virtual_router_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + } }, CustomizeDiff: verify.SetTagsDiff, @@ -771,7 +773,7 @@ func resourceRouteRead(ctx context.Context, d *schema.ResourceData, meta interfa conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_router_name").(string), d.Get("name").(string)) + return findRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_router_name").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -867,7 +869,7 @@ func resourceRouteImport(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).AppMeshConn(ctx) - route, err := FindRouteByFourPartKey(ctx, conn, meshName, "", virtualRouterName, name) + route, err := findRouteByFourPartKey(ctx, conn, meshName, "", virtualRouterName, name) if err != nil { return nil, err @@ -881,7 +883,7 @@ func resourceRouteImport(ctx context.Context, d *schema.ResourceData, meta inter return []*schema.ResourceData{d}, nil } -func FindRouteByFourPartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, virtualRouterName, name string) (*appmesh.RouteData, error) { +func findRouteByFourPartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, virtualRouterName, name string) (*appmesh.RouteData, error) { input := &appmesh.DescribeRouteInput{ MeshName: aws.String(meshName), RouteName: aws.String(name), diff --git a/internal/service/appmesh/route_data_source.go b/internal/service/appmesh/route_data_source.go index 283d3ea7e65a..cb094ad24b2b 100644 --- a/internal/service/appmesh/route_data_source.go +++ b/internal/service/appmesh/route_data_source.go @@ -70,7 +70,7 @@ func dataSourceRouteRead(ctx context.Context, d *schema.ResourceData, meta inter ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig routeName := d.Get("name").(string) - route, err := FindRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_router_name").(string), routeName) + route, err := findRouteByFourPartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("virtual_router_name").(string), routeName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Route (%s): %s", routeName, err) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 4a4fc365e2aa..f593eff22279 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -78,7 +78,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceRoute, + Factory: resourceRoute, TypeName: "aws_appmesh_route", Name: "Route", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index d798e66aabcf..073865fea3de 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -529,7 +529,7 @@ func sweepRoutes(region string) error { for _, v := range page.Routes { routeName := aws.StringValue(v.RouteName) - r := ResourceRoute() + r := resourceRoute() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s/%s", meshName, virtualRouterName, routeName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) From 61ab4d0e35d31e6f04a1cf3e79386cc700011d59 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:23:02 -0400 Subject: [PATCH 123/137] Better file name. --- internal/service/appmesh/{wait.go => consts.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename internal/service/appmesh/{wait.go => consts.go} (100%) diff --git a/internal/service/appmesh/wait.go b/internal/service/appmesh/consts.go similarity index 100% rename from internal/service/appmesh/wait.go rename to internal/service/appmesh/consts.go From 618bc60d776853f6309294ef99254a9273f034c5 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:24:33 -0400 Subject: [PATCH 124/137] d/aws_appmesh_virtual_gateway: Reduce visibility. --- .../service/appmesh/service_package_gen.go | 3 +- .../appmesh/virtual_gateway_data_source.go | 68 ++++++++++--------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index f593eff22279..a7a79a542759 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -41,8 +41,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Route", }, { - Factory: DataSourceVirtualGateway, + Factory: dataSourceVirtualGateway, TypeName: "aws_appmesh_virtual_gateway", + Name: "Virtual Gateway", }, { Factory: DataSourceVirtualNode, diff --git a/internal/service/appmesh/virtual_gateway_data_source.go b/internal/service/appmesh/virtual_gateway_data_source.go index dabbba3f3ea0..68116a0ee21b 100644 --- a/internal/service/appmesh/virtual_gateway_data_source.go +++ b/internal/service/appmesh/virtual_gateway_data_source.go @@ -17,42 +17,44 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_virtual_gateway") -func DataSourceVirtualGateway() *schema.Resource { +// @SDKDataSource("aws_appmesh_virtual_gateway", name="Virtual Gateway") +func dataSourceVirtualGateway() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceVirtualGatewayRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualGatewaySpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualGatewaySpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + } }, } } From bc4693106619501cb3e70501e0294c940321eb85 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:26:44 -0400 Subject: [PATCH 125/137] r/aws_appmesh_virtual_gateway: Reduce visibility. --- internal/service/appmesh/exports_test.go | 14 +-- .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- internal/service/appmesh/virtual_gateway.go | 88 ++++++++++--------- .../appmesh/virtual_gateway_data_source.go | 2 +- 5 files changed, 56 insertions(+), 52 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index 7e6d19c48779..74a0ff7994f7 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -5,11 +5,13 @@ package appmesh // Exports for use in tests only. var ( - ResourceGatewayRoute = resourceGatewayRoute - ResourceMesh = resourceMesh - ResourceRoute = resourceRoute + ResourceGatewayRoute = resourceGatewayRoute + ResourceMesh = resourceMesh + ResourceRoute = resourceRoute + ResourceVirtualGateway = resourceVirtualGateway - FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey - FindMeshByTwoPartKey = findMeshByTwoPartKey - FindRouteByFourPartKey = findRouteByFourPartKey + FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey + FindMeshByTwoPartKey = findMeshByTwoPartKey + FindRouteByFourPartKey = findRouteByFourPartKey + FindVirtualGatewayByThreePartKey = findVirtualGatewayByThreePartKey ) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index a7a79a542759..8e4ff2cd48c4 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -87,7 +87,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceVirtualGateway, + Factory: resourceVirtualGateway, TypeName: "aws_appmesh_virtual_gateway", Name: "Virtual Gateway", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index 073865fea3de..44daee6b7b1d 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -137,7 +137,7 @@ func sweepVirtualGateways(region string) error { for _, v := range page.VirtualGateways { virtualGatewayName := aws.StringValue(v.VirtualGatewayName) - r := ResourceVirtualGateway() + r := resourceVirtualGateway() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s", meshName, virtualGatewayName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index ac37f5de06db..ffde6b631594 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -28,7 +28,7 @@ import ( // @SDKResource("aws_appmesh_virtual_gateway", name="Virtual Gateway") // @Tags(identifierAttribute="arn") -func ResourceVirtualGateway() *schema.Resource { +func resourceVirtualGateway() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceVirtualGatewayCreate, ReadWithoutTimeout: resourceVirtualGatewayRead, @@ -39,45 +39,47 @@ func ResourceVirtualGateway() *schema.Resource { StateContext: resourceVirtualGatewayImport, }, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceVirtualGatewaySpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceVirtualGatewaySpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + } }, CustomizeDiff: verify.SetTagsDiff, @@ -683,7 +685,7 @@ func resourceVirtualGatewayRead(ctx context.Context, d *schema.ResourceData, met conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindVirtualGatewayByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) + return findVirtualGatewayByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -776,7 +778,7 @@ func resourceVirtualGatewayImport(ctx context.Context, d *schema.ResourceData, m conn := meta.(*conns.AWSClient).AppMeshConn(ctx) - virtualGateway, err := FindVirtualGatewayByThreePartKey(ctx, conn, meshName, "", name) + virtualGateway, err := findVirtualGatewayByThreePartKey(ctx, conn, meshName, "", name) if err != nil { return nil, err @@ -789,7 +791,7 @@ func resourceVirtualGatewayImport(ctx context.Context, d *schema.ResourceData, m return []*schema.ResourceData{d}, nil } -func FindVirtualGatewayByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualGatewayData, error) { +func findVirtualGatewayByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualGatewayData, error) { input := &appmesh.DescribeVirtualGatewayInput{ MeshName: aws.String(meshName), VirtualGatewayName: aws.String(name), diff --git a/internal/service/appmesh/virtual_gateway_data_source.go b/internal/service/appmesh/virtual_gateway_data_source.go index 68116a0ee21b..05efa4155b56 100644 --- a/internal/service/appmesh/virtual_gateway_data_source.go +++ b/internal/service/appmesh/virtual_gateway_data_source.go @@ -65,7 +65,7 @@ func dataSourceVirtualGatewayRead(ctx context.Context, d *schema.ResourceData, m ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig virtualGatewayName := d.Get("name").(string) - virtualGateway, err := FindVirtualGatewayByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualGatewayName) + virtualGateway, err := findVirtualGatewayByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualGatewayName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Virtual Gateway (%s): %s", virtualGatewayName, err) From 3ffbdd13a5a5098ba210526678b48d27e245dbcf Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:28:06 -0400 Subject: [PATCH 126/137] d/aws_appmesh_virtual_node: Reduce visibility. --- .../service/appmesh/service_package_gen.go | 3 +- .../appmesh/virtual_node_data_source.go | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 8e4ff2cd48c4..2b8304877125 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -46,8 +46,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Virtual Gateway", }, { - Factory: DataSourceVirtualNode, + Factory: dataSourceVirtualNode, TypeName: "aws_appmesh_virtual_node", + Name: "Virtual Node", }, { Factory: DataSourceVirtualRouter, diff --git a/internal/service/appmesh/virtual_node_data_source.go b/internal/service/appmesh/virtual_node_data_source.go index a952152f53aa..8765618a382a 100644 --- a/internal/service/appmesh/virtual_node_data_source.go +++ b/internal/service/appmesh/virtual_node_data_source.go @@ -17,43 +17,45 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_virtual_node") -func DataSourceVirtualNode() *schema.Resource { +// @SDKDataSource("aws_appmesh_virtual_node", name="Virtual Node") +func dataSourceVirtualNode() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceVirtualNodeRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualNodeSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualNodeSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + } }, } } From b1922afc2e5e45ae3ccc04d98e220e1d0bc4a5d7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:30:07 -0400 Subject: [PATCH 127/137] r/aws_appmesh_virtual_node: Reduce visibility. --- internal/service/appmesh/exports_test.go | 2 + .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- internal/service/appmesh/virtual_node.go | 88 ++++++++++--------- .../appmesh/virtual_node_data_source.go | 2 +- 5 files changed, 50 insertions(+), 46 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index 74a0ff7994f7..d9cb292a6f58 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -9,9 +9,11 @@ var ( ResourceMesh = resourceMesh ResourceRoute = resourceRoute ResourceVirtualGateway = resourceVirtualGateway + ResourceVirtualNode = resourceVirtualNode FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey FindMeshByTwoPartKey = findMeshByTwoPartKey FindRouteByFourPartKey = findRouteByFourPartKey FindVirtualGatewayByThreePartKey = findVirtualGatewayByThreePartKey + FindVirtualNodeByThreePartKey = findVirtualNodeByThreePartKey ) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 2b8304877125..29fd0f37735b 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -96,7 +96,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceVirtualNode, + Factory: resourceVirtualNode, TypeName: "aws_appmesh_virtual_node", Name: "Virtual Node", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index 44daee6b7b1d..3d06dcaa8619 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -208,7 +208,7 @@ func sweepVirtualNodes(region string) error { for _, v := range page.VirtualNodes { virtualNodeName := aws.StringValue(v.VirtualNodeName) - r := ResourceVirtualNode() + r := resourceVirtualNode() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s", meshName, virtualNodeName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index c6efc3929b78..f657581c6166 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -27,7 +27,7 @@ import ( // @SDKResource("aws_appmesh_virtual_node", name="Virtual Node") // @Tags(identifierAttribute="arn") -func ResourceVirtualNode() *schema.Resource { +func resourceVirtualNode() *schema.Resource { //lintignore:R011 return &schema.Resource{ CreateWithoutTimeout: resourceVirtualNodeCreate, @@ -42,45 +42,47 @@ func ResourceVirtualNode() *schema.Resource { SchemaVersion: 1, MigrateState: resourceVirtualNodeMigrateState, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceVirtualNodeSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceVirtualNodeSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + } }, CustomizeDiff: verify.SetTagsDiff, @@ -1000,7 +1002,7 @@ func resourceVirtualNodeRead(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindVirtualNodeByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) + return findVirtualNodeByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -1092,7 +1094,7 @@ func resourceVirtualNodeImport(ctx context.Context, d *schema.ResourceData, meta meshName := parts[0] name := parts[1] - vn, err := FindVirtualNodeByThreePartKey(ctx, conn, meshName, "", name) + vn, err := findVirtualNodeByThreePartKey(ctx, conn, meshName, "", name) if err != nil { return nil, err @@ -1105,7 +1107,7 @@ func resourceVirtualNodeImport(ctx context.Context, d *schema.ResourceData, meta return []*schema.ResourceData{d}, nil } -func FindVirtualNodeByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualNodeData, error) { +func findVirtualNodeByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualNodeData, error) { input := &appmesh.DescribeVirtualNodeInput{ MeshName: aws.String(meshName), VirtualNodeName: aws.String(name), diff --git a/internal/service/appmesh/virtual_node_data_source.go b/internal/service/appmesh/virtual_node_data_source.go index 8765618a382a..573fc4386438 100644 --- a/internal/service/appmesh/virtual_node_data_source.go +++ b/internal/service/appmesh/virtual_node_data_source.go @@ -66,7 +66,7 @@ func dataSourceVirtualNodeRead(ctx context.Context, d *schema.ResourceData, meta ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig virtualNodeName := d.Get("name").(string) - vn, err := FindVirtualNodeByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualNodeName) + vn, err := findVirtualNodeByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualNodeName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Virtual Node (%s): %s", virtualNodeName, err) From a5da2e4e682032430fca9298caece84cc5f2edcb Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:31:26 -0400 Subject: [PATCH 128/137] d/aws_appmesh_virtual_router: Reduce visibility. --- .../service/appmesh/service_package_gen.go | 3 +- .../appmesh/virtual_router_data_source.go | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 29fd0f37735b..dcd3bf8728d0 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -51,8 +51,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Virtual Node", }, { - Factory: DataSourceVirtualRouter, + Factory: dataSourceVirtualRouter, TypeName: "aws_appmesh_virtual_router", + Name: "Virtual Router", }, { Factory: DataSourceVirtualService, diff --git a/internal/service/appmesh/virtual_router_data_source.go b/internal/service/appmesh/virtual_router_data_source.go index 5ff6958bbe16..ab96e666012c 100644 --- a/internal/service/appmesh/virtual_router_data_source.go +++ b/internal/service/appmesh/virtual_router_data_source.go @@ -17,43 +17,45 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_virtual_router") -func DataSourceVirtualRouter() *schema.Resource { +// @SDKDataSource("aws_appmesh_virtual_router", name="Virtual Router") +func dataSourceVirtualRouter() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceVirtualRouterRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualRouterSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualRouterSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + } }, } } From 1f23d9918fc92e136c31482bcfa70bff6a419688 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:32:56 -0400 Subject: [PATCH 129/137] r/aws_appmesh_virtual_router: Reduce visibility. --- internal/service/appmesh/exports_test.go | 2 + .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- internal/service/appmesh/virtual_router.go | 88 ++++++++++--------- .../appmesh/virtual_router_data_source.go | 2 +- 5 files changed, 50 insertions(+), 46 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index d9cb292a6f58..18da20b95ba4 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -10,10 +10,12 @@ var ( ResourceRoute = resourceRoute ResourceVirtualGateway = resourceVirtualGateway ResourceVirtualNode = resourceVirtualNode + ResourceVirtualRouter = resourceVirtualRouter FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey FindMeshByTwoPartKey = findMeshByTwoPartKey FindRouteByFourPartKey = findRouteByFourPartKey FindVirtualGatewayByThreePartKey = findVirtualGatewayByThreePartKey FindVirtualNodeByThreePartKey = findVirtualNodeByThreePartKey + FindVirtualRouterByThreePartKey = findVirtualRouterByThreePartKey ) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index dcd3bf8728d0..4f0687b81076 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -105,7 +105,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceVirtualRouter, + Factory: resourceVirtualRouter, TypeName: "aws_appmesh_virtual_router", Name: "Virtual Router", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index 3d06dcaa8619..854cc129b57b 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -279,7 +279,7 @@ func sweepVirtualRouters(region string) error { for _, v := range page.VirtualRouters { virtualRouterName := aws.StringValue(v.VirtualRouterName) - r := ResourceVirtualRouter() + r := resourceVirtualRouter() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s", meshName, virtualRouterName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) diff --git a/internal/service/appmesh/virtual_router.go b/internal/service/appmesh/virtual_router.go index 186281f0c623..3fd9b9da7b33 100644 --- a/internal/service/appmesh/virtual_router.go +++ b/internal/service/appmesh/virtual_router.go @@ -27,7 +27,7 @@ import ( // @SDKResource("aws_appmesh_virtual_router", name="Virtual Router") // @Tags(identifierAttribute="arn") -func ResourceVirtualRouter() *schema.Resource { +func resourceVirtualRouter() *schema.Resource { //lintignore:R011 return &schema.Resource{ CreateWithoutTimeout: resourceVirtualRouterCreate, @@ -42,45 +42,47 @@ func ResourceVirtualRouter() *schema.Resource { SchemaVersion: 1, MigrateState: resourceVirtualRouterMigrateState, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceVirtualRouterSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceVirtualRouterSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + } }, CustomizeDiff: verify.SetTagsDiff, @@ -161,7 +163,7 @@ func resourceVirtualRouterRead(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindVirtualRouterByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) + return findVirtualRouterByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -253,7 +255,7 @@ func resourceVirtualRouterImport(ctx context.Context, d *schema.ResourceData, me meshName := parts[0] name := parts[1] - vr, err := FindVirtualRouterByThreePartKey(ctx, conn, meshName, "", name) + vr, err := findVirtualRouterByThreePartKey(ctx, conn, meshName, "", name) if err != nil { return nil, err @@ -266,7 +268,7 @@ func resourceVirtualRouterImport(ctx context.Context, d *schema.ResourceData, me return []*schema.ResourceData{d}, nil } -func FindVirtualRouterByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualRouterData, error) { +func findVirtualRouterByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualRouterData, error) { input := &appmesh.DescribeVirtualRouterInput{ MeshName: aws.String(meshName), VirtualRouterName: aws.String(name), diff --git a/internal/service/appmesh/virtual_router_data_source.go b/internal/service/appmesh/virtual_router_data_source.go index ab96e666012c..305c25892868 100644 --- a/internal/service/appmesh/virtual_router_data_source.go +++ b/internal/service/appmesh/virtual_router_data_source.go @@ -66,7 +66,7 @@ func dataSourceVirtualRouterRead(ctx context.Context, d *schema.ResourceData, me ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig virtualRouterName := d.Get("name").(string) - vr, err := FindVirtualRouterByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualRouterName) + vr, err := findVirtualRouterByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualRouterName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Virtual Router (%s): %s", virtualRouterName, err) From 0e4b5f3794c02681959cb2a7c6599dc846a9c4ff Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:33:54 -0400 Subject: [PATCH 130/137] d/aws_appmesh_virtual_service: Reduce visibility. --- .../service/appmesh/service_package_gen.go | 3 +- .../appmesh/virtual_service_data_source.go | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index 4f0687b81076..d35cc6d16d40 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -56,8 +56,9 @@ func (p *servicePackage) SDKDataSources(ctx context.Context) []*types.ServicePac Name: "Virtual Router", }, { - Factory: DataSourceVirtualService, + Factory: dataSourceVirtualService, TypeName: "aws_appmesh_virtual_service", + Name: "Virtual Service", }, } } diff --git a/internal/service/appmesh/virtual_service_data_source.go b/internal/service/appmesh/virtual_service_data_source.go index c20e0f09aefa..9eccd09fcc51 100644 --- a/internal/service/appmesh/virtual_service_data_source.go +++ b/internal/service/appmesh/virtual_service_data_source.go @@ -17,43 +17,45 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -// @SDKDataSource("aws_appmesh_virtual_service") -func DataSourceVirtualService() *schema.Resource { +// @SDKDataSource("aws_appmesh_virtual_service", name="Virtual Service") +func dataSourceVirtualService() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceVirtualServiceRead, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": { - Type: schema.TypeString, - Required: true, - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualServiceSpecSchema()), - names.AttrTags: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": sdkv2.DataSourcePropertyFromResourceProperty(resourceVirtualServiceSpecSchema()), + names.AttrTags: tftags.TagsSchemaComputed(), + } }, } } From 33ac30f1e8ee2e8244fc1543d275aa4ad67d2ce8 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 08:35:16 -0400 Subject: [PATCH 131/137] r/aws_appmesh_virtual_service: Reduce visibility. --- internal/service/appmesh/exports_test.go | 2 + .../service/appmesh/service_package_gen.go | 2 +- internal/service/appmesh/sweep.go | 2 +- internal/service/appmesh/virtual_service.go | 88 ++++++++++--------- .../appmesh/virtual_service_data_source.go | 2 +- 5 files changed, 50 insertions(+), 46 deletions(-) diff --git a/internal/service/appmesh/exports_test.go b/internal/service/appmesh/exports_test.go index 18da20b95ba4..9a50cc59d212 100644 --- a/internal/service/appmesh/exports_test.go +++ b/internal/service/appmesh/exports_test.go @@ -11,6 +11,7 @@ var ( ResourceVirtualGateway = resourceVirtualGateway ResourceVirtualNode = resourceVirtualNode ResourceVirtualRouter = resourceVirtualRouter + ResourceVirtualService = resourceVirtualService FindGatewayRouteByFourPartKey = findGatewayRouteByFourPartKey FindMeshByTwoPartKey = findMeshByTwoPartKey @@ -18,4 +19,5 @@ var ( FindVirtualGatewayByThreePartKey = findVirtualGatewayByThreePartKey FindVirtualNodeByThreePartKey = findVirtualNodeByThreePartKey FindVirtualRouterByThreePartKey = findVirtualRouterByThreePartKey + FindVirtualServiceByThreePartKey = findVirtualServiceByThreePartKey ) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index d35cc6d16d40..d847c58c3a8a 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -114,7 +114,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka }, }, { - Factory: ResourceVirtualService, + Factory: resourceVirtualService, TypeName: "aws_appmesh_virtual_service", Name: "Virtual Service", Tags: &types.ServicePackageResourceTags{ diff --git a/internal/service/appmesh/sweep.go b/internal/service/appmesh/sweep.go index 854cc129b57b..410923c58213 100644 --- a/internal/service/appmesh/sweep.go +++ b/internal/service/appmesh/sweep.go @@ -350,7 +350,7 @@ func sweepVirtualServices(region string) error { for _, v := range page.VirtualServices { virtualServiceName := aws.StringValue(v.VirtualServiceName) - r := ResourceVirtualService() + r := resourceVirtualService() d := r.Data(nil) d.SetId(fmt.Sprintf("%s/%s", meshName, virtualServiceName)) // Logged in Delete handler, not used in API call. d.Set("mesh_name", meshName) diff --git a/internal/service/appmesh/virtual_service.go b/internal/service/appmesh/virtual_service.go index 894f8c36f5d9..dca5eeaac4de 100644 --- a/internal/service/appmesh/virtual_service.go +++ b/internal/service/appmesh/virtual_service.go @@ -27,7 +27,7 @@ import ( // @SDKResource("aws_appmesh_virtual_service", name="Virtual Service") // @Tags(identifierAttribute="arn") -func ResourceVirtualService() *schema.Resource { +func resourceVirtualService() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceVirtualServiceCreate, ReadWithoutTimeout: resourceVirtualServiceRead, @@ -38,45 +38,47 @@ func ResourceVirtualService() *schema.Resource { StateContext: resourceVirtualServiceImport, }, - Schema: map[string]*schema.Schema{ - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "mesh_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "mesh_owner": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: verify.ValidAccountID, - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), - }, - "resource_owner": { - Type: schema.TypeString, - Computed: true, - }, - "spec": resourceVirtualServiceSpecSchema(), - names.AttrTags: tftags.TagsSchema(), - names.AttrTagsAll: tftags.TagsSchemaComputed(), + SchemaFunc: func() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + "mesh_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "mesh_owner": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: verify.ValidAccountID, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), + }, + "resource_owner": { + Type: schema.TypeString, + Computed: true, + }, + "spec": resourceVirtualServiceSpecSchema(), + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), + } }, CustomizeDiff: verify.SetTagsDiff, @@ -170,7 +172,7 @@ func resourceVirtualServiceRead(ctx context.Context, d *schema.ResourceData, met conn := meta.(*conns.AWSClient).AppMeshConn(ctx) outputRaw, err := tfresource.RetryWhenNewResourceNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return FindVirtualServiceByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) + return findVirtualServiceByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), d.Get("name").(string)) }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -262,7 +264,7 @@ func resourceVirtualServiceImport(ctx context.Context, d *schema.ResourceData, m meshName := parts[0] name := parts[1] - vs, err := FindVirtualServiceByThreePartKey(ctx, conn, meshName, "", name) + vs, err := findVirtualServiceByThreePartKey(ctx, conn, meshName, "", name) if err != nil { return nil, err @@ -275,7 +277,7 @@ func resourceVirtualServiceImport(ctx context.Context, d *schema.ResourceData, m return []*schema.ResourceData{d}, nil } -func FindVirtualServiceByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualServiceData, error) { +func findVirtualServiceByThreePartKey(ctx context.Context, conn *appmesh.AppMesh, meshName, meshOwner, name string) (*appmesh.VirtualServiceData, error) { input := &appmesh.DescribeVirtualServiceInput{ MeshName: aws.String(meshName), VirtualServiceName: aws.String(name), diff --git a/internal/service/appmesh/virtual_service_data_source.go b/internal/service/appmesh/virtual_service_data_source.go index 9eccd09fcc51..317822c14d52 100644 --- a/internal/service/appmesh/virtual_service_data_source.go +++ b/internal/service/appmesh/virtual_service_data_source.go @@ -66,7 +66,7 @@ func dataSourceVirtualServiceRead(ctx context.Context, d *schema.ResourceData, m ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig virtualServiceName := d.Get("name").(string) - vs, err := FindVirtualServiceByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualServiceName) + vs, err := findVirtualServiceByThreePartKey(ctx, conn, d.Get("mesh_name").(string), d.Get("mesh_owner").(string), virtualServiceName) if err != nil { return sdkdiag.AppendErrorf(diags, "reading App Mesh Virtual Service (%s): %s", virtualServiceName, err) From ba711b401df59db6bce12766df24184b7aae96c0 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 09:14:52 -0400 Subject: [PATCH 132/137] Run 'make gen'. --- .ci/.semgrep-service-name0.yml | 14 ++++++++ .ci/.semgrep-service-name1.yml | 29 ++++++++-------- .ci/.semgrep-service-name2.yml | 61 +++++++++++++++++++++++++--------- .ci/.semgrep-service-name3.yml | 46 ------------------------- 4 files changed, 75 insertions(+), 75 deletions(-) diff --git a/.ci/.semgrep-service-name0.yml b/.ci/.semgrep-service-name0.yml index 102b4cdbd391..cb886294d4d0 100644 --- a/.ci/.semgrep-service-name0.yml +++ b/.ci/.semgrep-service-name0.yml @@ -4085,3 +4085,17 @@ rules: - pattern-not-regex: "^TestAccConfigService" - pattern-regex: ^TestAcc.* severity: WARNING + - id: configservice-in-const-name + languages: + - go + message: Do not use "ConfigService" in const name inside configservice package + paths: + include: + - internal/service/configservice + patterns: + - pattern: const $NAME = ... + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)ConfigService" + severity: WARNING diff --git a/.ci/.semgrep-service-name1.yml b/.ci/.semgrep-service-name1.yml index ceffd8273d66..fec6253f23cb 100644 --- a/.ci/.semgrep-service-name1.yml +++ b/.ci/.semgrep-service-name1.yml @@ -1,19 +1,5 @@ # Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT. rules: - - id: configservice-in-const-name - languages: - - go - message: Do not use "ConfigService" in const name inside configservice package - paths: - include: - - internal/service/configservice - patterns: - - pattern: const $NAME = ... - - metavariable-pattern: - metavariable: $NAME - patterns: - - pattern-regex: "(?i)ConfigService" - severity: WARNING - id: configservice-in-var-name languages: - go @@ -4093,3 +4079,18 @@ rules: - focus-metavariable: $NAME - pattern-not: func $NAME($T *testing.T) { ... } severity: WARNING + - id: iot-in-test-name + languages: + - go + message: Include "IoT" in test name + paths: + include: + - internal/service/iot/*_test.go + patterns: + - pattern: func $NAME( ... ) { ... } + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-not-regex: "^TestAccIoT" + - pattern-regex: ^TestAcc.* + severity: WARNING diff --git a/.ci/.semgrep-service-name2.yml b/.ci/.semgrep-service-name2.yml index 84533f2a1a0c..f3e09f52ec1e 100644 --- a/.ci/.semgrep-service-name2.yml +++ b/.ci/.semgrep-service-name2.yml @@ -1,20 +1,5 @@ # Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT. rules: - - id: iot-in-test-name - languages: - - go - message: Include "IoT" in test name - paths: - include: - - internal/service/iot/*_test.go - patterns: - - pattern: func $NAME( ... ) { ... } - - metavariable-pattern: - metavariable: $NAME - patterns: - - pattern-not-regex: "^TestAccIoT" - - pattern-regex: ^TestAcc.* - severity: WARNING - id: iot-in-const-name languages: - go @@ -4080,3 +4065,49 @@ rules: - pattern-not-regex: "^TestAccRDS" - pattern-regex: ^TestAcc.* severity: WARNING + - id: rds-in-const-name + languages: + - go + message: Do not use "RDS" in const name inside rds package + paths: + include: + - internal/service/rds + patterns: + - pattern: const $NAME = ... + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)RDS" + severity: WARNING + - id: rds-in-var-name + languages: + - go + message: Do not use "RDS" in var name inside rds package + paths: + include: + - internal/service/rds + patterns: + - pattern: var $NAME = ... + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)RDS" + severity: WARNING + - id: recyclebin-in-func-name + languages: + - go + message: Do not use "recyclebin" in func name inside rbin package + paths: + include: + - internal/service/rbin + exclude: + - internal/service/rbin/list_pages_gen.go + patterns: + - pattern: func $NAME( ... ) { ... } + - metavariable-pattern: + metavariable: $NAME + patterns: + - pattern-regex: "(?i)recyclebin" + - focus-metavariable: $NAME + - pattern-not: func $NAME($T *testing.T) { ... } + severity: WARNING diff --git a/.ci/.semgrep-service-name3.yml b/.ci/.semgrep-service-name3.yml index 983727991e84..46951e761691 100644 --- a/.ci/.semgrep-service-name3.yml +++ b/.ci/.semgrep-service-name3.yml @@ -1,51 +1,5 @@ # Generated by internal/generate/servicesemgrep/main.go; DO NOT EDIT. rules: - - id: rds-in-const-name - languages: - - go - message: Do not use "RDS" in const name inside rds package - paths: - include: - - internal/service/rds - patterns: - - pattern: const $NAME = ... - - metavariable-pattern: - metavariable: $NAME - patterns: - - pattern-regex: "(?i)RDS" - severity: WARNING - - id: rds-in-var-name - languages: - - go - message: Do not use "RDS" in var name inside rds package - paths: - include: - - internal/service/rds - patterns: - - pattern: var $NAME = ... - - metavariable-pattern: - metavariable: $NAME - patterns: - - pattern-regex: "(?i)RDS" - severity: WARNING - - id: recyclebin-in-func-name - languages: - - go - message: Do not use "recyclebin" in func name inside rbin package - paths: - include: - - internal/service/rbin - exclude: - - internal/service/rbin/list_pages_gen.go - patterns: - - pattern: func $NAME( ... ) { ... } - - metavariable-pattern: - metavariable: $NAME - patterns: - - pattern-regex: "(?i)recyclebin" - - focus-metavariable: $NAME - - pattern-not: func $NAME($T *testing.T) { ... } - severity: WARNING - id: recyclebin-in-const-name languages: - go From a9a0d8137c9e524bbfe2380893dbfe94a953b1bc Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Apr 2024 09:16:46 -0400 Subject: [PATCH 133/137] route53profiles: No endpoints tests. --- .../generate/serviceendpointtests/main.go | 1 + .../service_endpoints_gen_test.go | 496 ------------------ 2 files changed, 1 insertion(+), 496 deletions(-) delete mode 100644 internal/service/route53profiles/service_endpoints_gen_test.go diff --git a/internal/generate/serviceendpointtests/main.go b/internal/generate/serviceendpointtests/main.go index 35c2b1acf5e4..b06048fa8169 100644 --- a/internal/generate/serviceendpointtests/main.go +++ b/internal/generate/serviceendpointtests/main.go @@ -38,6 +38,7 @@ func main() { "mwaa", // Resolver modifies URL "neptunegraph", // EndpointParameters has an additional parameter, ApiType "paymentcryptography", // Resolver modifies URL + "route53profiles", // Resolver modifies URL "s3control", // Resolver modifies URL "timestreamwrite": // Uses endpoint discovery continue diff --git a/internal/service/route53profiles/service_endpoints_gen_test.go b/internal/service/route53profiles/service_endpoints_gen_test.go deleted file mode 100644 index ef471d814e2c..000000000000 --- a/internal/service/route53profiles/service_endpoints_gen_test.go +++ /dev/null @@ -1,496 +0,0 @@ -// Code generated by internal/generate/serviceendpointtests/main.go; DO NOT EDIT. - -package route53profiles_test - -import ( - "context" - "errors" - "fmt" - "maps" - "os" - "path/filepath" - "reflect" - "strings" - "testing" - - aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" - route53profiles_sdkv2 "github.com/aws/aws-sdk-go-v2/service/route53profiles" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "github.com/google/go-cmp/cmp" - "github.com/hashicorp/aws-sdk-go-base/v2/servicemocks" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - terraformsdk "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-provider-aws/internal/conns" - "github.com/hashicorp/terraform-provider-aws/internal/errs" - "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" - "github.com/hashicorp/terraform-provider-aws/internal/provider" -) - -type endpointTestCase struct { - with []setupFunc - expected caseExpectations -} - -type caseSetup struct { - config map[string]any - configFile configFile - environmentVariables map[string]string -} - -type configFile struct { - baseUrl string - serviceUrl string -} - -type caseExpectations struct { - diags diag.Diagnostics - endpoint string -} - -type setupFunc func(setup *caseSetup) - -type callFunc func(ctx context.Context, t *testing.T, meta *conns.AWSClient) string - -const ( - packageNameConfigEndpoint = "https://packagename-config.endpoint.test/" - awsServiceEnvvarEndpoint = "https://service-envvar.endpoint.test/" - baseEnvvarEndpoint = "https://base-envvar.endpoint.test/" - serviceConfigFileEndpoint = "https://service-configfile.endpoint.test/" - baseConfigFileEndpoint = "https://base-configfile.endpoint.test/" -) - -const ( - packageName = "route53profiles" - awsEnvVar = "AWS_ENDPOINT_URL_ROUTE_53_PROFILES" - baseEnvVar = "AWS_ENDPOINT_URL" - configParam = "route_53_profiles" -) - -func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.Setenv - const region = "us-west-2" //lintignore:AWSAT003 - - testcases := map[string]endpointTestCase{ - "no config": { - with: []setupFunc{withNoConfig}, - expected: expectDefaultEndpoint(region), - }, - - // Package name endpoint on Config - - "package name endpoint config": { - with: []setupFunc{ - withPackageNameEndpointInConfig, - }, - expected: expectPackageNameConfigEndpoint(), - }, - - "package name endpoint config overrides aws service envvar": { - with: []setupFunc{ - withPackageNameEndpointInConfig, - withAwsEnvVar, - }, - expected: expectPackageNameConfigEndpoint(), - }, - - "package name endpoint config overrides base envvar": { - with: []setupFunc{ - withPackageNameEndpointInConfig, - withBaseEnvVar, - }, - expected: expectPackageNameConfigEndpoint(), - }, - - "package name endpoint config overrides service config file": { - with: []setupFunc{ - withPackageNameEndpointInConfig, - withServiceEndpointInConfigFile, - }, - expected: expectPackageNameConfigEndpoint(), - }, - - "package name endpoint config overrides base config file": { - with: []setupFunc{ - withPackageNameEndpointInConfig, - withBaseEndpointInConfigFile, - }, - expected: expectPackageNameConfigEndpoint(), - }, - - // Service endpoint in AWS envvar - - "service aws envvar": { - with: []setupFunc{ - withAwsEnvVar, - }, - expected: expectAwsEnvVarEndpoint(), - }, - - "service aws envvar overrides base envvar": { - with: []setupFunc{ - withAwsEnvVar, - withBaseEnvVar, - }, - expected: expectAwsEnvVarEndpoint(), - }, - - "service aws envvar overrides service config file": { - with: []setupFunc{ - withAwsEnvVar, - withServiceEndpointInConfigFile, - }, - expected: expectAwsEnvVarEndpoint(), - }, - - "service aws envvar overrides base config file": { - with: []setupFunc{ - withAwsEnvVar, - withBaseEndpointInConfigFile, - }, - expected: expectAwsEnvVarEndpoint(), - }, - - // Base endpoint in envvar - - "base endpoint envvar": { - with: []setupFunc{ - withBaseEnvVar, - }, - expected: expectBaseEnvVarEndpoint(), - }, - - "base endpoint envvar overrides service config file": { - with: []setupFunc{ - withBaseEnvVar, - withServiceEndpointInConfigFile, - }, - expected: expectBaseEnvVarEndpoint(), - }, - - "base endpoint envvar overrides base config file": { - with: []setupFunc{ - withBaseEnvVar, - withBaseEndpointInConfigFile, - }, - expected: expectBaseEnvVarEndpoint(), - }, - - // Service endpoint in config file - - "service config file": { - with: []setupFunc{ - withServiceEndpointInConfigFile, - }, - expected: expectServiceConfigFileEndpoint(), - }, - - "service config file overrides base config file": { - with: []setupFunc{ - withServiceEndpointInConfigFile, - withBaseEndpointInConfigFile, - }, - expected: expectServiceConfigFileEndpoint(), - }, - - // Base endpoint in config file - - "base endpoint config file": { - with: []setupFunc{ - withBaseEndpointInConfigFile, - }, - expected: expectBaseConfigFileEndpoint(), - }, - } - - for name, testcase := range testcases { //nolint:paralleltest // uses t.Setenv - testcase := testcase - - t.Run(name, func(t *testing.T) { - testEndpointCase(t, region, testcase, callService) - }) - } -} - -func defaultEndpoint(region string) string { - r := route53profiles_sdkv2.NewDefaultEndpointResolverV2() - - ep, err := r.ResolveEndpoint(context.Background(), route53profiles_sdkv2.EndpointParameters{ - Region: aws_sdkv2.String(region), - }) - if err != nil { - return err.Error() - } - - if ep.URI.Path == "" { - ep.URI.Path = "/" - } - - return ep.URI.String() -} - -func callService(ctx context.Context, t *testing.T, meta *conns.AWSClient) string { - t.Helper() - - var endpoint string - - client := meta.Route53ProfilesClient(ctx) - - _, err := client.ListProfiles(ctx, &route53profiles_sdkv2.ListProfilesInput{}, - func(opts *route53profiles_sdkv2.Options) { - opts.APIOptions = append(opts.APIOptions, - addRetrieveEndpointURLMiddleware(t, &endpoint), - addCancelRequestMiddleware(), - ) - }, - ) - if err == nil { - t.Fatal("Expected an error, got none") - } else if !errors.Is(err, errCancelOperation) { - t.Fatalf("Unexpected error: %s", err) - } - - return endpoint -} - -func withNoConfig(_ *caseSetup) { - // no-op -} - -func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ - map[string]any{}, - } - } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) - endpoints[packageName] = packageNameConfigEndpoint -} - -func withAwsEnvVar(setup *caseSetup) { - setup.environmentVariables[awsEnvVar] = awsServiceEnvvarEndpoint -} - -func withBaseEnvVar(setup *caseSetup) { - setup.environmentVariables[baseEnvVar] = baseEnvvarEndpoint -} - -func withServiceEndpointInConfigFile(setup *caseSetup) { - setup.configFile.serviceUrl = serviceConfigFileEndpoint -} - -func withBaseEndpointInConfigFile(setup *caseSetup) { - setup.configFile.baseUrl = baseConfigFileEndpoint -} - -func expectDefaultEndpoint(region string) caseExpectations { - return caseExpectations{ - endpoint: defaultEndpoint(region), - } -} - -func expectPackageNameConfigEndpoint() caseExpectations { - return caseExpectations{ - endpoint: packageNameConfigEndpoint, - } -} - -func expectAwsEnvVarEndpoint() caseExpectations { - return caseExpectations{ - endpoint: awsServiceEnvvarEndpoint, - } -} - -func expectBaseEnvVarEndpoint() caseExpectations { - return caseExpectations{ - endpoint: baseEnvvarEndpoint, - } -} - -func expectServiceConfigFileEndpoint() caseExpectations { - return caseExpectations{ - endpoint: serviceConfigFileEndpoint, - } -} - -func expectBaseConfigFileEndpoint() caseExpectations { - return caseExpectations{ - endpoint: baseConfigFileEndpoint, - } -} - -func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, callF callFunc) { - t.Helper() - - ctx := context.Background() - - setup := caseSetup{ - config: map[string]any{}, - environmentVariables: map[string]string{}, - } - - for _, f := range testcase.with { - f(&setup) - } - - config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - "region": region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, - } - - maps.Copy(config, setup.config) - - if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" - tempDir := t.TempDir() - writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) - } - - for k, v := range setup.environmentVariables { - t.Setenv(k, v) - } - - p, err := provider.New(ctx) - if err != nil { - t.Fatal(err) - } - - expectedDiags := testcase.expected.diags - expectedDiags = append( - expectedDiags, - errs.NewWarningDiagnostic( - "AWS account ID not found for provider", - "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.", - ), - ) - - diags := p.Configure(ctx, terraformsdk.NewResourceConfigRaw(config)) - - if diff := cmp.Diff(diags, expectedDiags, cmp.Comparer(sdkdiag.Comparer)); diff != "" { - t.Errorf("unexpected diagnostics difference: %s", diff) - } - - if diags.HasError() { - return - } - - meta := p.Meta().(*conns.AWSClient) - - endpoint := callF(ctx, t, meta) - - if endpoint != testcase.expected.endpoint { - t.Errorf("expected endpoint %q, got %q", testcase.expected.endpoint, endpoint) - } -} - -func addRetrieveEndpointURLMiddleware(t *testing.T, endpoint *string) func(*middleware.Stack) error { - return func(stack *middleware.Stack) error { - return stack.Finalize.Add( - retrieveEndpointURLMiddleware(t, endpoint), - middleware.After, - ) - } -} - -func retrieveEndpointURLMiddleware(t *testing.T, endpoint *string) middleware.FinalizeMiddleware { - return middleware.FinalizeMiddlewareFunc( - "Test: Retrieve Endpoint", - func(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (middleware.FinalizeOutput, middleware.Metadata, error) { - t.Helper() - - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - t.Fatalf("Expected *github.com/aws/smithy-go/transport/http.Request, got %s", fullTypeName(in.Request)) - } - - url := request.URL - url.RawQuery = "" - url.Path = "/" - - *endpoint = url.String() - - return next.HandleFinalize(ctx, in) - }) -} - -var errCancelOperation = fmt.Errorf("Test: Cancelling request") - -func addCancelRequestMiddleware() func(*middleware.Stack) error { - return func(stack *middleware.Stack) error { - return stack.Finalize.Add( - cancelRequestMiddleware(), - middleware.After, - ) - } -} - -// cancelRequestMiddleware creates a Smithy middleware that intercepts the request before sending and cancels it -func cancelRequestMiddleware() middleware.FinalizeMiddleware { - return middleware.FinalizeMiddlewareFunc( - "Test: Cancel Requests", - func(_ context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (middleware.FinalizeOutput, middleware.Metadata, error) { - return middleware.FinalizeOutput{}, middleware.Metadata{}, errCancelOperation - }) -} - -func fullTypeName(i interface{}) string { - return fullValueTypeName(reflect.ValueOf(i)) -} - -func fullValueTypeName(v reflect.Value) string { - if v.Kind() == reflect.Ptr { - return "*" + fullValueTypeName(reflect.Indirect(v)) - } - - requestType := v.Type() - return fmt.Sprintf("%s.%s", requestType.PkgPath(), requestType.Name()) -} - -func generateSharedConfigFile(config configFile) string { - var buf strings.Builder - - buf.WriteString(` -[default] -aws_access_key_id = DefaultSharedCredentialsAccessKey -aws_secret_access_key = DefaultSharedCredentialsSecretKey -`) - if config.baseUrl != "" { - buf.WriteString(fmt.Sprintf("endpoint_url = %s\n", config.baseUrl)) - } - - if config.serviceUrl != "" { - buf.WriteString(fmt.Sprintf(` -services = endpoint-test - -[services endpoint-test] -%[1]s = - endpoint_url = %[2]s -`, configParam, serviceConfigFileEndpoint)) - } - - return buf.String() -} - -func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, content string) string { - t.Helper() - - file, err := os.Create(filepath.Join(tempDir, "aws-sdk-go-base-shared-configuration-file")) - if err != nil { - t.Fatalf("creating shared configuration file: %s", err) - } - - _, err = file.WriteString(content) - if err != nil { - t.Fatalf(" writing shared configuration file: %s", err) - } - - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} - } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) - } - - return file.Name() -} From 68583344ea95f9a12d25f5bbdafa711d0c4b1e17 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Wed, 24 Apr 2024 13:40:42 +0000 Subject: [PATCH 134/137] Update CHANGELOG.md for #37078 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ace7c48cb804..b2187c0f82e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,13 @@ ENHANCEMENTS: * data-source/aws_eip: Add `arn` attribute ([#35991](https://github.com/hashicorp/terraform-provider-aws/issues/35991)) * resource/aws_api_gateway_rest_api: Correct set `root_resource_id` on resource Read ([#37040](https://github.com/hashicorp/terraform-provider-aws/issues/37040)) +* resource/aws_appmesh_mesh: Add `spec.service_discovery` argument ([#37042](https://github.com/hashicorp/terraform-provider-aws/issues/37042)) * resource/aws_eip: Add `arn` attribute ([#35991](https://github.com/hashicorp/terraform-provider-aws/issues/35991)) * resource/aws_elasticache_replication_group: Add `transit_encryption_mode` argument ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) * resource/aws_elasticache_replication_group: Changes to the `transit_encryption_enabled` argument can now be done in-place for engine versions > `7.0.5` ([#30403](https://github.com/hashicorp/terraform-provider-aws/issues/30403)) * resource/aws_kinesis_firehose_delivery_stream: Add `snowflake_configuration` argument ([#36646](https://github.com/hashicorp/terraform-provider-aws/issues/36646)) +* resource/aws_sagemaker_app_image_config: Add `code_editor_app_image_config` and `jupyter_lab_image_config.jupyter_lab_image_config` arguments ([#37059](https://github.com/hashicorp/terraform-provider-aws/issues/37059)) +* resource/aws_sagemaker_app_image_config: Change `kernel_gateway_image_config.kernel_spec` MaxItems to 5 ([#37059](https://github.com/hashicorp/terraform-provider-aws/issues/37059)) BUG FIXES: From d5ff5fe367d754e6456ca57ff075d65730f3e3dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:54:43 -0400 Subject: [PATCH 135/137] build(deps): bump github.com/aws/aws-sdk-go in /.ci/providerlint (#37075) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.51.26 to 1.51.27. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.26...v1.51.27) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .ci/providerlint/go.mod | 2 +- .ci/providerlint/go.sum | 4 ++-- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 13 +++++++++++++ .ci/providerlint/vendor/modules.txt | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.ci/providerlint/go.mod b/.ci/providerlint/go.mod index ee941e6e8876..cc5db2ea0a6e 100644 --- a/.ci/providerlint/go.mod +++ b/.ci/providerlint/go.mod @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint go 1.22 require ( - github.com/aws/aws-sdk-go v1.51.26 + github.com/aws/aws-sdk-go v1.51.27 github.com/bflad/tfproviderlint v0.29.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 golang.org/x/tools v0.13.0 diff --git a/.ci/providerlint/go.sum b/.ci/providerlint/go.sum index 7da87866d978..5beb8aaa5b92 100644 --- a/.ci/providerlint/go.sum +++ b/.ci/providerlint/go.sum @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/aws/aws-sdk-go v1.51.26 h1:fYud+95lh9B89fAlRtgYpY8CcJF4T7JrWkLMq4GGCOo= -github.com/aws/aws-sdk-go v1.51.26/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.27 h1:ZprksHovT4rFfNBHB+Bc/0p4PTntAnTlZP39DMA/Qp8= +github.com/aws/aws-sdk-go v1.51.27/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow= diff --git a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 2344c96d6f91..f82c4e554504 100644 --- a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -36382,6 +36382,19 @@ var awscnPartition = partition{ }: endpoint{}, }, }, + "entitlement.marketplace": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "cn-northwest-1", + }: endpoint{ + Hostname: "entitlement-marketplace.cn-northwest-1.amazonaws.com.cn", + Protocols: []string{"HTTPS"}, + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "es": service{ Endpoints: serviceEndpoints{ endpointKey{ diff --git a/.ci/providerlint/vendor/modules.txt b/.ci/providerlint/vendor/modules.txt index 15b7bfb9f9dd..70df00b39784 100644 --- a/.ci/providerlint/vendor/modules.txt +++ b/.ci/providerlint/vendor/modules.txt @@ -28,7 +28,7 @@ github.com/agext/levenshtein # github.com/apparentlymart/go-textseg/v15 v15.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v15/textseg -# github.com/aws/aws-sdk-go v1.51.26 +# github.com/aws/aws-sdk-go v1.51.27 ## explicit; go 1.19 github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/endpoints From 0bcbd1782d66464c1ae1ceaa55d23f687eb5e780 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:55:09 -0400 Subject: [PATCH 136/137] build(deps): bump the aws-sdk-go group with 6 updates (#37074) Bumps the aws-sdk-go group with 6 updates: | Package | From | To | | --- | --- | --- | | [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.51.26` | `1.51.27` | | [github.com/aws/aws-sdk-go-v2/service/bedrock](https://github.com/aws/aws-sdk-go-v2) | `1.7.7` | `1.8.0` | | [github.com/aws/aws-sdk-go-v2/service/bedrockagent](https://github.com/aws/aws-sdk-go-v2) | `1.7.0` | `1.8.0` | | [github.com/aws/aws-sdk-go-v2/service/costexplorer](https://github.com/aws/aws-sdk-go-v2) | `1.37.1` | `1.38.0` | | [github.com/aws/aws-sdk-go-v2/service/ec2](https://github.com/aws/aws-sdk-go-v2) | `1.157.0` | `1.158.0` | | [github.com/aws/aws-sdk-go-v2/service/rds](https://github.com/aws/aws-sdk-go-v2) | `1.77.1` | `1.77.2` | Updates `github.com/aws/aws-sdk-go` from 1.51.26 to 1.51.27 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.26...v1.51.27) Updates `github.com/aws/aws-sdk-go-v2/service/bedrock` from 1.7.7 to 1.8.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.8.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/m2/v1.7.7...v1.8.0) Updates `github.com/aws/aws-sdk-go-v2/service/bedrockagent` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.8.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.7.0...v1.8.0) Updates `github.com/aws/aws-sdk-go-v2/service/costexplorer` from 1.37.1 to 1.38.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.38.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.37.1...service/s3/v1.38.0) Updates `github.com/aws/aws-sdk-go-v2/service/ec2` from 1.157.0 to 1.158.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/ec2/v1.157.0...service/ec2/v1.158.0) Updates `github.com/aws/aws-sdk-go-v2/service/rds` from 1.77.1 to 1.77.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/rds/v1.77.1...service/rds/v1.77.2) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/bedrock dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/bedrockagent dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/costexplorer dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/ec2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/rds dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 4dbff4d28814..e1301d43af5c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.2 github.com/YakDriver/go-version v0.1.0 github.com/YakDriver/regexache v0.23.0 - github.com/aws/aws-sdk-go v1.51.26 + github.com/aws/aws-sdk-go v1.51.27 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/config v1.27.11 github.com/aws/aws-sdk-go-v2/credentials v1.17.11 @@ -31,8 +31,8 @@ require ( github.com/aws/aws-sdk-go-v2/service/autoscalingplans v1.20.5 github.com/aws/aws-sdk-go-v2/service/batch v1.37.0 github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 - github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 - github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 + github.com/aws/aws-sdk-go-v2/service/bedrock v1.8.0 + github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.8.0 github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 github.com/aws/aws-sdk-go-v2/service/chimesdkvoice v1.14.4 @@ -63,7 +63,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/connectcases v1.15.4 github.com/aws/aws-sdk-go-v2/service/controltower v1.13.5 github.com/aws/aws-sdk-go-v2/service/costandusagereportservice v1.23.4 - github.com/aws/aws-sdk-go-v2/service/costexplorer v1.37.1 + github.com/aws/aws-sdk-go-v2/service/costexplorer v1.38.0 github.com/aws/aws-sdk-go-v2/service/costoptimizationhub v1.4.4 github.com/aws/aws-sdk-go-v2/service/customerprofiles v1.36.4 github.com/aws/aws-sdk-go-v2/service/datasync v1.36.4 @@ -73,7 +73,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/directoryservice v1.24.4 github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.9.3 github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1 - github.com/aws/aws-sdk-go-v2/service/ec2 v1.157.0 + github.com/aws/aws-sdk-go-v2/service/ec2 v1.158.0 github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4 github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.4 github.com/aws/aws-sdk-go-v2/service/ecs v1.41.7 @@ -129,7 +129,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/qbusiness v1.5.0 github.com/aws/aws-sdk-go-v2/service/qldb v1.21.4 github.com/aws/aws-sdk-go-v2/service/rbin v1.16.4 - github.com/aws/aws-sdk-go-v2/service/rds v1.77.1 + github.com/aws/aws-sdk-go-v2/service/rds v1.77.2 github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.17.5 diff --git a/go.sum b/go.sum index d20dc4a02401..ed11d0fc1128 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.51.26 h1:fYud+95lh9B89fAlRtgYpY8CcJF4T7JrWkLMq4GGCOo= -github.com/aws/aws-sdk-go v1.51.26/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.27 h1:ZprksHovT4rFfNBHB+Bc/0p4PTntAnTlZP39DMA/Qp8= +github.com/aws/aws-sdk-go v1.51.27/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -82,10 +82,10 @@ github.com/aws/aws-sdk-go-v2/service/batch v1.37.0 h1:KsCQLOMecKTAIznlGCz5Lupddk github.com/aws/aws-sdk-go-v2/service/batch v1.37.0/go.mod h1:JuPGVm7DzXD73vZBQsZwlDzoJeZewN08swLBGiU47K8= github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4 h1:WJEEIYSDCqNeG/q0OU99AovoS2lHTwyV+yYoQcwI+i8= github.com/aws/aws-sdk-go-v2/service/bcmdataexports v1.3.4/go.mod h1:QdNvYtC3DYswfkhnlWXa0Oib+8jugRL/a+5Nbhw4v/g= -github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7 h1:3omHt2KuI7K58mb2r3BwKPF0ph0MOXZZ48XIthXhHcI= -github.com/aws/aws-sdk-go-v2/service/bedrock v1.7.7/go.mod h1:/D6V245MG0yEqSULoBf/zLdQk8lmsMZXR3d/vc2mOdo= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0 h1:f2hDre6hySnv5RTcV9zqHdCUp8EmusEIHB81aPFGaAo= -github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.7.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= +github.com/aws/aws-sdk-go-v2/service/bedrock v1.8.0 h1:T3fEqHePREPko9+jRek0cuyyfEjT/OLz3PhT+WW9qdY= +github.com/aws/aws-sdk-go-v2/service/bedrock v1.8.0/go.mod h1:/D6V245MG0yEqSULoBf/zLdQk8lmsMZXR3d/vc2mOdo= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.8.0 h1:CWprual/fBYNa9Mvf8rlNC8MoiCVpN1oUQ6/8sQcHzk= +github.com/aws/aws-sdk-go-v2/service/bedrockagent v1.8.0/go.mod h1:6CwV+GE3wrFqkrU2LB8cajHMWJn7jFFhRtxBQiOZ5kw= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4 h1:sVv+p2Wo+sUXa8dC1pCMJ/+9ncOriq8EiRWvAkOuaLY= github.com/aws/aws-sdk-go-v2/service/budgets v1.22.4/go.mod h1:JFS3MaNoisHXHQm5/xRQjj1tICixIgT8Vv32D0lV5NE= github.com/aws/aws-sdk-go-v2/service/chimesdkmediapipelines v1.15.5 h1:FgeK3aPbB/ARkhxUXfSn9d2ibb4Q9kUhHl/dWwqIy8Y= @@ -146,8 +146,8 @@ github.com/aws/aws-sdk-go-v2/service/controltower v1.13.5 h1:paF2yipmLzmX9ugZqKN github.com/aws/aws-sdk-go-v2/service/controltower v1.13.5/go.mod h1:qwJIgEG0ASp7utTqwiagEW0LOE6AFsNzQL1oOWRsydU= github.com/aws/aws-sdk-go-v2/service/costandusagereportservice v1.23.4 h1:MDEvMVWZZetTacemmH+Z7ScvQkOKxqkEQfFROo//G18= github.com/aws/aws-sdk-go-v2/service/costandusagereportservice v1.23.4/go.mod h1:DSbQUgLN9rHicCWE2Wuu7yRNHT3oQvnOiPk3LAGZe9I= -github.com/aws/aws-sdk-go-v2/service/costexplorer v1.37.1 h1:xjhk+io+kPtDOG5RizvHlkGKET3dxRBzorLdPPkpZQc= -github.com/aws/aws-sdk-go-v2/service/costexplorer v1.37.1/go.mod h1:uLOg0o57AyQQhZGtUKIlcBJOKE53mO9bXKyrM9dFhy4= +github.com/aws/aws-sdk-go-v2/service/costexplorer v1.38.0 h1:0q4pClt2ckd6awhQYEysexryCmA7q2HMI0O5dBrA5B8= +github.com/aws/aws-sdk-go-v2/service/costexplorer v1.38.0/go.mod h1:uLOg0o57AyQQhZGtUKIlcBJOKE53mO9bXKyrM9dFhy4= github.com/aws/aws-sdk-go-v2/service/costoptimizationhub v1.4.4 h1:gSO6kMlH4cXxBmZwTA1qngTVxt8Och7irFtNGrxIUEg= github.com/aws/aws-sdk-go-v2/service/costoptimizationhub v1.4.4/go.mod h1:UkyRWEyu3iT7oPmPri8xwPnKXqJQzSUDK9MOKq7xyZE= github.com/aws/aws-sdk-go-v2/service/customerprofiles v1.36.4 h1:UBo3t3uliQIP3f8duZhmJ1Z62bz/j5o7LH8f/BTt1mU= @@ -166,8 +166,8 @@ github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.9.3 h1:HihsSNvSKUYna0rE7OAc github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.9.3/go.mod h1:AOiF0FGcVHJuV3KEdgesNC1UWhDgfZYpqcY6qppdPo4= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1 h1:dZXY07Dm59TxAjJcUfNMJHLDI/gLMxTRZefn2jFAVsw= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1/go.mod h1:lVLqEtX+ezgtfalyJs7Peb0uv9dEpAQP5yuq2O26R44= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.157.0 h1:BCNvChkZM4xqssztw+rFllaDnoS4Hm6bZ20XBj8RsI0= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.157.0/go.mod h1:xejKuuRDjz6z5OqyeLsz01MlOqqW7CqpAB4PabNvpu8= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.158.0 h1:SfXorXPVy5y5wtXs0BXx6K45xxvM3Hhuc3YKtYoglOM= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.158.0/go.mod h1:xejKuuRDjz6z5OqyeLsz01MlOqqW7CqpAB4PabNvpu8= github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4 h1:Qr9W21mzWT3RhfYn9iAux7CeRIdbnTAqmiOlASqQgZI= github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4/go.mod h1:if7ybzzjOmDB8pat9FE35AHTY6ZxlYSy3YviSmFZv8c= github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.4 h1:aNuiieMaS2IHxqAsTdM/pjHyY1aoaDLBGLqpNnFMMqk= @@ -288,8 +288,8 @@ github.com/aws/aws-sdk-go-v2/service/qldb v1.21.4 h1:h/Jmsgx2BVIBzN3CvEmU37bQ1y4 github.com/aws/aws-sdk-go-v2/service/qldb v1.21.4/go.mod h1:T789CzkMLwKq1b5MxcUfQeoUisJ6jJhciaZTtAQtUOU= github.com/aws/aws-sdk-go-v2/service/rbin v1.16.4 h1:f5RY4vrfqBG5nmgSiEejpFOeWfzkCXd+EpOsRdL4W+I= github.com/aws/aws-sdk-go-v2/service/rbin v1.16.4/go.mod h1:BUtbswz07qEjzGypmeUdtP53noKx1PBKAnX9Fe0Mul4= -github.com/aws/aws-sdk-go-v2/service/rds v1.77.1 h1:RatrfyDgfeXDmYw1gq5IR5tXXf1C9/enPtXWXn5kufE= -github.com/aws/aws-sdk-go-v2/service/rds v1.77.1/go.mod h1:Rw15qGaGWu3jO0dOz7JyvdOEjgae//YrJxVWLYGynvg= +github.com/aws/aws-sdk-go-v2/service/rds v1.77.2 h1:d9GrRZEoi11Aa6az++UC6JsauTN7CscLDuNb/fxcttU= +github.com/aws/aws-sdk-go-v2/service/rds v1.77.2/go.mod h1:Rw15qGaGWu3jO0dOz7JyvdOEjgae//YrJxVWLYGynvg= github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0 h1:j18lTPPqe+qlapn1R8//+ujvXdplku8V41xzBNNLtn0= github.com/aws/aws-sdk-go-v2/service/redshift v1.44.0/go.mod h1:8ldsMsikORLj0GZUozSvbQdctrumAPYhizmj/3AAATI= github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.25.4 h1:Rnz5skILimGue5zJ8txb5Mr9JLjznYJFKgK0r/n3AI0= From 312351d0e6333928333048cbac7535ae7d9f3abc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:10:23 -0400 Subject: [PATCH 137/137] build(deps): bump hashicorp/setup-terraform from 3.0.0 to 3.1.0 (#37076) Bumps [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) from 3.0.0 to 3.1.0. - [Release notes](https://github.com/hashicorp/setup-terraform/releases) - [Changelog](https://github.com/hashicorp/setup-terraform/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/setup-terraform/compare/a1502cd9e758c50496cc9ac5308c4843bcd56d36...97f030cf6dc0b4f5e0da352c7bca9cca34579800) --- updated-dependencies: - dependency-name: hashicorp/setup-terraform dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/examples.yml | 2 +- .github/workflows/provider.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 23ff12ec45aa..6c2b2b866a21 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -87,7 +87,7 @@ jobs: # For newer versions mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/ cp terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 ~/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/ - - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 + - uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 with: terraform_version: ${{ matrix.terraform_version }} # Needed to use the output of `terraform validate -json` diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index a9544928c543..4fc9068ea90b 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -251,7 +251,7 @@ jobs: path: terraform-plugin-dir key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }} - if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure' - uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 + uses: hashicorp/setup-terraform@97f030cf6dc0b4f5e0da352c7bca9cca34579800 with: terraform_version: ${{ env.TERRAFORM_VERSION }} terraform_wrapper: false