Terragrunt repository/directory layout to implement least access privilege #698
-
I am currently working on a Terragrunt GitHub repository/directory layout setup for deploying the "core cloud infrastructure setup" of an corporate Azure environment, which should consists of multiple components:
I need to have two fully isolated environments: prd and dev (changes to these environments need to be strictly isolated; state files should be on different storage accounts too, etc.) For IT security requirements, I need to implement the least access privilege concept, which also needs to be applied for running automation code.
which are configured with the minimum permissions necessary on Azure (e.g. network-hub-automation-prd should only be able to deploy the network related resources in the configured prd subscriptions). In addition, people doing dev work shouldn't be able to run prd automation (unless they are also member of the prd team) - segration of duties. This is all to reduce the blast radius if dev/prd mistakes happen and/or any credentials for automation users get leaked, etc. Deployment of these different components of the core infrastructure should then be done via individual GitHub actions. I did lots of research on the Internet to find out the most suitable (mono/poly) repository and directory layout, but I am still not sure which way to go forward. Currently I can think of these layouts: (A) One mono repositoryRepository: live-infrastructure
(B) One repository per environment (poly-repo)Repository: live-infrastructure-dev
Repository: live-infrastructure-prd
(C) One repository per component per environment (poly-repo)Repository: live-infrastructure-central-loging-dev
Repository: live-infrastructure-networking-hub-dev
Repository: live-infrastructure-central-loging-prd
Repository: live-infrastructure-networking-hub-prd
I would be happy if you can share your thoughts and experience with me and any good/best practices. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
This is more of a question of your deployment workflow than of Terragrunt. Even if you weren't using Terragrunt, and solely using Terraform, you'd still have to resolve the question of "how do I decide which parts of my infrastructure code can be updated by which devs?" There are many different ways to answer this question. Here are just a few:
I'd recommend using items (2)-(4) in most cases, as they give you a bunch of nice benefits, including enforcing access controls as per this discussion. Note that all of these items work with monorepos or polyrepos too. |
Beta Was this translation helpful? Give feedback.
This is more of a question of your deployment workflow than of Terragrunt. Even if you weren't using Terragrunt, and solely using Terraform, you'd still have to resolve the question of "how do I decide which parts of my infrastructure code can be updated by which devs?"
There are many different ways to answer this question. Here are just a few: