Skip to content

Commit

Permalink
Fix resource parser for Terraform 0.12 for_each syntax (adammck#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
atikhono authored and Anna Tikhonova committed Feb 5, 2020
1 parent 41cd001 commit d7596e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func init() {
// - type.[module_]name (no `count` attribute; contains module name if we're not in the root module)
// - type.[module_]name.0 (if resource has `count` attribute)
// - "data." prefix should not parse and be ignored by caller (does not represent a host)
nameParser = regexp.MustCompile(`^([\w\-]+)\.([\w\-]+)(?:\.(\d+))?$`)
nameParser = regexp.MustCompile(`^([\w\-]+)\.([\w\-]+)(?:\.(\d+|[\S+]+))?$`)
}

type Resource struct {
Expand Down Expand Up @@ -77,7 +77,7 @@ func NewResource(keyName string, state resourceState) (*Resource, error) {
// isn't the case.
c, err = strconv.Atoi(m[3])
if err != nil {
return nil, err
m[2] = fmt.Sprintf("%s.%s", m[2], m[3])
}
}

Expand Down

0 comments on commit d7596e9

Please sign in to comment.