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

fix: Defaults the role_name coalesce to * to workaround import error #121

Merged

Conversation

mike-carey
Copy link
Contributor

Description

Defaults the role_name to * within the coalesce to workaround #83. By setting a dummy value as the default option, terraform can successfully import without erroring out because the variables are empty and null. If one still forgot to set both values, an error will be thrown when attempting to create any of the IAM resources with the * value.

Error: invalid value for name (must match [\w+=,.@-])

  on .terraform/modules/application.lambda/iam.tf line 71, in resource "aws_iam_policy" "logs":
  71:   name   = "${local.role_name}-logs"

Motivation and Context

We still use terraform 0.12 and would like to upgrade to at least v1.29.0 at least up to v1.39.0. See #83 for details involving the current issue.

Breaking Changes

No breaking changes. If anyone is using v1.39.0, it is locked to terraform 0.13 anyways and it seems this bug is specific to 0.12. However, I wanted to put this out there in anticipation of potentially reverting the minimum version to 0.12.

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

When using the versions of the module anywhere from v1.29.0 to v1.38.0, I attempted to import resources only to result in the error specified in #83. When changing the terraform file directly, (editing .terraform/modules/lambda/iam.tf), the import then works. Commenting out the function name and role name being passed in results in the validate error above.

@mike-carey mike-carey changed the title Defaults the role_name coalesce to * to workaround #83 feat: Defaults the role_name coalesce to * to workaround #83 Mar 3, 2021
@mike-carey mike-carey changed the title feat: Defaults the role_name coalesce to * to workaround #83 fix: Defaults the role_name coalesce to * to workaround #83 Mar 3, 2021
@antonbabenko
Copy link
Member

Thanks for the PR!

The minimum version of Terraform is reverted to 0.12.26 in #117 and available in v1.40.0 of this module, so this PR is relevant for the master branch I believe.

@antonbabenko antonbabenko changed the title fix: Defaults the role_name coalesce to * to workaround #83 fix: Defaults the role_name coalesce to * to workaround import error Mar 3, 2021
@antonbabenko antonbabenko merged commit 5400c8f into terraform-aws-modules:master Mar 3, 2021
@antonbabenko
Copy link
Member

v1.43.0 has been just released.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request 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 related to this change, 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 Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants