-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 Zero Values From Attribute Validations #13943
Comments
Another downside of the additional validation for an empty string is that the error message for a failed validation can be confusing, for example:
|
…ddress validation Reference: #13943 Output from acceptance testing: ``` --- PASS: TestAccAWSEFSMountTarget_disappears (148.46s) --- PASS: TestAccAWSEFSMountTarget_IpAddress_EmptyString (149.17s) --- PASS: TestAccAWSEFSMountTarget_IpAddress (149.93s) --- PASS: TestAccAWSEFSMountTarget_basic (262.20s) ```
…ddress validation (#13958) Reference: #13943 Output from acceptance testing: ``` --- PASS: TestAccAWSEFSMountTarget_disappears (148.46s) --- PASS: TestAccAWSEFSMountTarget_IpAddress_EmptyString (149.17s) --- PASS: TestAccAWSEFSMountTarget_IpAddress (149.93s) --- PASS: TestAccAWSEFSMountTarget_basic (262.20s) ```
One major function this affects is |
One (minor) benefit of removing the zero value ( |
This functionality has been released in v4.0.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. Thank you! |
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. |
Community Note
Description
Prior to Terraform 0.12, the Terraform configuration language did not have the concept of
null
, where the attribute and its value could be seen as completely unconfigured to the provider. As a workaround in these older versions of Terraform, the provider occasionally accepted the zero-values for attribute types (e.g.""
forschema.TypeString
,0
forschema.TypeInt
) from the configuration in the associated schema validation (ValidateFunc
) and ignored passing these values through to the underlying API calls (e.g. usingd.GetOk()
ord.Get()
and conditionalizing based on zero value). For example:In terms of the schema implementation, this required the validation to accept either the zero value or an actual valid value. In this example:
Other than the slight extra implementation required, this does have an additional downsides:
ConflictsWith
validation since it represents a breaking change (norExactlyOneOf
orRequiredWhen
if it was appropriate).Given that Terraform AWS Provider 3.0.0 and later will only support Terraform 0.12, we should consider fixing and enhancing these validations in a major version release to no longer support the workarounds required in Terraform 0.11 and earlier.
In the above case as the final breaking change:
Affected Resource(s)
TBD
References
List to be fully filled in the future:
The text was updated successfully, but these errors were encountered: