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

Documentation for special flag unclear #323

Open
1 task done
emichellecarter opened this issue Sep 16, 2022 · 2 comments
Open
1 task done

Documentation for special flag unclear #323

emichellecarter opened this issue Sep 16, 2022 · 2 comments
Labels

Comments

@emichellecarter
Copy link

Terraform CLI and Provider Versions

3.4.3

Terraform Configuration

resource "random_password" "password" {
  length           = 16
  special          = false
  min_lower        = 2
  min_numeric      = 2
  min_special      = 2
  min_upper        = 2
  numeric          = true
  upper            = true
  lower            = true
}

Expected Behavior

The special attribute should override or throw an error when set to false and the min_special attribute is set to a non null value.
or
The documentation should be clear that the special attribute is overridden by the min_special attribute.

Actual Behavior

This results in a password with 2 special characters even though special is set to false.

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

Low

Logs

No response

Additional Information

I was able to write around this issue by using checks within the module but felt this was worth reporting as it is confusing.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bflad
Copy link
Contributor

bflad commented Sep 19, 2022

Hi @mcarter106 👋 Thank you for raising this, very understandable that this behavior is likely confusing right now. The resource's preference should likely be to respect the special = false configuration over anything specified by min_special.

As a followup to fixing that particular behavior, it may make sense for the resource to raise a validation warning if min_special is declared at the same time as special = false, to ensure maintainers of the resource configuration understand what is valid, however that would potentially make modular configurations a little harder to not show the potential validation warning:

resource "random_pet" "example" {
  # ...
  special     = var.make_special ? true : false
  min_special = var.make_special ? 2 : null
}

@emichellecarter
Copy link
Author

emichellecarter commented Sep 20, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants