DEV Community

Cover image for Terraform Code Repository: Monolith or Microservice Approach
Arindam Mitra
Arindam Mitra

Posted on

Terraform Code Repository: Monolith or Microservice Approach

Greetings to my fellow Technology Advocates and Specialists.

In this Session, I will explain Terraform code repository structure: Monolith vs Microservice.

SPECIAL NOTE:-
I thank @pwd9000 and @anandarbone for collaborating. Though I am publishing this Article, but both of them have the equal rights to republish and repost.
CODE REPOSITORY:-

Terraform Code Repository: Monolith or Microservice Approach:-

Greetings to my fellow Technology Advocates and Specialists.

In this Session, I will explain Terraform code repository structure: Monolith vs Microservice.

SPECIAL NOTE:-
I thank @pwd9000 and @anandarbone for collaborating. Though I am publishing this Article, but both of them have the equal rights to republish and repost.
CONSIDERATIONS:-
For the purpose of this article, I/We have considered below:-
# CATEGORY VALUE
1. Cloud Platform Azure
2. Devops Platform Azure Devops
3. Source control Azure Git
4. Pipelines Azure Devops Pipelines
5. IaC Terraform
6. Code Structure Modules Based
What is Monolith based code repository in Terraform ?
1. In simple terms, it means one repository under Azure DevOps Project with multiple folders.
2. Each folder contains Terraform Module per Azure Service.
3. Reference screenshot follows below:-
Image description
Monolith based code repository problem statements:-
1. Each time the Pipeline runs, it checks out all
CONSIDERATIONS:-
For the purpose of this article, I/We have considered below:-
# CATEGORY VALUE
1. Cloud Platform Azure
2. Devops Platform Azure Devops
3. Source control Azure Git
4. Pipelines Azure Devops Pipelines
5. IaC Terraform
6. Code Structure Modules Based
What is Monolith based code repository in Terraform ?
1. In simple terms, it means one repository under Azure DevOps Project with multiple folders.
2. Each folder contains Terraform Module per Azure Service.
3. Reference screenshot follows below:-
Image description
Monolith based code repository problem statements:-
1. Each time the Pipeline runs, it checks out all codes.
2. Pipeline execution time increases gradually.
3. Size of the artifacts increases gradually .
4. Avoid Human Error while contributing.
What is Microservice based code repository in Terraform ?
1. In simple terms, it means multiple repositories under Azure DevOps Project.
2. Each repository contains Terraform Module per Azure Service.
3. Reference screenshot follows below:-
Image description

All the above identified problem statements in Monolith Code Repository is resolved with Microservice based code repository.

Mitigating Monolith based code repository problem statements with Microservice based code repository:-
1. Each time the Pipeline runs, it checks out only the relevant repositories.
2. Pipeline execution is fast/not impacted because it checks out only the relevant repositories.
3. Size of the artifacts is way small and the increase is not even noticed because it checks out only the relevant repositories
4. Chances of Human Error is on the lower side since contributor works on specific repositories.

Hope You Enjoyed the Session!!!

Stay Safe | Keep Learning | Spread Knowledge

Top comments (0)