Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform script organization #60

Open
NourMawla98 opened this issue Oct 14, 2024 · 0 comments
Open

Terraform script organization #60

NourMawla98 opened this issue Oct 14, 2024 · 0 comments

Comments

@NourMawla98
Copy link

I have a terraform script. The hierarchy is as follows:

/root
├─main.tf
├─variables.tf
└─provider.tf

The script is as follows:

Step 1: Define Resource Group

resource "azurerm_resource_group" "rg" {
location = var.zone
name = var.rg-name
}

Step 2: Create database

resource "azurerm_mysql_flexible_server" "mysql" {
resource_group_name = azurerm_resource_group.rg.name

....

}

resource "azurerm_mysql_flexible_server_firewall_rule" "allow-all-ips" {

....

}

Steps 3, 4.....

as you can tell, the script is becoming too large and very difficult to maintain and handle

How can I use 1 provider.tf, 1 variables.tf and 1 main.tf to organize all these resources. Please not that some resources depends on the output of others

Any advice will be much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant