Skip to content

Commit

Permalink
Merge pull request #22891 from hashicorp/b-aws_ec2_client_vpn_endpoin…
Browse files Browse the repository at this point in the history
…t-connection_log_options-Computed

r/aws_ec2_client_vpn_endpoint: `connection_log_options.cloudwatch_log_stream` is Computed
  • Loading branch information
ewbankkit authored Feb 2, 2022
2 parents 5521f14 + beeb53e commit 72e9426
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/22891.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_ec2_client_vpn_endpoint: `connection_log_options.cloudwatch_log_stream` argument is Computed, preventing spurious resource diffs
```
1 change: 1 addition & 0 deletions internal/service/ec2/client_vpn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func ResourceClientVPNEndpoint() *schema.Resource {
"cloudwatch_log_stream": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"enabled": {
Type: schema.TypeBool,
Expand Down
15 changes: 13 additions & 2 deletions internal/service/ec2/client_vpn_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,16 @@ func testAccClientVPNEndpoint_withConnectionLogOptions(t *testing.T) {
Providers: acctest.Providers,
CheckDestroy: testAccCheckClientVPNEndpointDestroy,
Steps: []resource.TestStep{
{
Config: testAccEc2ClientVpnEndpointConfigWithConnectionLogOptions(rName, 0),
Check: resource.ComposeTestCheckFunc(
testAccCheckClientVPNEndpointExists(resourceName, &v),
resource.TestCheckResourceAttr(resourceName, "connection_log_options.#", "1"),
resource.TestCheckResourceAttrPair(resourceName, "connection_log_options.0.cloudwatch_log_group", logGroupResourceName, "name"),
resource.TestCheckResourceAttrSet(resourceName, "connection_log_options.0.cloudwatch_log_stream"),
resource.TestCheckResourceAttr(resourceName, "connection_log_options.0.enabled", "true"),
),
},
{
Config: testAccEc2ClientVpnEndpointConfigWithConnectionLogOptions(rName, 1),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -856,7 +866,8 @@ resource "aws_cloudwatch_log_stream" "test2" {
}
locals {
index = %[2]d
log_stream_index = %[2]d
log_stream = local.log_stream_index == 0 ? null : (local.log_stream_index == 1 ? aws_cloudwatch_log_stream.test1.name : aws_cloudwatch_log_stream.test2.name)
}
resource "aws_ec2_client_vpn_endpoint" "test" {
Expand All @@ -871,7 +882,7 @@ resource "aws_ec2_client_vpn_endpoint" "test" {
connection_log_options {
enabled = true
cloudwatch_log_group = aws_cloudwatch_log_group.test.name
cloudwatch_log_stream = local.index == 1 ? aws_cloudwatch_log_stream.test1.name : aws_cloudwatch_log_stream.test2.name
cloudwatch_log_stream = local.log_stream
}
tags = {
Expand Down

0 comments on commit 72e9426

Please sign in to comment.