Skip to content

Commit cf5e22f

Browse files
feat: Terraform module changes for Service Layer infra (#184)
1 parent b94c08e commit cf5e22f

File tree

13 files changed

+75
-45
lines changed

13 files changed

+75
-45
lines changed

.github/actions/scan-vulnerabilities/action.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ runs:
5252
echo "${SCAN_RESULTS}" | grep -i "${SEVERITY}" || echo "No ${SEVERITY} vulnerabilities found."
5353
} | tee -a "vulnerabilities/${VULNERABILITIES_SUMMARY_LOGFILE}"
5454
done
55+
5556
- name: Upload vulnerabilities report
5657
uses: actions/upload-artifact@v4
5758
with:

.github/workflows/stage-3-build.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,14 @@ jobs:
255255
name: Aggregate reports
256256
runs-on: ubuntu-latest
257257
needs: [build-and-push, containers-to-build]
258-
env:
259-
PR_NUM_TAG: ${{ needs.containers-to-build.outputs.pr_num_tag }}
260258
steps:
261259
- name: Get all artifacts
262260
uses: actions/download-artifact@v4
263261
with:
264-
path: reports-${{ needs.containers-to-build.outputs.pr_num_tag }}
262+
path: aggregated-reports
265263

266264
- name: Aggregate reports
267265
uses: actions/upload-artifact@v4
268266
with:
269267
name: aggregated-reports-${{ needs.containers-to-build.outputs.pr_num_tag }}
270-
path: reports-${{ needs.containers-to-build.outputs.pr_num_tag }}
268+
path: aggregated-reports

infrastructure/modules/acme-certificate/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ A Terraform module to obtain a publicly trusted SSL certificate from the Let's E
99
- Automates [DNS-01 challenges](https://letsencrypt.org/docs/challenge-types/) via the [Lego azuredns](https://go-acme.github.io/lego/dns/azuredns/) provider.
1010
- Handles Lego's requirement for authoritative NS records on the leaf zone. e.g. if you need a certificate for `www.private.example.com` but only have a zone for `example.com`, you can use CNAME redirection (see examples below).
1111
- CNAME redirection of DNS challenge records, including optional creation of corresponding CNAMEs in Azure Private DNS zones to satisfy Lego's local checks (wildcards supported).
12-
- Stores certificates in Azure Key Vault as Certificate objects.
12+
- Stores the issued certificate in Azure Key Vault as a Certificate object.
1313
- Also stores the certificate as a `.pfx` file in a base64-encoded Key Vault Secret with a strong randomised password, for compatibility with consumers that cannot use Certificate objects.
14-
- Supports multiple subscriptions (e.g. hub/spoke models).
14+
- Supports multiple subscriptions (e.g. hub/spoke solution designs).
1515
- Supports multiple Azure regions.
1616

1717
## Example Usage

infrastructure/modules/container-app-environment/tfdocs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Default: `"UK South"`
4242

4343
### <a name="input_private_dns_zone_rg_name"></a> [private\_dns\_zone\_rg\_name](#input\_private\_dns\_zone\_rg\_name)
4444

45-
Description: Name of the hub resource group where the private DNS zone is located. This is only required if adding custom DNS records, for instance when hosting container apps with an HTTP ingress..
45+
Description: Name of the hub resource group where the private DNS zone is located. This is only required if adding custom DNS records, for instance when hosting container apps with an HTTP ingress.
4646

4747
Type: `string`
4848

infrastructure/modules/function-app/main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ resource "azurerm_linux_function_app" "function_app" {
2121
# }
2222

2323
identity {
24-
type = "SystemAssigned, UserAssigned"
25-
identity_ids = var.assigned_identity_ids
24+
type = length(var.assigned_identity_ids) > 0 ? "SystemAssigned, UserAssigned" : "SystemAssigned"
25+
identity_ids = length(var.assigned_identity_ids) > 0 ? var.assigned_identity_ids : null
2626
}
2727

2828
site_config {
@@ -75,6 +75,11 @@ resource "azurerm_linux_function_app" "function_app" {
7575
storage_uses_managed_identity = var.storage_uses_managed_identity
7676

7777
tags = var.tags
78+
79+
# To prevent Terraform removing 'hidden-link:' tagging created automatically by AzureRM
80+
lifecycle {
81+
ignore_changes = [tags]
82+
}
7883
}
7984

8085
/* --------------------------------------------------------------------------------------------------

infrastructure/modules/function-app/tfdocs.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ Description: The login server for the Azure Container Registry.
1010

1111
Type: `string`
1212

13-
### <a name="input_acr_mi_client_id"></a> [acr\_mi\_client\_id](#input\_acr\_mi\_client\_id)
14-
15-
Description: The Managed Identity Id for the Azure Container Registry.
16-
17-
Type: `any`
18-
1913
### <a name="input_ai_connstring"></a> [ai\_connstring](#input\_ai\_connstring)
2014

2115
Description: The App Insights connection string.
@@ -40,18 +34,6 @@ Description: The ID of the AppServicePlan.
4034

4135
Type: `string`
4236

43-
### <a name="input_assigned_identity_ids"></a> [assigned\_identity\_ids](#input\_assigned\_identity\_ids)
44-
45-
Description: The list of User Assigned Identity IDs to assign to the Function App.
46-
47-
Type: `list(string)`
48-
49-
### <a name="input_cont_registry_use_mi"></a> [cont\_registry\_use\_mi](#input\_cont\_registry\_use\_mi)
50-
51-
Description: Should connections for Azure Container Registry use Managed Identity.
52-
53-
Type: `any`
54-
5537
### <a name="input_function_app_name"></a> [function\_app\_name](#input\_function\_app\_name)
5638

5739
Description: Name of the Function App
@@ -145,6 +127,14 @@ Type: `bool`
145127

146128
The following input variables are optional (have default values):
147129

130+
### <a name="input_acr_mi_client_id"></a> [acr\_mi\_client\_id](#input\_acr\_mi\_client\_id)
131+
132+
Description: The Managed Identity Id for the Azure Container Registry.
133+
134+
Type: `any`
135+
136+
Default: `null`
137+
148138
### <a name="input_always_on"></a> [always\_on](#input\_always\_on)
149139

150140
Description: Should the Function App be always on. Override standard default.
@@ -161,6 +151,22 @@ Type: `map`
161151

162152
Default: `{}`
163153

154+
### <a name="input_assigned_identity_ids"></a> [assigned\_identity\_ids](#input\_assigned\_identity\_ids)
155+
156+
Description: The list of User Assigned Identity IDs to assign to the Function App.
157+
158+
Type: `list(string)`
159+
160+
Default: `[]`
161+
162+
### <a name="input_cont_registry_use_mi"></a> [cont\_registry\_use\_mi](#input\_cont\_registry\_use\_mi)
163+
164+
Description: Should connections for Azure Container Registry use Managed Identity.
165+
166+
Type: `bool`
167+
168+
Default: `false`
169+
164170
### <a name="input_cors_allowed_origins"></a> [cors\_allowed\_origins](#input\_cors\_allowed\_origins)
165171

166172
Description: n/a

infrastructure/modules/function-app/variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ variable "acr_login_server" {
55

66
variable "acr_mi_client_id" {
77
description = "The Managed Identity Id for the Azure Container Registry."
8+
default = null
89
}
910

1011
variable "ai_connstring" {
@@ -41,10 +42,12 @@ variable "asp_id" {
4142
variable "assigned_identity_ids" {
4243
type = list(string)
4344
description = "The list of User Assigned Identity IDs to assign to the Function App."
45+
default = []
4446
}
4547

4648
variable "cont_registry_use_mi" {
4749
description = "Should connections for Azure Container Registry use Managed Identity."
50+
default = false
4851
}
4952

5053
variable "cors_allowed_origins" {

infrastructure/modules/service-bus-subscription/tfdocs.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ Description: The name of the Service Bus namespace.
1616

1717
Type: `string`
1818

19-
### <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name)
20-
21-
Description: The name of the resource group containing the Service Bus namespace.
22-
23-
Type: `string`
24-
2519
### <a name="input_service_bus_namespace_id"></a> [service\_bus\_namespace\_id](#input\_service\_bus\_namespace\_id)
2620

2721
Description: The ID of the Service Bus namespace resource for role assignment scope.
@@ -34,7 +28,7 @@ Description: The name of the Service Bus subscription.
3428

3529
Type: `string`
3630

37-
### <a name="input_topic_name"></a> [topic\_name](#input\_topic\_name)
31+
### <a name="input_topic_id"></a> [topic\_id](#input\_topic\_id)
3832

3933
Description: The name of the Service Bus topic.
4034

@@ -52,14 +46,6 @@ Type: `number`
5246

5347
Default: `10`
5448

55-
### <a name="input_tags"></a> [tags](#input\_tags)
56-
57-
Description: A map of tags to assign to the subscription.
58-
59-
Type: `map(string)`
60-
61-
Default: `{}`
62-
6349

6450
## Resources
6551

infrastructure/modules/service-bus/tfdocs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,16 @@ The following outputs are exported:
132132

133133
Description: n/a
134134

135+
### <a name="output_namespace_name"></a> [namespace\_name](#output\_namespace\_name)
136+
137+
Description: n/a
138+
135139
### <a name="output_servicebus_connection_string"></a> [servicebus\_connection\_string](#output\_servicebus\_connection\_string)
136140

141+
Description: n/a
142+
143+
### <a name="output_topic_ids"></a> [topic\_ids](#output\_topic\_ids)
144+
137145
Description: n/a
138146
## Resources
139147

infrastructure/modules/storage/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ resource "azurerm_storage_container" "container" {
3030
container_access_type = each.value.container_access_type
3131
}
3232

33+
resource "azurerm_storage_queue" "queue" {
34+
for_each = var.queues != null ? toset(var.queues) : toset([])
35+
36+
name = each.value
37+
storage_account_name = azurerm_storage_account.storage_account.name
38+
}
39+
40+
3341
/* --------------------------------------------------------------------------------------------------
3442
Private Endpoint Configuration
3543
-------------------------------------------------------------------------------------------------- */

0 commit comments

Comments
 (0)