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

VPC flow log churn using Terraform 0.13 #15073

Closed
acdha opened this issue Sep 8, 2020 · 8 comments · Fixed by #22043 or #22776
Closed

VPC flow log churn using Terraform 0.13 #15073

acdha opened this issue Sep 8, 2020 · 8 comments · Fixed by #22043 or #22776
Assignees
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@acdha
Copy link
Contributor

acdha commented Sep 8, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.2
+ provider registry.terraform.io/-/aws v3.5.0
+ provider registry.terraform.io/hashicorp/aws v3.5.0
+ provider registry.terraform.io/hashicorp/http v1.2.0

Affected Resource(s)

  • aws_flow_log
  • aws_cloudwatch_log_group

Terraform Configuration Files

data "aws_cloudwatch_log_group" "VPCFlowLogs" {
  name = "/Security/VPCFlowLogs"
}

data "aws_iam_role" "VPCFlowLogger" {
  name = "VPCFlowLogger"
}

resource "aws_flow_log" "vpc_flow_logs" {
  vpc_id          = module.vpc.vpc_id
  traffic_type    = "ALL"
  log_destination = data.aws_cloudwatch_log_group.VPCFlowLogs.arn
  iam_role_arn    = data.aws_iam_role.VPCFlowLogger.arn
}

Expected Behavior

  1. Terraform would update the flog log once and not attempt to recreate it on every run

Actual Behavior

 ~ log_destination          = "arn:aws:logs:us-east-1:…:log-group:/Security/VPCFlowLogs" -> "arn:aws:logs:us-east-1:…:log-group:/Security/VPCFlowLogs:*" # forces replacement

Steps to Reproduce

  1. terraform apply

Important Factoids

This is new in Terraform 0.13 and did not happen with 0.12.29 and the AWS provider 3.20

References

I was not expecting to see this with #14214 having shipped in 3.0.0

@ghost ghost added service/cloudwatchlogs service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/ec2 Issues and PRs that pertain to the ec2 service. service/iam Issues and PRs that pertain to the iam service. labels Sep 8, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 8, 2020
@anGie44 anGie44 added service/ec2 Issues and PRs that pertain to the ec2 service. and removed needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. service/iam Issues and PRs that pertain to the iam service. labels Sep 15, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 15, 2020

Hi @acdha, thank you for creating this issue. I believe the diff occurs b/c #14214 removed the trailing suffix in the cloudwatch_log_group resource, but not in the data-source and behind the scenes, the aws_flow_log resource automatically trims the configured log_destination value's :* suffix as seen here. In the meantime I would recommend using a replace method like described here #14214 (comment) to handle the perpetual diff.

@acdha
Copy link
Contributor Author

acdha commented Sep 16, 2020

That is exactly what I did and it’s working well

@anGie44
Copy link
Contributor

anGie44 commented Sep 16, 2020

just a follow-up question @acdha: did the workaround not behave as expected in Terraform 0.13 vs. 0.12?

@anGie44 anGie44 added this to the v4.0.0 milestone Sep 16, 2020
@anGie44 anGie44 added enhancement Requests to existing resources that expand the functionality or scope. breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. labels Sep 16, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 16, 2020

Note to future self (and others): to have the aws_cloudwatch_log_group data source behave on-par with the resource's ARN handling, this would need to be handled in the next major release as it introduces a breaking-change.

@acdha
Copy link
Contributor Author

acdha commented Sep 16, 2020

It's definitely not hard to work around so I wonder whether this could be perhaps addressed by simply updating the documentation (it seems like more trouble than it'd be worth to add something like an accessor which trims it).

@anGie44
Copy link
Contributor

anGie44 commented Sep 18, 2020

Sure thing @acdha! If you or someone who comes across this issue wants to submit a PR with the documentation update we'll be happy to review it 😄

I'm going to leave this issue open in the meantime as it can still be addressed in the data-source code but further down the line in the next major release 👍

@github-actions
Copy link

This functionality has been released in v4.0.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. Thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
2 participants