Separated variables from the resources.

This commit is contained in:
2025-08-15 13:43:48 +02:00
parent 6a15ccee4f
commit ce14fafbf3
2 changed files with 27 additions and 38 deletions

38
main.tf
View File

@@ -17,34 +17,6 @@ provider "azurerm" {
subscription_id = var.subscription_id
}
variable "subscription_id" {
description = "The Azure Subscription ID to use for the resources."
type = string
}
variable "azure_client_id" {
description = "The Azure Client ID for authentication."
type = string
}
variable "azure_tenant_id" {
description = "The Azure Tenant ID for authentication."
type = string
}
variable "azure_client_secret" {
description = "The Azure Client Secret for authentication."
type = string
sensitive = true
}
variable "project_name" {
description = "The name used to construct Azure resource names."
type = string
}
resource "azurerm_resource_group" "rg" {
name = "rg-${var.project_name}"
location = "Poland Central"
@@ -64,11 +36,6 @@ resource "azurerm_container_app_environment" "env" {
location = azurerm_resource_group.rg.location
log_analytics_workspace_id = azurerm_log_analytics_workspace.logaws.id
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.uai.id]
}
workload_profile {
maximum_count = 1
minimum_count = 1
@@ -131,11 +98,6 @@ resource "azurerm_container_app" "app" {
server = "skdomlab.azurecr.io"
identity = azurerm_user_assigned_identity.uai.id
}
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.uai.id]
}
}
resource "azurerm_user_assigned_identity" "uai" {

27
variables.tf Normal file
View File

@@ -0,0 +1,27 @@
variable "subscription_id" {
description = "The Azure Subscription ID to use for the resources."
type = string
}
variable "azure_client_id" {
description = "The Azure Client ID for authentication."
type = string
}
variable "azure_tenant_id" {
description = "The Azure Tenant ID for authentication."
type = string
}
variable "azure_client_secret" {
description = "The Azure Client Secret for authentication."
type = string
sensitive = true
}
variable "project_name" {
description = "The name used to construct Azure resource names."
type = string
}