From 42b594d824d6303d393cbe19eb0480a70ba1f533 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:49:45 +0000 Subject: [PATCH 1/5] Initial plan From 2eb0db40c939b00de85eab0d1d7790da81d354d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:57:16 +0000 Subject: [PATCH 2/5] Add Terraform equivalents for all Bicep infrastructure code Co-authored-by: sayedimac <25403967+sayedimac@users.noreply.github.com> --- .gitignore | 11 +++++ azd/aca/main.tf | 95 ++++++++++++++++++++++++++++++++++++++++++ azd/aca/outputs.tf | 19 +++++++++ azd/aca/variables.tf | 43 +++++++++++++++++++ azd/aci/main.tf | 75 +++++++++++++++++++++++++++++++++ azd/aci/outputs.tf | 19 +++++++++ azd/aci/variables.tf | 43 +++++++++++++++++++ azd/acr/modules/acr.tf | 52 +++++++++++++++++++++++ azd/aks/main.tf | 77 ++++++++++++++++++++++++++++++++++ azd/aks/outputs.tf | 29 +++++++++++++ azd/aks/variables.tf | 58 ++++++++++++++++++++++++++ 11 files changed, 521 insertions(+) create mode 100644 azd/aca/main.tf create mode 100644 azd/aca/outputs.tf create mode 100644 azd/aca/variables.tf create mode 100644 azd/aci/main.tf create mode 100644 azd/aci/outputs.tf create mode 100644 azd/aci/variables.tf create mode 100644 azd/acr/modules/acr.tf create mode 100644 azd/aks/main.tf create mode 100644 azd/aks/outputs.tf create mode 100644 azd/aks/variables.tf diff --git a/.gitignore b/.gitignore index 8a30d25..04e4964 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,14 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml + +# Terraform +.terraform/ +.terraform.lock.hcl +*.tfstate +*.tfstate.* +*.tfvars +*.tfplan +.terraformrc +terraform.rc + diff --git a/azd/aca/main.tf b/azd/aca/main.tf new file mode 100644 index 0000000..6b0d8b7 --- /dev/null +++ b/azd/aca/main.tf @@ -0,0 +1,95 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.0" + } + } +} + +provider "azurerm" { + features {} +} + +# Generate a unique resource token +resource "random_string" "resource_token" { + length = 13 + special = false + upper = false + numeric = true +} + +# Resource Group +resource "azurerm_resource_group" "main" { + name = "rg-${var.environment_name}" + location = var.location + + tags = { + "azd-env-name" = var.environment_name + } +} + +# Container Registry +resource "azurerm_container_registry" "acr" { + name = "acr${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name + sku = "Basic" + admin_enabled = true +} + +# Container Apps Environment +resource "azurerm_container_app_environment" "env" { + name = "cae-${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name +} + +# Container App +resource "azurerm_container_app" "app" { + name = "ca-${random_string.resource_token.result}" + container_app_environment_id = azurerm_container_app_environment.env.id + resource_group_name = azurerm_resource_group.main.name + revision_mode = "Single" + + registry { + server = azurerm_container_registry.acr.login_server + username = azurerm_container_registry.acr.admin_username + password_secret_name = "registry-password" + } + + secret { + name = "registry-password" + value = azurerm_container_registry.acr.admin_password + } + + template { + container { + name = "ca-${random_string.resource_token.result}" + image = var.container_image != "" ? "${azurerm_container_registry.acr.login_server}/${var.container_image}:latest" : "${azurerm_container_registry.acr.login_server}/docker-app:latest" + cpu = var.cpu_cores + memory = var.memory_in_gb + } + + min_replicas = 1 + max_replicas = 3 + + http_scale_rule { + name = "http-scale-rule" + concurrent_requests = "10" + } + } + + ingress { + external_enabled = true + target_port = var.container_port + traffic_weight { + latest_revision = true + percentage = 100 + } + } +} diff --git a/azd/aca/outputs.tf b/azd/aca/outputs.tf new file mode 100644 index 0000000..2696688 --- /dev/null +++ b/azd/aca/outputs.tf @@ -0,0 +1,19 @@ +output "AZURE_LOCATION" { + value = var.location + description = "Azure location where resources are deployed" +} + +output "AZURE_CONTAINER_REGISTRY_ENDPOINT" { + value = azurerm_container_registry.acr.login_server + description = "Container registry login server" +} + +output "AZURE_CONTAINER_REGISTRY_NAME" { + value = azurerm_container_registry.acr.name + description = "Container registry name" +} + +output "CONTAINER_APP_URL" { + value = "https://${azurerm_container_app.app.latest_revision_fqdn}" + description = "Container App URL" +} diff --git a/azd/aca/variables.tf b/azd/aca/variables.tf new file mode 100644 index 0000000..b5135e8 --- /dev/null +++ b/azd/aca/variables.tf @@ -0,0 +1,43 @@ +variable "environment_name" { + type = string + description = "Name of the environment which is used to generate a short unique hash used in all resources." + + validation { + condition = length(var.environment_name) >= 1 && length(var.environment_name) <= 64 + error_message = "Environment name must be between 1 and 64 characters." + } +} + +variable "location" { + type = string + description = "Primary location for all resources" + + validation { + condition = length(var.location) >= 1 + error_message = "Location must be specified." + } +} + +variable "container_image" { + type = string + description = "The container image to deploy" + default = "" +} + +variable "container_port" { + type = number + description = "Port the container listens on" + default = 80 +} + +variable "cpu_cores" { + type = string + description = "CPU cores allocated to the container" + default = "0.5" +} + +variable "memory_in_gb" { + type = string + description = "Memory allocated to the container in GB" + default = "1Gi" +} diff --git a/azd/aci/main.tf b/azd/aci/main.tf new file mode 100644 index 0000000..4d47745 --- /dev/null +++ b/azd/aci/main.tf @@ -0,0 +1,75 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.0" + } + } +} + +provider "azurerm" { + features {} +} + +# Generate a unique resource token +resource "random_string" "resource_token" { + length = 13 + special = false + upper = false + numeric = true +} + +# Resource Group +resource "azurerm_resource_group" "main" { + name = "rg-${var.environment_name}" + location = var.location + + tags = { + "azd-env-name" = var.environment_name + } +} + +# Container Registry +resource "azurerm_container_registry" "acr" { + name = "acr${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name + sku = "Basic" + admin_enabled = true +} + +# Container Instance +resource "azurerm_container_group" "main" { + name = "aci-${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name + ip_address_type = "Public" + os_type = "Linux" + restart_policy = "Always" + + tags = { + "azd-env-name" = var.environment_name + } + + container { + name = "aci-${random_string.resource_token.result}" + image = var.container_image != "" ? var.container_image : "mcr.microsoft.com/azuredocs/aci-helloworld" + cpu = var.cpu_cores + memory = var.memory_in_gb + + ports { + port = var.container_port + protocol = "TCP" + } + } + + image_registry_credential { + server = azurerm_container_registry.acr.login_server + username = azurerm_container_registry.acr.admin_username + password = azurerm_container_registry.acr.admin_password + } +} diff --git a/azd/aci/outputs.tf b/azd/aci/outputs.tf new file mode 100644 index 0000000..c2b44f1 --- /dev/null +++ b/azd/aci/outputs.tf @@ -0,0 +1,19 @@ +output "AZURE_LOCATION" { + value = var.location + description = "Azure location where resources are deployed" +} + +output "AZURE_CONTAINER_REGISTRY_ENDPOINT" { + value = azurerm_container_registry.acr.login_server + description = "Container registry login server" +} + +output "AZURE_CONTAINER_REGISTRY_NAME" { + value = azurerm_container_registry.acr.name + description = "Container registry name" +} + +output "ACI_URI" { + value = "http://${azurerm_container_group.main.ip_address}:${var.container_port}" + description = "Container Instance URI" +} diff --git a/azd/aci/variables.tf b/azd/aci/variables.tf new file mode 100644 index 0000000..18a9f2d --- /dev/null +++ b/azd/aci/variables.tf @@ -0,0 +1,43 @@ +variable "environment_name" { + type = string + description = "Name of the environment which is used to generate a short unique hash used in all resources." + + validation { + condition = length(var.environment_name) >= 1 && length(var.environment_name) <= 64 + error_message = "Environment name must be between 1 and 64 characters." + } +} + +variable "location" { + type = string + description = "Primary location for all resources" + + validation { + condition = length(var.location) >= 1 + error_message = "Location must be specified." + } +} + +variable "container_image" { + type = string + description = "The container image to deploy" + default = "" +} + +variable "container_port" { + type = number + description = "Port the container listens on" + default = 80 +} + +variable "cpu_cores" { + type = string + description = "CPU cores allocated to the container instance" + default = "1.0" +} + +variable "memory_in_gb" { + type = string + description = "Memory allocated to the container instance in GB" + default = "1.5" +} diff --git a/azd/acr/modules/acr.tf b/azd/acr/modules/acr.tf new file mode 100644 index 0000000..0d498a2 --- /dev/null +++ b/azd/acr/modules/acr.tf @@ -0,0 +1,52 @@ +# Azure Container Registry +resource "azurerm_container_registry" "acr" { + name = var.registry_name + location = var.location + resource_group_name = var.resource_group_name + sku = var.sku + admin_enabled = var.admin_enabled +} + +output "acr_id" { + value = azurerm_container_registry.acr.id + description = "Container registry ID" +} + +output "acr_name" { + value = azurerm_container_registry.acr.name + description = "Container registry name" +} + +output "acr_login_server" { + value = azurerm_container_registry.acr.login_server + description = "Container registry login server" +} + +variable "registry_name" { + type = string + description = "Name of the container registry" +} + +variable "location" { + type = string + description = "Azure region location" + default = null +} + +variable "resource_group_name" { + type = string + description = "Name of the resource group" + default = null +} + +variable "sku" { + type = string + description = "SKU for the container registry" + default = "Basic" +} + +variable "admin_enabled" { + type = bool + description = "Enable admin user for the registry" + default = true +} diff --git a/azd/aks/main.tf b/azd/aks/main.tf new file mode 100644 index 0000000..ca1d01b --- /dev/null +++ b/azd/aks/main.tf @@ -0,0 +1,77 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 3.0" + } + random = { + source = "hashicorp/random" + version = "~> 3.0" + } + } +} + +provider "azurerm" { + features {} +} + +# Generate a unique resource token +resource "random_string" "resource_token" { + length = 13 + special = false + upper = false + numeric = true +} + +# Resource Group +resource "azurerm_resource_group" "main" { + name = "rg-${var.environment_name}" + location = var.location + + tags = { + "azd-env-name" = var.environment_name + } +} + +# Container Registry +resource "azurerm_container_registry" "acr" { + name = "acr${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name + sku = "Basic" + admin_enabled = true +} + +# AKS Cluster +resource "azurerm_kubernetes_cluster" "aks" { + name = "aks-${random_string.resource_token.result}" + location = azurerm_resource_group.main.location + resource_group_name = azurerm_resource_group.main.name + dns_prefix = "aks-${random_string.resource_token.result}" + role_based_access_control_enabled = false + + default_node_pool { + name = "agentpool" + node_count = var.agent_count + vm_size = var.agent_vm_size + os_disk_size_gb = var.os_disk_size_gb + os_sku = var.os_type == "Linux" ? "Ubuntu" : "Windows2022" + type = "VirtualMachineScaleSets" + } + + identity { + type = "SystemAssigned" + } + + tags = { + displayname = "AKS Cluster" + } +} + +# Role assignment for ACR pull +resource "azurerm_role_assignment" "acr_pull" { + principal_id = azurerm_kubernetes_cluster.aks.kubelet_identity[0].object_id + role_definition_name = "AcrPull" + scope = azurerm_container_registry.acr.id + skip_service_principal_aad_check = true +} diff --git a/azd/aks/outputs.tf b/azd/aks/outputs.tf new file mode 100644 index 0000000..a716ab2 --- /dev/null +++ b/azd/aks/outputs.tf @@ -0,0 +1,29 @@ +output "AZURE_LOCATION" { + value = var.location + description = "Azure location where resources are deployed" +} + +output "AZURE_CONTAINER_REGISTRY_ENDPOINT" { + value = azurerm_container_registry.acr.login_server + description = "Container registry login server" +} + +output "AZURE_CONTAINER_REGISTRY_NAME" { + value = azurerm_container_registry.acr.name + description = "Container registry name" +} + +output "AKS_CLUSTER_NAME" { + value = azurerm_kubernetes_cluster.aks.name + description = "AKS cluster name" +} + +output "AKS_CLUSTER_FQDN" { + value = azurerm_kubernetes_cluster.aks.fqdn + description = "AKS cluster FQDN" +} + +output "AKS_IDENTITY_PRINCIPAL_ID" { + value = azurerm_kubernetes_cluster.aks.identity[0].principal_id + description = "AKS identity principal ID" +} diff --git a/azd/aks/variables.tf b/azd/aks/variables.tf new file mode 100644 index 0000000..c8e56f9 --- /dev/null +++ b/azd/aks/variables.tf @@ -0,0 +1,58 @@ +variable "environment_name" { + type = string + description = "Name of the environment which is used to generate a short unique hash used in all resources." + + validation { + condition = length(var.environment_name) >= 1 && length(var.environment_name) <= 64 + error_message = "Environment name must be between 1 and 64 characters." + } +} + +variable "location" { + type = string + description = "Primary location for all resources" + + validation { + condition = length(var.location) >= 1 + error_message = "Location must be specified." + } +} + +variable "agent_count" { + type = number + description = "The number of nodes for the cluster. 1 Node is enough for Dev/Test and minimum 3 nodes, is recommended for Production" + default = 3 + + validation { + condition = var.agent_count >= 1 && var.agent_count <= 100 + error_message = "Agent count must be between 1 and 100." + } +} + +variable "agent_vm_size" { + type = string + description = "The size of the Virtual Machine" + default = "Standard_D2s_v3" +} + +variable "os_disk_size_gb" { + type = number + description = "Disk size (in GiB) to provision for each of the agent pool nodes. This value ranges from 0 to 1023. Specifying 0 will apply the default disk size for that agentVMSize." + default = 0 + + validation { + condition = var.os_disk_size_gb >= 0 && var.os_disk_size_gb <= 1023 + error_message = "OS disk size must be between 0 and 1023." + } +} + +variable "os_type" { + type = string + description = "The type of operating system" + default = "Linux" + + validation { + condition = contains(["Linux", "Windows"], var.os_type) + error_message = "OS type must be either Linux or Windows." + } +} From 9f3eef111ecee3f3d225df316238e08ad1d0f898 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:58:00 +0000 Subject: [PATCH 3/5] Add Terraform documentation and example variable files Co-authored-by: sayedimac <25403967+sayedimac@users.noreply.github.com> --- azd/TERRAFORM.md | 162 +++++++++++++++++++++++++++++++ azd/aca/terraform.tfvars.example | 11 +++ azd/aci/terraform.tfvars.example | 11 +++ azd/aks/terraform.tfvars.example | 11 +++ 4 files changed, 195 insertions(+) create mode 100644 azd/TERRAFORM.md create mode 100644 azd/aca/terraform.tfvars.example create mode 100644 azd/aci/terraform.tfvars.example create mode 100644 azd/aks/terraform.tfvars.example diff --git a/azd/TERRAFORM.md b/azd/TERRAFORM.md new file mode 100644 index 0000000..3f0b4ad --- /dev/null +++ b/azd/TERRAFORM.md @@ -0,0 +1,162 @@ +# Terraform Infrastructure + +This directory contains Terraform configurations that are equivalent to the Bicep templates in this repository. You can choose to use either Bicep or Terraform for deploying the infrastructure. + +## Structure + +Each deployment option has its own directory with Terraform configurations: + +- **aca/** - Azure Container Apps deployment +- **aci/** - Azure Container Instance deployment +- **aks/** - Azure Kubernetes Service deployment +- **acr/** - Standalone Azure Container Registry module + +## Prerequisites + +1. [Terraform](https://www.terraform.io/downloads) >= 1.0 +2. [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +3. An active Azure subscription + +## Authentication + +Before running Terraform, authenticate with Azure: + +```bash +az login +``` + +## Usage + +### Azure Container Apps (ACA) + +```bash +cd azd/aca + +# Initialize Terraform +terraform init + +# Review the execution plan +terraform plan -var="environment_name=myenv" -var="location=eastus" + +# Apply the configuration +terraform apply -var="environment_name=myenv" -var="location=eastus" +``` + +### Azure Container Instance (ACI) + +```bash +cd azd/aci + +# Initialize Terraform +terraform init + +# Review the execution plan +terraform plan -var="environment_name=myenv" -var="location=eastus" + +# Apply the configuration +terraform apply -var="environment_name=myenv" -var="location=eastus" +``` + +### Azure Kubernetes Service (AKS) + +```bash +cd azd/aks + +# Initialize Terraform +terraform init + +# Review the execution plan +terraform plan -var="environment_name=myenv" -var="location=eastus" + +# Apply the configuration +terraform apply -var="environment_name=myenv" -var="location=eastus" +``` + +## Variables + +Each deployment option has configurable variables. Here are the common ones: + +### Required Variables + +- `environment_name` - Name of the environment (1-64 characters) +- `location` - Azure region (e.g., "eastus", "westus2") + +### Optional Variables (ACA) + +- `container_image` - Container image to deploy (default: "docker-app") +- `container_port` - Port the container listens on (default: 80) +- `cpu_cores` - CPU cores allocated (default: "0.5") +- `memory_in_gb` - Memory allocated (default: "1Gi") + +### Optional Variables (ACI) + +- `container_image` - Container image to deploy (default: "mcr.microsoft.com/azuredocs/aci-helloworld") +- `container_port` - Port the container listens on (default: 80) +- `cpu_cores` - CPU cores allocated (default: "1.0") +- `memory_in_gb` - Memory in GB (default: "1.5") + +### Optional Variables (AKS) + +- `agent_count` - Number of agent nodes (default: 3, range: 1-100) +- `agent_vm_size` - VM size for nodes (default: "Standard_D2s_v3") +- `os_disk_size_gb` - OS disk size in GB (default: 0, range: 0-1023) +- `os_type` - Operating system type (default: "Linux", options: "Linux", "Windows") + +## Using Variable Files + +You can create a `terraform.tfvars` file to store your variables: + +```hcl +environment_name = "myenv" +location = "eastus" +container_image = "myregistry.azurecr.io/myapp" +container_port = 8080 +``` + +Then run: + +```bash +terraform apply +``` + +## Outputs + +Each configuration provides outputs that can be used for further automation: + +- `AZURE_LOCATION` - The Azure region where resources are deployed +- `AZURE_CONTAINER_REGISTRY_ENDPOINT` - Container registry login server +- `AZURE_CONTAINER_REGISTRY_NAME` - Container registry name +- Additional outputs specific to each deployment type + +## Comparison with Bicep + +| Feature | Bicep | Terraform | +|---------|-------|-----------| +| Language | ARM Template DSL | HCL (HashiCorp Configuration Language) | +| Provider | Azure-specific | Multi-cloud (Azure, AWS, GCP, etc.) | +| State Management | Server-side (Azure) | Client-side (local or remote backend) | +| Module System | Bicep modules | Terraform modules | +| Validation | `az bicep build` | `terraform validate` | +| Preview Changes | `az deployment what-if` | `terraform plan` | +| Apply Changes | `az deployment create` | `terraform apply` | + +## Clean Up + +To destroy all resources created by Terraform: + +```bash +terraform destroy -var="environment_name=myenv" -var="location=eastus" +``` + +Or if using a tfvars file: + +```bash +terraform destroy +``` + +## Notes + +- The Terraform configurations are functionally equivalent to their Bicep counterparts +- Both Bicep and Terraform files are maintained in this repository for flexibility +- The `.terraform/` directory and state files are git-ignored for security +- Always review the `terraform plan` output before applying changes diff --git a/azd/aca/terraform.tfvars.example b/azd/aca/terraform.tfvars.example new file mode 100644 index 0000000..dffd2b3 --- /dev/null +++ b/azd/aca/terraform.tfvars.example @@ -0,0 +1,11 @@ +# Example Terraform variables for Azure Container Apps deployment +# Copy this file to terraform.tfvars and customize the values + +environment_name = "dev" +location = "eastus" + +# Optional: Container configuration +# container_image = "docker-app" +# container_port = 80 +# cpu_cores = "0.5" +# memory_in_gb = "1Gi" diff --git a/azd/aci/terraform.tfvars.example b/azd/aci/terraform.tfvars.example new file mode 100644 index 0000000..1e5f86c --- /dev/null +++ b/azd/aci/terraform.tfvars.example @@ -0,0 +1,11 @@ +# Example Terraform variables for Azure Container Instance deployment +# Copy this file to terraform.tfvars and customize the values + +environment_name = "dev" +location = "eastus" + +# Optional: Container configuration +# container_image = "mcr.microsoft.com/azuredocs/aci-helloworld" +# container_port = 80 +# cpu_cores = "1.0" +# memory_in_gb = "1.5" diff --git a/azd/aks/terraform.tfvars.example b/azd/aks/terraform.tfvars.example new file mode 100644 index 0000000..49849ea --- /dev/null +++ b/azd/aks/terraform.tfvars.example @@ -0,0 +1,11 @@ +# Example Terraform variables for Azure Kubernetes Service deployment +# Copy this file to terraform.tfvars and customize the values + +environment_name = "dev" +location = "eastus" + +# Optional: AKS configuration +# agent_count = 3 +# agent_vm_size = "Standard_D2s_v3" +# os_disk_size_gb = 0 +# os_type = "Linux" From 976a7c382e11df2608dc3be7bcd4d420382b01f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:00:31 +0000 Subject: [PATCH 4/5] Address code review feedback: improve variable descriptions and fix ACR module Co-authored-by: sayedimac <25403967+sayedimac@users.noreply.github.com> --- azd/aca/variables.tf | 4 ++-- azd/aci/variables.tf | 4 ++-- azd/acr/modules/acr.tf | 2 -- azd/aks/main.tf | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/azd/aca/variables.tf b/azd/aca/variables.tf index b5135e8..c91bec5 100644 --- a/azd/aca/variables.tf +++ b/azd/aca/variables.tf @@ -32,12 +32,12 @@ variable "container_port" { variable "cpu_cores" { type = string - description = "CPU cores allocated to the container" + description = "CPU cores allocated to the container (e.g., '0.5', '1.0')" default = "0.5" } variable "memory_in_gb" { type = string - description = "Memory allocated to the container in GB" + description = "Memory allocated to the container (e.g., '1Gi', '2Gi')" default = "1Gi" } diff --git a/azd/aci/variables.tf b/azd/aci/variables.tf index 18a9f2d..0d14828 100644 --- a/azd/aci/variables.tf +++ b/azd/aci/variables.tf @@ -32,12 +32,12 @@ variable "container_port" { variable "cpu_cores" { type = string - description = "CPU cores allocated to the container instance" + description = "CPU cores allocated to the container instance (e.g., '0.5', '1.0', '2.0')" default = "1.0" } variable "memory_in_gb" { type = string - description = "Memory allocated to the container instance in GB" + description = "Memory allocated to the container instance in GB (e.g., '1.0', '1.5', '2.0')" default = "1.5" } diff --git a/azd/acr/modules/acr.tf b/azd/acr/modules/acr.tf index 0d498a2..4bd70d2 100644 --- a/azd/acr/modules/acr.tf +++ b/azd/acr/modules/acr.tf @@ -30,13 +30,11 @@ variable "registry_name" { variable "location" { type = string description = "Azure region location" - default = null } variable "resource_group_name" { type = string description = "Name of the resource group" - default = null } variable "sku" { diff --git a/azd/aks/main.tf b/azd/aks/main.tf index ca1d01b..ab91e34 100644 --- a/azd/aks/main.tf +++ b/azd/aks/main.tf @@ -43,6 +43,7 @@ resource "azurerm_container_registry" "acr" { } # AKS Cluster +# Note: RBAC is disabled to match the Bicep configuration, but enabling RBAC is recommended for production resource "azurerm_kubernetes_cluster" "aks" { name = "aks-${random_string.resource_token.result}" location = azurerm_resource_group.main.location From acb01d3fd29f54e4a8e5fc5a6720c32de89db068 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:02:10 +0000 Subject: [PATCH 5/5] Update README with Bicep and Terraform documentation Co-authored-by: sayedimac <25403967+sayedimac@users.noreply.github.com> --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6073726..dc49a2b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,57 @@ +# Docker App -## hahaha +A sample .NET Docker application with infrastructure as code (IaC) templates for Azure deployment. + +## Infrastructure Deployment Options + +This repository includes infrastructure templates in both **Bicep** and **Terraform** formats for deploying to Azure. Choose the tool that best fits your workflow: + +### Bicep (Azure-native) +- Native Azure Resource Manager (ARM) template language +- Tight integration with Azure CLI +- See individual `*.bicep` files in the `azd/` directory + +### Terraform (Multi-cloud) +- HashiCorp's infrastructure as code tool +- Works across multiple cloud providers +- See individual `*.tf` files in the `azd/` directory +- **[📖 Terraform Documentation](azd/TERRAFORM.md)** + +## Deployment Targets + +Both Bicep and Terraform support the following Azure deployment options: + +| Option | Description | Bicep Files | Terraform Files | +|--------|-------------|-------------|-----------------| +| **ACA** | Azure Container Apps | `azd/aca/*.bicep` | `azd/aca/*.tf` | +| **ACI** | Azure Container Instance | `azd/aci/*.bicep` | `azd/aci/*.tf` | +| **AKS** | Azure Kubernetes Service | `azd/aks/*.bicep` | `azd/aks/*.tf` | +| **ACR** | Azure Container Registry (module) | `azd/acr/modules/*.bicep` | `azd/acr/modules/*.tf` | + +## Quick Start + +### Using Bicep +```bash +cd azd/aca +az deployment sub create \ + --location eastus \ + --template-file main.bicep \ + --parameters environmentName=myenv location=eastus +``` + +### Using Terraform +```bash +cd azd/aca +terraform init +terraform apply -var="environment_name=myenv" -var="location=eastus" +``` + +For detailed Terraform usage, see **[TERRAFORM.md](azd/TERRAFORM.md)**. + +## Application + +The application is a .NET Docker app located in the `src/` directory. Build it using: + +```bash +docker build -t docker-app . +```