nimblehq / infrastructure-templates

For IaaS and PaaS as codes
MIT License
10 stars 0 forks source link

[#274] Add project name to the IAM group names #275

Closed Nihisil closed 5 months ago

Nihisil commented 6 months ago

What happened 👀

Proof Of Work 📹

Before the fix, I couldn't deploy the template to the company's AWS account since the groups had already been created by the Nexus project: image

After the fix groups were created: image

Nihisil commented 6 months ago

It is maybe not needed, but should add a test for args.projectName.toLowerCase().replace(/\s/g, '-'); (e.g. add a space in the current projectDir = 'core test' and add 1 assertion that the file does main.tf does NOT contains core test but contains core-test. 🤔

Good point. I have added positive test here: https://github.com/nimblehq/infrastructure-templates/pull/275/commits/007ce2ac99510ba234ad8889203a393afe63b25a

In cases where the file doesn't contain the value, we don't yet have a helper, and adding one here might be excessive. What do you think?

Nihisil commented 6 months ago

Also I wasn't clear earlier. After these changes, the directory name for the template output will change too. If a user chooses My dir for their generated templates, it'll be saved to my-dir.

We could split the current project name variable into two: project name and project dir. This would keep the requested directory unchanged, and the generated project name would meet AWS requirements, which often don't allow spaces in names.

However, I don't believe it's worth the effort. In most cases, people don't use directory names with spaces since it's not the norm for developers