Skip to content

Commit

Permalink
resource/aws_ec2_client_vpn_endpoint: Properly set status value into …
Browse files Browse the repository at this point in the history
…Terraform state

Reference: #9954

Previously:

```
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ec2_client_vpn_endpoint.go:226:18: R004: ResourceData.Set() incompatible value type: *github.com/aws/aws-sdk-go/service/ec2.ClientVpnEndpointStatus
```

Output from acceptance testing:

```
--- PASS: TestAccAwsEc2ClientVpnEndpoint_basic (21.32s)
```
  • Loading branch information
bflad committed Jan 6, 2020
1 parent 7683414 commit 2888ed0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aws/resource_aws_ec2_client_vpn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ func resourceAwsEc2ClientVpnEndpointRead(d *schema.ResourceData, meta interface{
d.Set("server_certificate_arn", result.ClientVpnEndpoints[0].ServerCertificateArn)
d.Set("transport_protocol", result.ClientVpnEndpoints[0].TransportProtocol)
d.Set("dns_name", result.ClientVpnEndpoints[0].DnsName)
d.Set("status", result.ClientVpnEndpoints[0].Status)

if result.ClientVpnEndpoints[0].Status != nil {
d.Set("status", result.ClientVpnEndpoints[0].Status.Code)
}

d.Set("split_tunnel", result.ClientVpnEndpoints[0].SplitTunnel)

err = d.Set("authentication_options", flattenAuthOptsConfig(result.ClientVpnEndpoints[0].AuthenticationOptions))
Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_ec2_client_vpn_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func TestAccAwsEc2ClientVpnEndpoint_basic(t *testing.T) {
testAccCheckAwsEc2ClientVpnEndpointExists("aws_ec2_client_vpn_endpoint.test"),
resource.TestCheckResourceAttr("aws_ec2_client_vpn_endpoint.test", "authentication_options.#", "1"),
resource.TestCheckResourceAttr("aws_ec2_client_vpn_endpoint.test", "authentication_options.0.type", "certificate-authentication"),
resource.TestCheckResourceAttr("aws_ec2_client_vpn_endpoint.test", "status", ec2.ClientVpnEndpointStatusCodePendingAssociate),
),
},

Expand Down

0 comments on commit 2888ed0

Please sign in to comment.