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

Remove data source validation of CloudWatch groups #28

Merged
merged 7 commits into from
May 21, 2023

Conversation

bendrucker
Copy link
Contributor

What

  • Removes the use of data "aws_cloudwatch_log_group" to assert the existence of provided CloudWatch groups

Why

  • It prevents callers from passing in a group name directly from aws_cloudwatch_log_group, in cases where the log group is being created
  • Since the name attribute is generally known via configuration (statically defined), the data source attempts to read the group at plan time, but it may not exist yet.

References

  • This was added in Use data source to verify log groups in plan #21. Any "plan time validation" via data sources must rely on computed attributes that cannot be known until the resource exists, i.e. a randomly generated ID. In this case, Terraform will defer the data source read until apply time because of the unknown attribute.

@bendrucker bendrucker requested review from a team as code owners February 17, 2022 18:35
@jamengual
Copy link
Contributor

/test all

@jamengual
Copy link
Contributor

@nitrocode FYI

@korenyoni
Copy link
Member

IMO this LGTM but I don't want to reverse @nitrocode's #21 PR without having him weigh in. Going to add a needs-discussion label.

@korenyoni
Copy link
Member

/test all

@nitrocode
Copy link
Member

/test all

@bendrucker
Copy link
Contributor Author

Hi, checking in on how you want to resolve this. I understand the desire for #21 but ultimately the current behavior represents a bug.

@aknysh
Copy link
Member

aknysh commented Jun 16, 2022

@nitrocode the PR reverses #21
please chime in

@nitrocode
Copy link
Member

/test all

@nitrocode nitrocode added the patch A minor, backward compatible change label Jun 17, 2022
nitrocode
nitrocode previously approved these changes Jun 17, 2022
@nitrocode
Copy link
Member

Hm the tests are failing on this

Error: External Program Execution Failed
  on .terraform/modules/datadog_lambda_log_forwarder.forwarder_log_artifact/main.tf line 9, in data "external" "git":
        	            	   9:   program = ["git", "-C", var.module_path, "log", "-n", "1", "--pretty=format:{\"ref\": \"%H\"}"]
        	            	The data source received an unexpected error while attempting to execute the
        	            	program.
        	            	Program: /usr/bin/git
        	            	Error Message: fatal: unsafe repository ('/__w/actions/actions' is owned by
        	            	someone else)
        	            	To add an exception for this directory, call:
        	            		git config --global --add safe.directory /__w/actions/actions

@nitrocode nitrocode dismissed their stale review June 17, 2022 04:50

tests failed

@bendrucker
Copy link
Contributor Author

Have to imagine some change in the Actions environment is breaking https://github.com/cloudposse/terraform-external-module-artifact 🤷🏻

@nitrocode
Copy link
Member

Yes I agree. It does seem like the testing environment has issues.

In git 2.3.6 the safe.directory feature was added so we're probably using the latest version and need to update our tests for it.

cc: @Nuru is there a way to set the global setting for git that it's recommending ?

git config --global --add safe.directory /__w/actions/actions

or would it be better to set this specifically in cloudposse/terraform-external-module-artifact then cut a new release there and bump the module version here ?

or is there a better method to solve this ?

@nitrocode nitrocode enabled auto-merge (squash) May 21, 2023 12:11
@nitrocode nitrocode merged commit 2785cea into cloudposse:main May 21, 2023
@nitrocode
Copy link
Member

Thanks Ben for the contribution. Apologies for this one slipping through the cracks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch A minor, backward compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants