Skip to content

Commit 74bea64

Browse files
authored
Merge pull request #38196 from nikhil-goenka/f/aws_globalaccelerator_cross_account_attachment
aws_globalaccelerator_cross_account_attachment
2 parents f14f51c + f9f79bf commit 74bea64

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changelog/38196.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_globalaccelerator_cross_account_attachment: Add `cidr_block` argument to `resource` configuration block
3+
```

internal/service/globalaccelerator/cross_account_attachment.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func (r *crossAccountAttachmentResource) Schema(ctx context.Context, request res
8585
names.AttrRegion: schema.StringAttribute{
8686
Optional: true,
8787
},
88+
names.AttrCIDRBlock: schema.StringAttribute{
89+
Optional: true,
90+
},
8891
},
8992
},
9093
},
@@ -213,17 +216,19 @@ func (r *crossAccountAttachmentResource) Update(ctx context.Context, request res
213216
}
214217

215218
add, remove, _ := flex.DiffSlices(oldResources, newResources, func(v1, v2 *resourceModel) bool {
216-
return v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region)
219+
return v1.Cidr.Equal(v2.Cidr) && v1.EndpointID.Equal(v2.EndpointID) && v1.Region.Equal(v2.Region)
217220
})
218221

219222
input.AddResources = tfslices.ApplyToAll(add, func(v *resourceModel) awstypes.Resource {
220223
return awstypes.Resource{
224+
Cidr: fwflex.StringFromFramework(ctx, v.Cidr),
221225
EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID),
222226
Region: fwflex.StringFromFramework(ctx, v.Region),
223227
}
224228
})
225229
input.RemoveResources = tfslices.ApplyToAll(remove, func(v *resourceModel) awstypes.Resource {
226230
return awstypes.Resource{
231+
Cidr: fwflex.StringFromFramework(ctx, v.Cidr),
227232
EndpointId: fwflex.StringFromFramework(ctx, v.EndpointID),
228233
Region: fwflex.StringFromFramework(ctx, v.Region),
229234
}
@@ -322,6 +327,7 @@ func (m *crossAccountAttachmentResourceModel) setID() {
322327
}
323328

324329
type resourceModel struct {
330+
Cidr types.String `tfsdk:"cidr_block"`
325331
EndpointID types.String `tfsdk:"endpoint_id"`
326332
Region types.String `tfsdk:"region"`
327333
}

website/docs/r/globalaccelerator_cross_account_attachment.html.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following arguments are optional:
4444

4545
* `principals` - (Optional) List of AWS account IDs that are allowed to associate resources with the accelerator.
4646
* `resource` - (Optional) List of resources to be associated with the accelerator.
47+
* `cidr_block` - (Optional) IP address range, in CIDR format, that is specified as resource.
4748
* `endpoint_id` - (Optional) The endpoint ID for the endpoint that is specified as a AWS resource.
4849
* `region` - (Optional) The AWS Region where a shared endpoint resource is located.
4950
* `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.

0 commit comments

Comments
 (0)