Skip to content

Commit

Permalink
r/aws_vpn_connection: Additional tunnel option attribute validations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jan 25, 2022
1 parent 83fb94b commit 63f7a36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
4 changes: 2 additions & 2 deletions internal/service/ec2/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const (
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_512 = "SHA2-512"
)

func VVpnTunnelOptionsPhase1IntegrityAlgorithm_Values() []string {
func VpnTunnelOptionsPhase1IntegrityAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA1,
VpnTunnelOptionsPhase1IntegrityAlgorithmSHA2_256,
Expand Down Expand Up @@ -139,7 +139,7 @@ const (
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_512 = "SHA2-512"
)

func VVpnTunnelOptionsPhase2IntegrityAlgorithm_Values() []string {
func VpnTunnelOptionsPhase2IntegrityAlgorithm_Values() []string {
return []string{
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA1,
VpnTunnelOptionsPhase2IntegrityAlgorithmSHA2_256,
Expand Down
50 changes: 40 additions & 10 deletions internal/service/ec2/vpn_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel1_ike_versions": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsIKEVersion_Values(), false),
},
},
"tunnel1_inside_cidr": {
Type: schema.TypeString,
Expand All @@ -188,12 +191,18 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel1_phase1_encryption_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase1EncryptionAlgorithm_Values(), false),
},
},
"tunnel1_phase1_integrity_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase1IntegrityAlgorithm_Values(), false),
},
},
"tunnel1_phase1_lifetime_seconds": {
Type: schema.TypeInt,
Expand All @@ -214,12 +223,18 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel1_phase2_encryption_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase2EncryptionAlgorithm_Values(), false),
},
},
"tunnel1_phase2_integrity_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase2IntegrityAlgorithm_Values(), false),
},
},
"tunnel1_phase2_lifetime_seconds": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -328,7 +343,10 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel2_ike_versions": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsIKEVersion_Values(), false),
},
},
"tunnel2_inside_cidr": {
Type: schema.TypeString,
Expand All @@ -353,12 +371,18 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel2_phase1_encryption_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase1EncryptionAlgorithm_Values(), false),
},
},
"tunnel2_phase1_integrity_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase1IntegrityAlgorithm_Values(), false),
},
},
"tunnel2_phase1_lifetime_seconds": {
Type: schema.TypeInt,
Expand All @@ -379,12 +403,18 @@ func ResourceVPNConnection() *schema.Resource {
"tunnel2_phase2_encryption_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase2EncryptionAlgorithm_Values(), false),
},
},
"tunnel2_phase2_integrity_algorithms": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice(VpnTunnelOptionsPhase2IntegrityAlgorithm_Values(), false),
},
},
"tunnel2_phase2_lifetime_seconds": {
Type: schema.TypeInt,
Expand Down

0 comments on commit 63f7a36

Please sign in to comment.