Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

aws_globalaccelerator_cross_account_attachment #38196

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/38196.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_globalaccelerator_cross_account_attachment: Add `cidr_block` argument to `resource` configuration block
```
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func (r *crossAccountAttachmentResource) Schema(ctx context.Context, request res
names.AttrRegion: schema.StringAttribute{
Optional: true,
},
names.AttrCIDRBlock: schema.StringAttribute{
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -213,17 +216,19 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res
}

add, remove, _ := flex.DiffSlices(oldResources, newResources, func(v1, v2 *resourceModel) bool {
return v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region)
return v1.Cidr.Equal(v2.Cidr) && v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region)
})

input.AddResources = tfslices.ApplyToAll(add, func(v *resourceModel) awstypes.Resource {
return awstypes.Resource{
Cidr: fwflex.StringFromFramework(ctx, v.Cidr),
EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID),
Region: fwflex.StringFromFramework(ctx, v.Region),
}
})
input.RemoveResources = tfslices.ApplyToAll(remove, func(v *resourceModel) awstypes.Resource {
return awstypes.Resource{
Cidr: fwflex.StringFromFramework(ctx, v.Cidr),
EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID),
Region: fwflex.StringFromFramework(ctx, v.Region),
}
Expand Down Expand Up @@ -322,6 +327,7 @@ func (m *crossAccountAttachmentResourceModel) setID() {
}

type resourceModel struct {
Cidr types.String `tfsdk:"cidr_block"`
EndpointID types.String `tfsdk:"endpoint_id"`
Region types.String `tfsdk:"region"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The following arguments are optional:

* `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator.
* `resource` - (Optional) List of resources to be associated with the accelerator.
* `cidr_block` - (Optional) IP address range, in CIDR format, that is specified as resource.
* `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.
Expand Down
Loading