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

allowed_pattern could not be 0 symbols hence omitted #18552

Closed
T0tt1 opened this issue Apr 2, 2021 · 7 comments · Fixed by #18588
Closed

allowed_pattern could not be 0 symbols hence omitted #18552

T0tt1 opened this issue Apr 2, 2021 · 7 comments · Fixed by #18588
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/ssm Issues and PRs that pertain to the ssm service.
Milestone

Comments

@T0tt1
Copy link

T0tt1 commented Apr 2, 2021

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

Affected Resource(s)

  • aws_ssm_parameter

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
resource "aws_ssm_parameter" "default" {
  count           = var.enabled == "true" ? length(var.parameter_write) : 0
  name            = lookup(var.parameter_write[count.index], "name")
  description     = lookup(var.parameter_write[count.index], "description", lookup(var.parameter_write[count.index], "name"))
  type            = lookup(var.parameter_write[count.index], "type", "SecureString")
  key_id          = lookup(var.parameter_write[count.index], "type", "SecureString") == "SecureString" && length(var.kms_arn) > 0 ? var.kms_arn : ""
  value           = lookup(var.parameter_write[count.index], "value")
  overwrite       = lookup(var.parameter_write[count.index], "overwrite", "false")
  allowed_pattern = lookup(var.parameter_write[count.index], "allowed_pattern", "")
  tags            = var.tags
}

Debug Output

https://gist.github.com/T0tt1/e74a2b8f56e1dadeee74803904b6d475

Panic Output

Expected Behavior

allowed_pattern is optional attribute hence should be able to skip setting the attribute

Actual Behavior

Terraform expects length of the allowed_pattern attribute to be ` symbol at minimum

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@ghost ghost added the service/ssm Issues and PRs that pertain to the ssm service. label Apr 2, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 2, 2021
@ewbankkit
Copy link
Contributor

Related:

#17819
#17830

@ewbankkit
Copy link
Contributor

@T0tt1 Thanks for raising this issue.
Is this a new or existing Terraform configuration? The additional validation of the allowed_pattern attribute was added in v3.35.0 of the Terraform AWS Provider and we would like to know whether this is a regression or not.

@T0tt1
Copy link
Author

T0tt1 commented Apr 2, 2021

This is an existing configuration and it just happened to update the version of provider to the latest one yesterday and start throwing these errors while trying to deploy. I haven't tested if I create a new configuration from scratch if will fail in the same way during the terraform apply - just fyi.

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 2, 2021
@ewbankkit
Copy link
Contributor

@ewbankkit
Copy link
Contributor

@T0tt1 As a workaround you could try allowed_pattern = lookup(var.parameter_write[count.index], "allowed_pattern", null).

@ewbankkit ewbankkit added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 4, 2021
@anGie44 anGie44 added this to the v3.36.0 milestone Apr 6, 2021
@anGie44 anGie44 self-assigned this Apr 6, 2021
@ghost
Copy link

ghost commented Apr 9, 2021

This has been released in version 3.36.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 for triage. Thanks!

@ghost
Copy link

ghost commented May 6, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2021
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/ssm Issues and PRs that pertain to the ssm service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants