terraform - Azure create PROD out of DEV Environment - Stack Overflow

admin2025-04-20  5

Context

We have a working dev environment in azure.

The project is about hosting a frontend, a backend and a database via container apps. It is still in the beginning so there are not that many resources right now. We have a container app environment, some container apps, a vnet and a storage account among some others.

Our dev environment was created manually via the azure portal. Everything works flawless right now.

Problem

At this stage we want to create a prod environment. For this to happen we want to create a IaC repository that creates the resources as they are in the dev environment. Like changing the tag from "dev" to "prod" then all the resources get created just with a "prod" in their name insted of "dev".

I wanted to use terraform for this. I am new to the topic and terraform seemed straight forward. Since this project is quite new and there are still not that many resources online, I wanted to build it up from skretch with pure terraform components.

Questions

1. Best Practices

Since I am countering a lot of issues, I am wondering if my approach is the easiest or if there are some other best practices for that?

It basically is just copying one resource group and changing just one naming parameter. I looked into arm templates, but there I would have to rename a lot and it does not look like it is very adjustable when people are adding more and more resources via the azure portal.

2. Lessons for new projects

Should we have directly started by setting up the environment with an iac repository instead of doing it in the azure portal?

Context

We have a working dev environment in azure.

The project is about hosting a frontend, a backend and a database via container apps. It is still in the beginning so there are not that many resources right now. We have a container app environment, some container apps, a vnet and a storage account among some others.

Our dev environment was created manually via the azure portal. Everything works flawless right now.

Problem

At this stage we want to create a prod environment. For this to happen we want to create a IaC repository that creates the resources as they are in the dev environment. Like changing the tag from "dev" to "prod" then all the resources get created just with a "prod" in their name insted of "dev".

I wanted to use terraform for this. I am new to the topic and terraform seemed straight forward. Since this project is quite new and there are still not that many resources online, I wanted to build it up from skretch with pure terraform components.

Questions

1. Best Practices

Since I am countering a lot of issues, I am wondering if my approach is the easiest or if there are some other best practices for that?

It basically is just copying one resource group and changing just one naming parameter. I looked into arm templates, but there I would have to rename a lot and it does not look like it is very adjustable when people are adding more and more resources via the azure portal.

2. Lessons for new projects

Should we have directly started by setting up the environment with an iac repository instead of doing it in the azure portal?

Share Improve this question asked Jan 24 at 9:47 snicesnice 1192 silver badges11 bronze badges 1
  • 1 Are you trying any specific code for this requirement. @snice – Jahnavi Commented Jan 24 at 10:06
Add a comment  | 

1 Answer 1

Reset to default 0

just my 2 cents:

Q1: You can also look at bicep. I used both terraform and ARM template, personally speaking, bicep is my current preferred option at the moment. It is much easier than terraform as no state management required.

IaC itself requires work and efforts. It is pretty standard practice for cloud apps especially when there are multiple environments and the app is client facing. (not just a POC)

Q2: click-ops might be ok if you are just exploring and learning. We would eventually get into trouble when there are multiple devs in the team, or you have multiple env to manage. It is very painful to keep different envs exactly same by click-ops. Imagine what might happen if your application code is not version controlled.

转载请注明原文地址:http://anycun.com/QandA/1745149940a90396.html