craigmonson / colonize

A terraform tool to manage environment driven templating.
MIT License
20 stars 5 forks source link

environment regex match #52

Closed jchrisfarris closed 7 years ago

jchrisfarris commented 7 years ago

With a colonize segment like this:

.
├── env
│   ├── non-prod-dr.tfvars
│   ├── non-prod.tfvars
│   ├── prod-dr.tfvars
│   └── prod.tfvars
├── main.tf
├── main.tf.non-prod
└── main.tf.non-prod-dr

the command colonize -e non-prod prep will source both the main.tf.non-prod and main.tf.non-prod-dr file

colonize version Colonize v0.1.0-alpha

jchrisfarris commented 7 years ago

Looks like the issue is here. You'll want a $ after the c.Environment. I'd fix, but I need to get a go environment setup and lack the cycles at the moment.

func findEnvSpecificTfFilesToCombine(c config.Config) []string { combineable := []string{} fileList, := ioutil.ReadDir(c.OriginPath) // add environment specific files for , fPath := range fileList { if m, _ := regexp.MatchString(`..tf.`+c.Environment, fPath.Name()); m { combineable = append(combineable, util.PathJoin(c.OriginPath, fPath.Name())) } }

craigmonson commented 7 years ago

Should be fixed now. See: https://github.com/craigmonson/colonize/commit/d2ff8a5afa00188dc8fae9fc3b4cd101ed5807cf

I'll close this once you give me the thumbs up.

You were spot on btw, and thanks!