diff --git a/resource.go b/resource.go index 2908fee..b29b5e2 100644 --- a/resource.go +++ b/resource.go @@ -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 { @@ -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]) } }