Skip to content

Commit

Permalink
Add default values to aws_vpn_connection (#17031)
Browse files Browse the repository at this point in the history
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
  • Loading branch information
shoekstra authored and anGie44 committed Jan 28, 2022
1 parent 2ec6522 commit f6fdba9
Show file tree
Hide file tree
Showing 4 changed files with 458 additions and 147 deletions.
3 changes: 3 additions & 0 deletions .changelog/17031.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_vpn_connection: Add the ability to revert changes to unconfigured tunnel options made outside of Terraform to their (documented default values)[(https://docs.aws.amazon.com/vpn/latest/s2svpn/VPNTunnels.html)]
```
102 changes: 102 additions & 0 deletions internal/service/ec2/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,108 @@ const (
CustomerGatewayStatePending = "pending"
)

const (
VpnTunnelOptionsDPDTimeoutActionClear = "clear"
VpnTunnelOptionsDPDTimeoutActionNone = "none"
VpnTunnelOptionsDPDTimeoutActionRestart = "restart"
)

func VpnTunnelOptionsDPDTimeoutAction_Values() []string {
return []string{
VpnTunnelOptionsDPDTimeoutActionClear,
VpnTunnelOptionsDPDTimeoutActionNone,
VpnTunnelOptionsDPDTimeoutActionRestart,
}
}

const (
VpnTunnelOptionsIKEVersion1 = "ikev1"
VpnTunnelOptionsIKEVersion2 = "ikev2"
)

func VpnTunnelOptionsIKEVersion_Values() []string {
return []string{
VpnTunnelOptionsIKEVersion1,
VpnTunnelOptionsIKEVersion2,
}
}

const (
VpnTunnelOptionsPhase1EncryptionAlgorithmAES128 = "AES128"
VpnTunnelOptionsPhase1EncryptionAlgorithmAES256 = "AES256"
VpnTunnelOptionsPhase1EncryptionAlgorithmAES128_GCM_16 = "AES128-GCM-16"
VpnTunnelOptionsPhase1EncryptionAlgorithmAES256_GCM_16 = "AES256-GCM-16"
)

func VpnTunnelOptionsPhase1EncryptionAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase1EncryptionAlgorithmAES128,
VpnTunnelOptionsPhase1EncryptionAlgorithmAES256,
VpnTunnelOptionsPhase1EncryptionAlgorithmAES128_GCM_16,
VpnTunnelOptionsPhase1EncryptionAlgorithmAES256_GCM_16,
}
}

const (
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA1 = "SHA1"
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_256 = "SHA2-256"
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_384 = "SHA2-384"
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_512 = "SHA2-512"
)

func VpnTunnelOptionsPhase1IntegrityAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA1,
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_256,
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_384,
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_512,
}
}

const (
VpnTunnelOptionsPhase2EncryptionAlgorithmAES128 = "AES128"
VpnTunnelOptionsPhase2EncryptionAlgorithmAES256 = "AES256"
VpnTunnelOptionsPhase2EncryptionAlgorithmAES128_GCM_16 = "AES128-GCM-16"
VpnTunnelOptionsPhase2EncryptionAlgorithmAES256_GCM_16 = "AES256-GCM-16"
)

func VpnTunnelOptionsPhase2EncryptionAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase2EncryptionAlgorithmAES128,
VpnTunnelOptionsPhase2EncryptionAlgorithmAES256,
VpnTunnelOptionsPhase2EncryptionAlgorithmAES128_GCM_16,
VpnTunnelOptionsPhase2EncryptionAlgorithmAES256_GCM_16,
}
}

const (
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA1 = "SHA1"
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_256 = "SHA2-256"
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_384 = "SHA2-384"
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_512 = "SHA2-512"
)

func VpnTunnelOptionsPhase2IntegrityAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA1,
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_256,
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_384,
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_512,
}
}

const (
VpnTunnelOptionsStartupActionAdd = "add"
VpnTunnelOptionsStartupActionStart = "start"
)

func VpnTunnelOptionsStartupAction_Values() []string {
return []string{
VpnTunnelOptionsStartupActionAdd,
VpnTunnelOptionsStartupActionStart,
}
}

const (
VpnConnectionTypeIpsec1 = "ipsec.1"
)
Expand Down
Loading

0 comments on commit f6fdba9

Please sign in to comment.