Skip to content

Commit

Permalink
Merge pull request #27306 from ddericco/f-transit_gateway_modify_asn
Browse files Browse the repository at this point in the history
Add support for modifying Transit Gateway ASN
  • Loading branch information
johnsonaj authored Oct 21, 2022
2 parents 164a205 + db7ba2c commit e997ba3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
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
```
5 changes: 4 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,10 @@ 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)))
}

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

0 comments on commit e997ba3

Please sign in to comment.