Skip to content

Commit 65742ce

Browse files
committed
d/aws_ec2_transit_gateway: fix crash setting encryption_support
1 parent fe97ba9 commit 65742ce

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.changelog/45462.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
```release-note:bug
22
resource/aws_ec2_transit_gateway: Fix potential crash when setting `encryption_support`. This addresses a regression introduced in [v6.25.0](https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#6250-december-4-2025).
33
```
4+
5+
```release-note:bug
6+
data-source/aws_ec2_transit_gateway: Fix potential crash when reading `encryption_support`. This addresses a regression introduced in [v6.25.0](https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#6250-december-4-2025).
7+
```

internal/service/ec2/transitgateway_data_source.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,18 @@ func dataSourceTransitGatewayRead(ctx context.Context, d *schema.ResourceData, m
137137
d.Set("default_route_table_propagation", transitGateway.Options.DefaultRouteTablePropagation)
138138
d.Set(names.AttrDescription, transitGateway.Description)
139139
d.Set("dns_support", transitGateway.Options.DnsSupport)
140-
var encryptionSupport string
141-
encryptionState := transitGateway.Options.EncryptionSupport.EncryptionState
142-
if encryptionState == awstypes.EncryptionStateValueEnabled || encryptionState == awstypes.EncryptionStateValueEnabling {
143-
encryptionSupport = string(awstypes.EncryptionSupportOptionValueEnable)
144-
} else {
145-
encryptionSupport = string(awstypes.EncryptionSupportOptionValueDisable)
140+
141+
if transitGateway.Options.EncryptionSupport != nil {
142+
var encryptionSupport string
143+
encryptionState := transitGateway.Options.EncryptionSupport.EncryptionState
144+
if encryptionState == awstypes.EncryptionStateValueEnabled || encryptionState == awstypes.EncryptionStateValueEnabling {
145+
encryptionSupport = string(awstypes.EncryptionSupportOptionValueEnable)
146+
} else {
147+
encryptionSupport = string(awstypes.EncryptionSupportOptionValueDisable)
148+
}
149+
d.Set("encryption_support", encryptionSupport)
146150
}
147-
d.Set("encryption_support", encryptionSupport)
151+
148152
d.Set("multicast_support", transitGateway.Options.MulticastSupport)
149153
d.Set(names.AttrOwnerID, transitGateway.OwnerId)
150154
d.Set("propagation_default_route_table_id", transitGateway.Options.PropagationDefaultRouteTableId)

0 commit comments

Comments
 (0)