File tree Expand file tree Collapse file tree 6 files changed +132
-0
lines changed
Expand file tree Collapse file tree 6 files changed +132
-0
lines changed Original file line number Diff line number Diff line change 11.env
2+ .terraform
3+ * .tfstate *
4+ * .tfvars
5+ tfplan
26
37# User-specific files
48* .rsuser
Original file line number Diff line number Diff line change 1+ data "azurerm_resource_group" "rg" {
2+ name = var. rg_name
3+ }
4+
5+ resource "azurerm_log_analytics_workspace" "law" {
6+ name = var. law_name
7+ location = data. azurerm_resource_group . rg . location
8+ resource_group_name = data. azurerm_resource_group . rg . name
9+ sku = " PerGB2018"
10+ retention_in_days = 30
11+ }
12+
13+ resource "azurerm_container_app_environment" "ca_env" {
14+ name = var. ca_env_name
15+ location = data. azurerm_resource_group . rg . location
16+ resource_group_name = data. azurerm_resource_group . rg . name
17+ log_analytics_workspace_id = azurerm_log_analytics_workspace. law . id
18+ }
19+
20+ resource "azurerm_container_app" "ca_app" {
21+ name = var. ca_app_name
22+ resource_group_name = data. azurerm_resource_group . rg . name
23+ container_app_environment_id = azurerm_container_app_environment. ca_env . id
24+ revision_mode = " Single"
25+
26+ ingress {
27+ external_enabled = true
28+ target_port = var. container_port
29+
30+ traffic_weight {
31+ percentage = 100
32+ latest_revision = true
33+ }
34+ }
35+
36+ template {
37+ min_replicas = 0
38+ max_replicas = 1
39+
40+ container {
41+ name = var. ca_app_name
42+ image = " mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
43+ cpu = 0.25
44+ memory = " 0.5Gi"
45+
46+ liveness_probe {
47+ transport = " HTTP"
48+ port = var. container_port
49+ path = " /health"
50+ interval_seconds = 10
51+ timeout = 5
52+ failure_count_threshold = 3
53+ }
54+ }
55+
56+ http_scale_rule {
57+ name = " http-scaler"
58+ concurrent_requests = 10
59+ }
60+ }
61+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_providers {
3+ azurerm = {
4+ source = " hashicorp/azurerm"
5+ version = " >= 4.27.0"
6+ }
7+ }
8+
9+ backend "azurerm" {
10+ key = " terraform.tfstate"
11+ }
12+ }
13+
14+ provider "azurerm" {
15+ subscription_id = var. subscription_id
16+ tenant_id = var. tenant_id
17+ features {}
18+ }
Original file line number Diff line number Diff line change 1+ variable "subscription_id" {
2+ type = string
3+ }
4+
5+ variable "tenant_id" {
6+ type = string
7+ }
8+
9+ variable "rg_name" {
10+ type = string
11+ }
12+
13+ variable "law_name" {
14+ type = string
15+ }
16+
17+ variable "ca_env_name" {
18+ type = string
19+ }
20+
21+ variable "ca_app_name" {
22+ type = string
23+ }
24+
25+ variable "container_port" {
26+ type = number
27+ default = 8080
28+ }
You can’t perform that action at this time.
0 commit comments