You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using aws_db_instance within a module that has variable inputs such as availability_zone, username, and others that have a default value of "", results in a new resource being forced on the omitted option.
Previously, supplying a default variable value of "" would cause terraform to omit the option in the resource if it is not passed into the module.
Terraform Version
0.11
Provider Version
v1.3.0 and above
Affected Resource(s)
aws_db_instance when used in a module with optional defaults using variables and blank defaults
On aws provider v1.2.0, this would work perfectly fine with an existing rds server provisioned using the module shown above with the optional variable inputs omitted and their respective defaults of "". It does not work on versions above this in our testing.
Actual Behavior
Terraform wants to force new resource on the aws_db_instance due to optional inputs into the module being omitted. It would seem that the previously working defaults in variables.tf posted above are no longer working and a default value of "" is no longer sufficient and is causing a diff.
Steps to Reproduce
terraform plan -target module.some_rds.rds_instance
Terraform will perform the following actions:
-/+ module.some_rds.aws_db_instance.rds_instance (new resource required)
id: "some_rds" => <computed> (forces new resource)
...........
availability_zone: "us-west-2a" => <computed> (forces new resource)
...........
name: "some_name" => <computed> (forces new resource)
...........
username: "some_user" => <computed> (forces new resource)
..........
Plan: 1 to add, 0 to change, 1 to destroy.
This seems like the same thing as #2468, though when I replied there it wasn't clear that this was a regression in AWS provider v1.3.0. Indeed with that extra fact in play I think both of these issues are the same as #2348, caused by a change to the provider framework that was adopted for the AWS provider in v1.3.0.
With that said, I'm going to close this consolidate the discussion into #2348. I'll add some additional notes there to capture a summary of what you reported here. Thanks for reporting this!
Summary:
Using aws_db_instance within a module that has variable inputs such as availability_zone, username, and others that have a default value of "", results in a new resource being forced on the omitted option.
Previously, supplying a default variable value of "" would cause terraform to omit the option in the resource if it is not passed into the module.
Terraform Version
0.11
Provider Version
v1.3.0 and above
Affected Resource(s)
aws_db_instance when used in a module with optional defaults using variables and blank defaults
Terraform Configuration Files
Module main.tf:
Module variables.tf:
Module invocation somewhere else:
Expected Behavior
On aws provider v1.2.0, this would work perfectly fine with an existing rds server provisioned using the module shown above with the optional variable inputs omitted and their respective defaults of "". It does not work on versions above this in our testing.
Actual Behavior
Terraform wants to force new resource on the aws_db_instance due to optional inputs into the module being omitted. It would seem that the previously working defaults in variables.tf posted above are no longer working and a default value of "" is no longer sufficient and is causing a diff.
Steps to Reproduce
terraform plan -target module.some_rds.rds_instance
References
I believe this to be the same issue as reported here:
hashicorp/terraform#16724
The text was updated successfully, but these errors were encountered: