Skip to content

Commit 30ccf54

Browse files
committed
feat/re-introduce dapr example
1 parent 14c18b2 commit 30ccf54

File tree

9 files changed

+96
-70
lines changed

9 files changed

+96
-70
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,7 @@ The following resources are used by this module:
6060

6161
The following input variables are required:
6262

63-
### <a name="input_container_app_environment_resource_id"></a> [container\_app\_environment\_resource\_id](#input\_container\_app\_environment\_resource\_id)
64-
65-
Description: Resource ID of environment.
66-
67-
Type: `string`
68-
69-
### <a name="input_container_apps"></a> [container\_apps](#input\_container\_apps)
63+
### <a name="input_container_app"></a> [container\_app](#input\_container\_app)
7064

7165
Description: Specifies the container apps in the managed environment.
7266

@@ -260,6 +254,12 @@ object({
260254
})
261255
```
262256

257+
### <a name="input_container_app_environment_resource_id"></a> [container\_app\_environment\_resource\_id](#input\_container\_app\_environment\_resource\_id)
258+
259+
Description: Resource ID of environment.
260+
261+
Type: `string`
262+
263263
### <a name="input_name"></a> [name](#input\_name)
264264

265265
Description: Name for the resource.
Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ resource "azapi_resource" "managed_environment" {
6161
}
6262
6363
# This is the module call
64-
module "container-app" {
64+
module "node-app" {
6565
source = "../../"
6666
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
67-
name = replace(azurerm_resource_group.this.name, "rg-", "ca-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
67+
name = replace(azurerm_resource_group.this.name, "rg-", "ca-nodeapp-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
6868
resource_group_name = azurerm_resource_group.this.name
6969
container_app_environment_resource_id = azapi_resource.managed_environment.id
7070
7171
workload_profile_name = ""
72-
container_apps = [{
72+
container_app = {
7373
name = "nodeapp"
7474
configuration = {
7575
ingress = {
@@ -101,30 +101,40 @@ module "container-app" {
101101
maxReplicas = 1
102102
}
103103
}
104-
},
105-
{
106-
name = "pythonapp"
107-
configuration = {
108-
dapr = {
109-
enabled = true
110-
appId = "pythonapp"
111-
}
104+
}
105+
}
106+
107+
module "python-app" {
108+
source = "../../"
109+
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
110+
name = replace(azurerm_resource_group.this.name, "rg-", "ca-pythonapp-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
111+
resource_group_name = azurerm_resource_group.this.name
112+
container_app_environment_resource_id = azapi_resource.managed_environment.id
113+
114+
workload_profile_name = ""
115+
container_app = {
116+
name = "pythonapp"
117+
configuration = {
118+
dapr = {
119+
enabled = true
120+
appId = "pythonapp"
112121
}
113-
template = {
114-
containers = [{
115-
image = "dapriosamples/hello-k8s-python:latest"
116-
name = "hello-k8s-python"
117-
resources = {
118-
cpu = 0.5
119-
memory = "1.0Gi"
120-
}
121-
}]
122-
scale = {
123-
minReplicas = 1
124-
maxReplicas = 1
122+
}
123+
template = {
124+
containers = [{
125+
image = "dapriosamples/hello-k8s-python:latest"
126+
name = "hello-k8s-python"
127+
resources = {
128+
cpu = 0.5
129+
memory = "1.0Gi"
125130
}
131+
}]
132+
scale = {
133+
minReplicas = 1
134+
maxReplicas = 1
126135
}
127-
}]
136+
}
137+
}
128138
}
129139
```
130140

@@ -181,17 +191,23 @@ No outputs.
181191

182192
The following Modules are called:
183193

184-
### <a name="module_container-app"></a> [container-app](#module\_container-app)
194+
### <a name="module_naming"></a> [naming](#module\_naming)
195+
196+
Source: Azure/naming/azurerm
197+
198+
Version: 0.3.0
199+
200+
### <a name="module_node-app"></a> [node-app](#module\_node-app)
185201

186202
Source: ../../
187203

188204
Version:
189205

190-
### <a name="module_naming"></a> [naming](#module\_naming)
206+
### <a name="module_python-app"></a> [python-app](#module\_python-app)
191207

192-
Source: Azure/naming/azurerm
208+
Source: ../../
193209

194-
Version: 0.3.0
210+
Version:
195211

196212
<!-- markdownlint-disable-next-line MD041 -->
197213
## Data Collection
File renamed without changes.
File renamed without changes.
Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ resource "azapi_resource" "managed_environment" {
5555
}
5656

5757
# This is the module call
58-
module "container-app" {
58+
module "node-app" {
5959
source = "../../"
6060
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
61-
name = replace(azurerm_resource_group.this.name, "rg-", "ca-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
61+
name = replace(azurerm_resource_group.this.name, "rg-", "ca-nodeapp-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
6262
resource_group_name = azurerm_resource_group.this.name
6363
container_app_environment_resource_id = azapi_resource.managed_environment.id
6464

6565
workload_profile_name = ""
66-
container_apps = [{
66+
container_app = {
6767
name = "nodeapp"
6868
configuration = {
6969
ingress = {
@@ -95,28 +95,38 @@ module "container-app" {
9595
maxReplicas = 1
9696
}
9797
}
98-
},
99-
{
100-
name = "pythonapp"
101-
configuration = {
102-
dapr = {
103-
enabled = true
104-
appId = "pythonapp"
105-
}
98+
}
99+
}
100+
101+
module "python-app" {
102+
source = "../../"
103+
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
104+
name = replace(azurerm_resource_group.this.name, "rg-", "ca-pythonapp-") # TODO remove workaround pending PR - https://github.com/Azure/terraform-azurerm-naming/pull/103
105+
resource_group_name = azurerm_resource_group.this.name
106+
container_app_environment_resource_id = azapi_resource.managed_environment.id
107+
108+
workload_profile_name = ""
109+
container_app = {
110+
name = "pythonapp"
111+
configuration = {
112+
dapr = {
113+
enabled = true
114+
appId = "pythonapp"
106115
}
107-
template = {
108-
containers = [{
109-
image = "dapriosamples/hello-k8s-python:latest"
110-
name = "hello-k8s-python"
111-
resources = {
112-
cpu = 0.5
113-
memory = "1.0Gi"
114-
}
115-
}]
116-
scale = {
117-
minReplicas = 1
118-
maxReplicas = 1
116+
}
117+
template = {
118+
containers = [{
119+
image = "dapriosamples/hello-k8s-python:latest"
120+
name = "hello-k8s-python"
121+
resources = {
122+
cpu = 0.5
123+
memory = "1.0Gi"
119124
}
125+
}]
126+
scale = {
127+
minReplicas = 1
128+
maxReplicas = 1
120129
}
121-
}]
130+
}
131+
}
122132
}

examples/default/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module "container_app" {
5656
container_app_environment_resource_id = azurerm_container_app_environment.this.id
5757
5858
workload_profile_name = "Consumption"
59-
container_apps = {
59+
container_app = {
6060
name = "helloworld"
6161
configuration = {
6262
ingress = {

examples/default/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module "container_app" {
5050
container_app_environment_resource_id = azurerm_container_app_environment.this.id
5151

5252
workload_profile_name = "Consumption"
53-
container_apps = {
53+
container_app = {
5454
name = "helloworld"
5555
configuration = {
5656
ingress = {

main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ resource "azapi_resource" "container_app" {
1717
body = jsonencode({
1818
properties = {
1919
configuration = {
20-
activeRevisionsMode = try(var.container_apps.revision_mode, "Single")
21-
dapr = try(var.container_apps.dapr, null)
22-
ingress = try(var.container_apps.ingress, null)
23-
maxInactiveRevisions = try(var.container_apps.maxInactiveRevisions, null)
24-
registries = try(var.container_apps.registries, null)
25-
secrets = try(var.container_apps.secrets, null)
26-
service = try(var.container_apps.service, null)
20+
activeRevisionsMode = try(var.container_app.revision_mode, "Single")
21+
dapr = try(var.container_app.dapr, null)
22+
ingress = try(var.container_app.ingress, null)
23+
maxInactiveRevisions = try(var.container_app.maxInactiveRevisions, null)
24+
registries = try(var.container_app.registries, null)
25+
secrets = try(var.container_app.secrets, null)
26+
service = try(var.container_app.service, null)
2727
}
2828
environmentId = var.container_app_environment_resource_id
29-
template = var.container_apps.template
29+
template = var.container_app.template
3030
workloadProfileName = var.workload_profile_name
3131
}
3232
})

variables.containerapps.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ variable "workload_profile_name" {
3232
default = null
3333
}
3434

35-
variable "container_apps" {
35+
variable "container_app" {
3636
description = "Specifies the container apps in the managed environment."
3737
type = object({
3838
name = string

0 commit comments

Comments
 (0)