-
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
Implement State Upgrader to Set Defaults for Attributes Assigned Null During Import #313
Conversation
…te following import with earlier versions of the provider. For instance, using v3.3.1 to import a random password resource will result in the state file containing null values for length, lower, number, special, upper, min_lower, min_numeric, min_special, min_upper attributes.
…ld be present in state following import with earlier versions of the provider. For instance, using v3.3.1 to import a random password resource will result in the state file containing null values for length, lower, number, special, upper, min_lower, min_numeric, min_special, min_upper attributes.
…de_special and keepers in state to null.
…d with state upgrader changes handling fix of bcrypt
…tting defaults for lower, number, numeric, special, upper, min_lower, min_numeric, min_special, min_upper and setting length when these attributes have been set to null
I've marked this as ready for review as the code changes should be complete. Checks will fail until |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚀
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes: #302
In the discussion contained in Upgrade v2.2.1 -> v3.4.0 forces replacement there were several comments indicating that a forced replacement was happening under some circumstances:
The attributes in question usually have a default value of
0
assigned (i.e.,min_lower
,min_upper
,min_numeric
andmin_special
) ortrue
assigned (i.e.,lower
,upper
,number
,numeric
andspecial
) when no value for them is specified in the configuration.However, under some circumstances, the attributes described can end up with a value of
null
assigned to them in the state which results in a forced update when terraform apply is run.One of the circumstances that can give rise to the storage of null values for these attributes is using terraform import with a version of the provider that is
v3.3.1
or earlier. Under these circumstances, all of the attributes mentioned, along withlength
are assigned a value ofnull
in state.This PR aims to address this issue by implementing a state upgrader which interrogates each of the aforementioned attributes and assigns it a default value if the value currently held for the attribute in state is
null
.