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

Add migration and new schema version for resource_string #29

Merged
merged 1 commit into from
May 22, 2018

Conversation

phekmat
Copy link
Contributor

@phekmat phekmat commented May 22, 2018

This should resolve the issues with forcing a new resource described in the comments of #22

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this follow-up fix, @phekmat!

This looks good to me. I have one bit of feedback inline, just to handle this cautiously for anyone who is already using this feature in v1.3.0.

is.Attributes["min_numeric"] = "0"
is.Attributes["min_upper"] = "0"
is.Attributes["min_lower"] = "0"
is.Attributes["min_special"] = "0"
Copy link
Contributor

@apparentlymart apparentlymart May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we've now shipped a version where these did exist in schema version 0, I think for safety we need to handle these conditionally so that we don't inadvertently cause further problems for people who have already applied changes with the v1.3.0 release.

I think it should be sufficient to just apply this change conditionally only if the attribute is not already set:

	if v := is.Attributes["min_special"]; v == "" {
		is.Attributes["min_special"] = "0"
	}

This would ensure that we don't overwrite any nonzero values that might have been inserted by users already trying to use the new feature with v1.3.0, which would then cause another forced replacement for those users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Done

@phekmat phekmat force-pushed the feature/min_characters branch from 83cbcb7 to 287d49a Compare May 22, 2018 18:28
Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks!

@mildwonkey mildwonkey merged commit d346e24 into hashicorp:master May 22, 2018
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants