-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
fix: remove client-vpn endpoints from state when they are missing #10187
fix: remove client-vpn endpoints from state when they are missing #10187
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, @GabrielCastro 🚀 We can test this code via:
func TestAccAwsEc2ClientVpnEndpoint_disappears(t *testing.T) {
rStr := acctest.RandString(5)
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersWithTLS,
CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy,
Steps: []resource.TestStep{
{
Config: testAccEc2ClientVpnEndpointConfig(rStr),
Check: resource.ComposeTestCheckFunc(
testAccCheckAwsEc2ClientVpnEndpointExists("aws_ec2_client_vpn_endpoint.test"),
testAccCheckAwsEc2ClientVpnEndpointDisappears("aws_ec2_client_vpn_endpoint.test"),
),
ExpectNonEmptyPlan: true,
},
},
})
}
func testAccCheckAwsEc2ClientVpnEndpointDisappears(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
return fmt.Errorf("Not found: %s", name)
}
conn := testAccProvider.Meta().(*AWSClient).ec2conn
input := &ec2.DeleteClientVpnEndpointInput{
ClientVpnEndpointId: aws.String(rs.Primary.ID),
}
_, err := conn.DeleteClientVpnEndpoint(input)
return err
}
}
Previously before code update:
--- FAIL: TestAccAwsEc2ClientVpnEndpoint_disappears (14.36s)
testing.go:569: Step 0 error: errors during follow-up refresh:
Error: Error reading Client VPN endpoint: InvalidClientVpnEndpointId.NotFound: Endpoint cvpn-endpoint-0f615b0f07cfbe2ba does not exist
Output from acceptance testing:
--- PASS: TestAccAwsEc2ClientVpnEndpoint_disappears (16.12s)
…out-of-band resource removal handling Reference: #10187 Previously before code update: ``` --- FAIL: TestAccAwsEc2ClientVpnEndpoint_disappears (14.36s) testing.go:569: Step 0 error: errors during follow-up refresh: Error: Error reading Client VPN endpoint: InvalidClientVpnEndpointId.NotFound: Endpoint cvpn-endpoint-0f615b0f07cfbe2ba does not exist ``` Output from acceptance testing: ``` --- PASS: TestAccAwsEc2ClientVpnEndpoint_disappears (16.12s) ```
This has been released in version 2.30.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Release note for CHANGELOG:
Output from acceptance testing: