-
Notifications
You must be signed in to change notification settings - Fork 118
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
Panic on random_string
when all properties set to false
#549
Comments
…pper, lower, numeric/number are set to false (#549) Previously, a panic would be generated if the following configuration was used: ``` resource "random_string" "random" { length = 16 special = false upper = false lower = false numeric = false } ``` ``` ╷ │ Error: Plugin did not respond │ │ with random_string.random, │ on resource.tf line 1, in resource "random_string" "random": │ 1: resource "random_string" "random" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵ Stack trace from the terraform-provider-random plugin: panic: crypto/rand: argument to Int is <= 0 ``` This change will cause validation to fail if special, upper, lower, and numeric/number are all set to false Output from acceptance testing: ```console TF_ACC=1 go test -count=1 -run='TestAccResourceString_NumericFalse' -timeout=10m -v ./internal/provider === RUN TestAccResourceString_NumericFalse === PAUSE TestAccResourceString_NumericFalse === CONT TestAccResourceString_NumericFalse --- PASS: TestAccResourceString_NumericFalse (0.15s) ```
Hi @guineveresaenger 👋 Thank you for reporting this bug. I'm interested to hear the more about the use-case for assigning |
hi @bendbennett! thank you for the quick fix, I'm going to close mine in favor of yours.
Honestly, we were running edge case tests and this came up - this did not reflect a real-world error, which, while not impossible, would be unusual to have happen, since defaults are set to |
… set is empty (#551) * resource/random_password+random_string: Prevent panic when special, upper, lower, numeric/number are set to false (#549) Previously, a panic would be generated if the following configuration was used: ``` resource "random_string" "random" { length = 16 special = false upper = false lower = false numeric = false } ``` ``` ╷ │ Error: Plugin did not respond │ │ with random_string.random, │ on resource.tf line 1, in resource "random_string" "random": │ 1: resource "random_string" "random" { │ │ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵ Stack trace from the terraform-provider-random plugin: panic: crypto/rand: argument to Int is <= 0 ``` This change will cause validation to fail if special, upper, lower, and numeric/number are all set to false Output from acceptance testing: ```console TF_ACC=1 go test -count=1 -run='TestAccResourceString_NumericFalse' -timeout=10m -v ./internal/provider === RUN TestAccResourceString_NumericFalse === PAUSE TestAccResourceString_NumericFalse === CONT TestAccResourceString_NumericFalse --- PASS: TestAccResourceString_NumericFalse (0.15s) ``` * Adding changelog entries and copyright header (#549) * Linting * Updating description for number and numeric attributes on resource_password and resource_string
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. |
Terraform CLI and Provider Versions
Terraform v1.5.7
on darwin_arm64
Terraform Configuration
Expected Behavior
I should see an error telling me my configuration is nonsensical.
Actual Behavior
I got a panic.
Steps to Reproduce
terraform apply
How much impact is this issue causing?
Low
Logs
https://gist.github.com/guineveresaenger/79f6457a8ad86c182c9e46c589edb8bd
Additional Information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: