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

Add support for modifying Transit Gateway ASN #27306

Merged
merged 4 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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/27306.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_ec2_transit_gateway: Add support to modify `amazon_side_asn` argument
```
7 changes: 6 additions & 1 deletion internal/service/ec2/transitgateway_.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func ResourceTransitGateway() *schema.Resource {
"amazon_side_asn": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Default: 64512,
},
"arn": {
Expand Down Expand Up @@ -233,6 +232,12 @@ func resourceTransitGatewayUpdate(d *schema.ResourceData, meta interface{}) erro
TransitGatewayId: aws.String(d.Id()),
}

if d.HasChange("amazon_side_asn") {
input.Options.AmazonSideAsn = aws.Int64(int64(d.Get("amazon_side_asn").(int)))
}

//aws.Int64(int64(v.(int)))

if d.HasChange("auto_accept_shared_attachments") {
input.Options.AutoAcceptSharedAttachments = aws.String(d.Get("auto_accept_shared_attachments").(string))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/ec2/transitgateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func testAccTransitGateway_AmazonSideASN(t *testing.T) {
Config: testAccTransitGatewayConfig_amazonSideASN(rName, 64514),
Check: resource.ComposeTestCheckFunc(
testAccCheckTransitGatewayExists(resourceName, &transitGateway2),
testAccCheckTransitGatewayRecreated(&transitGateway1, &transitGateway2),
testAccCheckTransitGatewayNotRecreated(&transitGateway1, &transitGateway2),
resource.TestCheckResourceAttr(resourceName, "amazon_side_asn", "64514"),
),
},
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/ec2_transit_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ resource "aws_ec2_transit_gateway" "example" {
The following arguments are supported:

* `amazon_side_asn` - (Optional) Private Autonomous System Number (ASN) for the Amazon side of a BGP session. The range is `64512` to `65534` for 16-bit ASNs and `4200000000` to `4294967294` for 32-bit ASNs. Default value: `64512`.

-> **NOTE:** Modifying `amazon_side_asn` on a Transit Gateway with active BGP sessions is [not allowed](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyTransitGatewayOptions.html). You must first delete all Transit Gateway attachments that have BGP configured prior to modifying `amazon_side_asn`.

* `auto_accept_shared_attachments` - (Optional) Whether resource attachment requests are automatically accepted. Valid values: `disable`, `enable`. Default value: `disable`.
* `default_route_table_association` - (Optional) Whether resource attachments are automatically associated with the default association route table. Valid values: `disable`, `enable`. Default value: `enable`.
* `default_route_table_propagation` - (Optional) Whether resource attachments automatically propagate routes to the default propagation route table. Valid values: `disable`, `enable`. Default value: `enable`.
Expand Down