terraform: upgrade resource name regexp failure to error
We're well past Terraform 0.4, so it's time to finally make good on the original promise. :) Fixes #5243
This commit is contained in:
parent
8677c1dab0
commit
5a9dad82d6
|
@ -576,10 +576,10 @@ func TestContext2Validate_resourceNameSymbol(t *testing.T) {
|
|||
})
|
||||
|
||||
w, e := c.Validate()
|
||||
if len(w) == 0 {
|
||||
if len(w) > 0 {
|
||||
t.Fatalf("bad: %#v", w)
|
||||
}
|
||||
if len(e) > 0 {
|
||||
if len(e) == 0 {
|
||||
t.Fatalf("bad: %s", e)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,10 +119,9 @@ func (n *EvalValidateResource) Eval(ctx EvalContext) (interface{}, error) {
|
|||
// If the resouce name doesn't match the name regular
|
||||
// expression, show a warning.
|
||||
if !config.NameRegexp.Match([]byte(n.ResourceName)) {
|
||||
warns = append(warns, fmt.Sprintf(
|
||||
errs = append(errs, fmt.Errorf(
|
||||
"%s: resource name can only contain letters, numbers, "+
|
||||
"dashes, and underscores.\n"+
|
||||
"This will be an error in Terraform 0.4",
|
||||
"dashes, and underscores."+
|
||||
n.ResourceName))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue