Skip to content

Commit e997ba3

Browse files
authored
Merge pull request #27306 from ddericco/f-transit_gateway_modify_asn
Add support for modifying Transit Gateway ASN
2 parents 164a205 + db7ba2c commit e997ba3

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.changelog/27306.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_ec2_transit_gateway: Add support to modify `amazon_side_asn` argument
3+
```

internal/service/ec2/transitgateway_.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ func ResourceTransitGateway() *schema.Resource {
5353
"amazon_side_asn": {
5454
Type: schema.TypeInt,
5555
Optional: true,
56-
ForceNew: true,
5756
Default: 64512,
5857
},
5958
"arn": {
@@ -233,6 +232,10 @@ func resourceTransitGatewayUpdate(d *schema.ResourceData, meta interface{}) erro
233232
TransitGatewayId: aws.String(d.Id()),
234233
}
235234

235+
if d.HasChange("amazon_side_asn") {
236+
input.Options.AmazonSideAsn = aws.Int64(int64(d.Get("amazon_side_asn").(int)))
237+
}
238+
236239
if d.HasChange("auto_accept_shared_attachments") {
237240
input.Options.AutoAcceptSharedAttachments = aws.String(d.Get("auto_accept_shared_attachments").(string))
238241
}

internal/service/ec2/transitgateway_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func testAccTransitGateway_AmazonSideASN(t *testing.T) {
241241
Config: testAccTransitGatewayConfig_amazonSideASN(rName, 64514),
242242
Check: resource.ComposeTestCheckFunc(
243243
testAccCheckTransitGatewayExists(resourceName, &transitGateway2),
244-
testAccCheckTransitGatewayRecreated(&transitGateway1, &transitGateway2),
244+
testAccCheckTransitGatewayNotRecreated(&transitGateway1, &transitGateway2),
245245
resource.TestCheckResourceAttr(resourceName, "amazon_side_asn", "64514"),
246246
),
247247
},

website/docs/r/ec2_transit_gateway.html.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ resource "aws_ec2_transit_gateway" "example" {
2323
The following arguments are supported:
2424

2525
* `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`.
26+
27+
-> **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`.
28+
2629
* `auto_accept_shared_attachments` - (Optional) Whether resource attachment requests are automatically accepted. Valid values: `disable`, `enable`. Default value: `disable`.
2730
* `default_route_table_association` - (Optional) Whether resource attachments are automatically associated with the default association route table. Valid values: `disable`, `enable`. Default value: `enable`.
2831
* `default_route_table_propagation` - (Optional) Whether resource attachments automatically propagate routes to the default propagation route table. Valid values: `disable`, `enable`. Default value: `enable`.

0 commit comments

Comments
 (0)