Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Data Source - aws_ec2_client_vpn_endpoint #14218

Merged
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3a7cb3a
Add data for Client Vpn Endpoint
angelabad Jul 16, 2020
af74787
Add tests for Client Vpn Endpoint data
angelabad Jul 16, 2020
ced4d00
Add documentation for Client Vpn Endpoint data
angelabad Jul 16, 2020
7ef0d4c
Upgrade terraform plugin SDK version 2
angelabad Aug 23, 2020
3eeb361
Use only Terraform 0.12 syntax
angelabad Aug 23, 2020
b8e77c3
Fix typo on website documentation
angelabad Aug 23, 2020
a922b8b
r/aws_ec2_client_vpn_network_association: Alphabetize attributes.
ewbankkit Jan 31, 2022
8985b36
r/aws_ec2_client_vpn_network_association: Start to tidy up resource C…
ewbankkit Jan 31, 2022
08977e7
r/aws_ec2_client_vpn_network_association: Tidy up sweeper.
ewbankkit Jan 31, 2022
41faa2c
r/aws_ec2_client_vpn_network_association: Start to tidy up resource D…
ewbankkit Jan 31, 2022
cca297d
Merge branch 'main' into tmp-pr20689
ewbankkit Jan 31, 2022
4786bb4
Revert "Fix typo on website documentation"
ewbankkit Feb 1, 2022
30cceeb
Revert "Use only Terraform 0.12 syntax"
ewbankkit Feb 1, 2022
fb4c447
Revert "Upgrade terraform plugin SDK version 2"
ewbankkit Feb 1, 2022
60881c3
Revert "Add documentation for Client Vpn Endpoint data"
ewbankkit Feb 1, 2022
72df2ce
Revert "Add tests for Client Vpn Endpoint data"
ewbankkit Feb 1, 2022
39362d3
Revert "Add data for Client Vpn Endpoint"
ewbankkit Feb 1, 2022
f9a13d6
Merge branch 'tmp-pr20689' into HEAD
ewbankkit Feb 1, 2022
3c498fa
d/aws_ec2_client_vpn_endpoint: New data source.
ewbankkit Feb 1, 2022
76a00ff
d/aws_ec2_client_vpn_endpoint: All attributes.
ewbankkit Feb 1, 2022
dcb11ed
'FindClientVPNAuthorizationRuleByEndpointIDTargetNetworkCIDRAndGroupI…
ewbankkit Feb 1, 2022
b353413
r/aws_ec2_client_vpn_authorization_rule: Tidy up acceptance test conf…
ewbankkit Feb 1, 2022
871c5e0
r/aws_ec2_client_vpn_network_association: Tidy up resource Read.
ewbankkit Feb 1, 2022
5a5f4f5
r/aws_ec2_client_vpn_network_association: Configurable Create and Del…
ewbankkit Feb 1, 2022
b6e2054
Fix golangci-lint unparam error.
ewbankkit Feb 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/14218.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-data-source
aws_ec2_client_vpn_endpoint
```
3 changes: 3 additions & 0 deletions .changelog/20689.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_ec2_client_vpn_network_association: Configurable Create and Delete timeouts
```
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ func Provider() *schema.Provider {
"aws_ebs_snapshot_ids": ec2.DataSourceEBSSnapshotIDs(),
"aws_ebs_volume": ec2.DataSourceEBSVolume(),
"aws_ebs_volumes": ec2.DataSourceEBSVolumes(),
"aws_ec2_client_vpn_endpoint": ec2.DataSourceClientVPNEndpoint(),
"aws_ec2_coip_pool": ec2.DataSourceCoIPPool(),
"aws_ec2_coip_pools": ec2.DataSourceCoIPPools(),
"aws_ec2_host": ec2.DataSourceHost(),
Expand Down
2 changes: 1 addition & 1 deletion internal/service/ec2/client_vpn_authorization_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func resourceClientVPNAuthorizationRuleRead(d *schema.ResourceData, meta interfa
return err
}

rule, err := FindClientVPNAuthorizationRuleByEndpointIDTargetNetworkCIDRAndGroupID(conn, endpointID, targetNetworkCIDR, accessGroupID)
rule, err := FindClientVPNAuthorizationRuleByThreePartKey(conn, endpointID, targetNetworkCIDR, accessGroupID)

if !d.IsNewResource() && tfresource.NotFound(err) {
log.Printf("[WARN] EC2 Client VPN Authorization Rule (%s) not found, removing from state", d.Id())
Expand Down
94 changes: 11 additions & 83 deletions internal/service/ec2/client_vpn_authorization_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func testAccCheckClientVPNAuthorizationRuleDestroy(s *terraform.State) error {
return err
}

_, err = tfec2.FindClientVPNAuthorizationRuleByEndpointIDTargetNetworkCIDRAndGroupID(conn, endpointID, targetNetworkCIDR, accessGroupID)
_, err = tfec2.FindClientVPNAuthorizationRuleByThreePartKey(conn, endpointID, targetNetworkCIDR, accessGroupID)

if tfresource.NotFound(err) {
continue
Expand Down Expand Up @@ -270,7 +270,7 @@ func testAccCheckClientVPNAuthorizationRuleExists(name string, v *ec2.Authorizat

conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Conn

output, err := tfec2.FindClientVPNAuthorizationRuleByEndpointIDTargetNetworkCIDRAndGroupID(conn, endpointID, targetNetworkCIDR, accessGroupID)
output, err := tfec2.FindClientVPNAuthorizationRuleByThreePartKey(conn, endpointID, targetNetworkCIDR, accessGroupID)

if err != nil {
return err
Expand All @@ -282,8 +282,11 @@ func testAccCheckClientVPNAuthorizationRuleExists(name string, v *ec2.Authorizat
}
}

func testAccEc2ClientVpnAuthorizationRuleVpcBase(rName string, subnetCount int) string {
return acctest.ConfigCompose(acctest.ConfigAvailableAZsNoOptInDefaultExclude(), fmt.Sprintf(`
func testAccEc2ClientVpnAuthorizationRuleBaseConfig(rName string, subnetCount int) string {
return acctest.ConfigCompose(
testAccEc2ClientVpnEndpointConfig(rName),
acctest.ConfigAvailableAZsNoOptInDefaultExclude(),
fmt.Sprintf(`
resource "aws_vpc" "test" {
cidr_block = "10.1.0.0/16"

Expand All @@ -306,47 +309,14 @@ resource "aws_subnet" "test" {
`, rName, subnetCount))
}

func testAccEc2ClientVpnAuthorizationRuleAcmCertificateBase() string {
key := acctest.TLSRSAPrivateKeyPEM(2048)
certificate := acctest.TLSRSAX509SelfSignedCertificatePEM(key, "example.com")

return fmt.Sprintf(`
resource "aws_acm_certificate" "test" {
certificate_body = "%[1]s"
private_key = "%[2]s"
}
`, acctest.TLSPEMEscapeNewlines(certificate), acctest.TLSPEMEscapeNewlines(key))
}

func testAccEc2ClientVpnAuthorizationRuleConfigBasic(rName string) string {
return acctest.ConfigCompose(
testAccEc2ClientVpnAuthorizationRuleVpcBase(rName, 1),
testAccEc2ClientVpnAuthorizationRuleAcmCertificateBase(),
fmt.Sprintf(`
return acctest.ConfigCompose(testAccEc2ClientVpnAuthorizationRuleBaseConfig(rName, 1), `
resource "aws_ec2_client_vpn_authorization_rule" "test" {
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.test.id
target_network_cidr = aws_subnet.test[0].cidr_block
authorize_all_groups = true
}

resource "aws_ec2_client_vpn_endpoint" "test" {
server_certificate_arn = aws_acm_certificate.test.arn
client_cidr_block = "10.0.0.0/16"

authentication_options {
type = "certificate-authentication"
root_certificate_chain_arn = aws_acm_certificate.test.arn
}

connection_log_options {
enabled = false
}

tags = {
Name = %[1]q
}
}
`, rName))
`)
}

func testAccEc2ClientVpnAuthorizationRuleConfigGroups(rName string, groupNames map[string]string) string {
Expand All @@ -361,28 +331,7 @@ resource "aws_ec2_client_vpn_authorization_rule" %[1]q {
`, k, v)
}

return acctest.ConfigCompose(
testAccEc2ClientVpnAuthorizationRuleVpcBase(rName, 1),
testAccEc2ClientVpnAuthorizationRuleAcmCertificateBase(),
b.String(),
fmt.Sprintf(`
resource "aws_ec2_client_vpn_endpoint" "test" {
server_certificate_arn = aws_acm_certificate.test.arn
client_cidr_block = "10.0.0.0/16"

authentication_options {
type = "certificate-authentication"
root_certificate_chain_arn = aws_acm_certificate.test.arn
}

connection_log_options {
enabled = false
}

tags = {
Name = %[1]q
}
}`, rName))
return acctest.ConfigCompose(testAccEc2ClientVpnAuthorizationRuleBaseConfig(rName, 1), b.String())
}

func testAccEc2ClientVpnAuthorizationRuleConfigSubnets(rName string, subnetCount int, groupNames map[string]int) string {
Expand All @@ -397,26 +346,5 @@ resource "aws_ec2_client_vpn_authorization_rule" %[1]q {
`, k, v)
}

return acctest.ConfigCompose(
testAccEc2ClientVpnAuthorizationRuleVpcBase(rName, subnetCount),
testAccEc2ClientVpnAuthorizationRuleAcmCertificateBase(),
b.String(),
fmt.Sprintf(`
resource "aws_ec2_client_vpn_endpoint" "test" {
server_certificate_arn = aws_acm_certificate.test.arn
client_cidr_block = "10.0.0.0/16"

authentication_options {
type = "certificate-authentication"
root_certificate_chain_arn = aws_acm_certificate.test.arn
}

connection_log_options {
enabled = false
}

tags = {
Name = %[1]q
}
}`, rName))
return acctest.ConfigCompose(testAccEc2ClientVpnAuthorizationRuleBaseConfig(rName, subnetCount), b.String())
}
Loading