-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
AWS - Tag support for Elasticsearch #4973
Conversation
This now has testing for tags. I need to run some additional runtime tests but its closer. |
Runtime testing on my template was successful, including just incremental tag update. This is ready for review. |
@@ -37,13 +37,9 @@ func resourceAwsElasticSearchDomain() *schema.Resource { | |||
ForceNew: true, | |||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { | |||
value := v.(string) | |||
if !regexp.MustCompile(`^[0-9A-Za-z]+`).MatchString(value) { | |||
if !regexp.MustCompile(`^[a-z][0-9a-z\-]{2,27}$`).MatchString(value) { |
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.
@paultyng why has this ValidateFunc changed?
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.
Those are the actual rules for es domain names, I had it failing in the API call locally instead of in validation if I didn't meet those. Let me dig up the docs, one sec.
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.
Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen).
The text from the actual console is:
The name must start with a lowercase alphabet and be at least 3 and no more than 28 characters long. Valid characters are a-z (lowercase letters), 0-9, and - (hyphen).
And when I try to start with a number it doesn't work.
Feel free to cherry pick around this, or I can rip it out, I just hit this bug as well.
@paultyng this looks good - as soon as I can understand why the ValidateFunc changed :) The tests look good as well
|
Added inline responses above. Basically bringing the client side validation in sync with the actual rules to fail faster on issues there. |
👍 for merging the fix for validation, but we should note this as a second CHANGELOG entry with the same PR number to avoid confusion. |
AWS - Tag support for Elasticsearch
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Since #3619 seems to have stalled, taking another stab at this. I'm very new to Go so I'm sure this isn't that idiomatic, but I've tried to copy the patterns for tags from other resources.
The weird thing with Elasticsearch's API is that it doesn't allow passing tags in a create, its always a separate call.
I still need to write the tests for the tags on the resource (I have tests written for the tagging methods though).