Skip to content

Commit f6458ce

Browse files
committed
More fixups to azure terraform config
Signed-off-by: Mark Rossetti <[email protected]>
1 parent afb3b0b commit f6458ce

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

infra/azure/terraform/capz/capz-monitoring/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ resource "azurerm_kubernetes_cluster" "capz-monitoring" {
9090

9191
lifecycle {
9292
ignore_changes = [
93-
"linux_profile",
93+
linux_profile,
9494
]
9595
}
9696
}

infra/azure/terraform/capz/cluster-api-gallery/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "azurerm_resource_group" "cluster-api-gallery" {
2828
name = var.resource_group_name
2929
tags = {
3030
DO-NOT-DELETE = "UpstreamInfra"
31-
creationTimestamp = "2024-10-24T00:00:00Z"
31+
creationTimestamp = "2024-10-03T15:53:21Z"
3232
}
3333
}
3434

@@ -39,8 +39,9 @@ resource "azurerm_shared_image_gallery" "community_gallery" {
3939
name = "community_gallery"
4040
resource_group_name = "cluster-api-gallery"
4141
tags = {
42-
creationTimestamp = "2024-10-24T00:00:00Z"
42+
creationTimestamp = "2024-10-24T17:36:37Z"
4343
jobName = "image-builder-sig-ubuntu-2404"
44+
DO-NOT-DELETE = "UpstreamInfra"
4445
}
4546
sharing {
4647
permission = "Community"

infra/azure/terraform/capz/identities/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ variable "container_registry_scope" {
3030
type = string
3131
}
3232

33+
variable "e2eprivate_registry_scope" {
34+
type = string
35+
}
36+
3337
resource "azurerm_user_assigned_identity" "cloud_provider_user_identity" {
3438
name = "cloud-provider-user-identity"
3539
location = var.location

infra/azure/terraform/capz/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ module "identities" {
102102
location = var.location
103103
subscription_id = data.azurerm_client_config.current.subscription_id
104104
container_registry_scope = module.container_registry.container_registry_id
105+
e2eprivate_registry_scope = module.container_registry.e2eprivate_registry_id
105106
depends_on = [
106107
azurerm_resource_group.capz_ci
107108
]
@@ -127,7 +128,8 @@ module "role_assignments" {
127128
source = "./role-assignments"
128129
resource_group_name = var.resource_group_name
129130
container_registry_scope = module.container_registry.container_registry_id
130-
#storage_account_scope = azurerm_storage_account.k8sprowstorage.id
131+
e2eprivate_registry_scope = module.container_registry.e2eprivate_registry_id
132+
cloud_provider_user_identity_id = module.identities.cloud_provider_user_identity_id
131133
subscription_id = data.azurerm_client_config.current.subscription_id
132134
key_vault_id = module.key_vault.key_vault_id
133135
depends_on = [

infra/azure/terraform/capz/role-assignments/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ variable "subscription_id" {
2828
type = string
2929
}
3030

31+
variable "e2eprivate_registry_scope" {
32+
type = string
33+
}
34+
35+
variable "cloud_provider_user_identity_id" {
36+
type = string
37+
}
38+
3139
variable "key_vault_id" {
3240
type = string
3341
}
@@ -42,6 +50,12 @@ resource "azurerm_role_assignment" "rg_contributor" {
4250
scope = "/subscriptions/${var.subscription_id}"
4351
}
4452

53+
resource "azurerm_role_assignment" "rg_contributor_cloud_provider" {
54+
principal_id = var.cloud_provider_user_identity_id
55+
role_definition_name = "Contributor"
56+
scope = "/subscriptions/${var.subscription_id}"
57+
}
58+
4559
resource "azurerm_role_assignment" "storage_blob_data_contributor" {
4660
principal_id = data.azuread_service_principal.az_service_principal.object_id
4761
role_definition_name = "Storage Blob Data Contributor"
@@ -54,6 +68,12 @@ resource "azurerm_role_assignment" "acr_pull" {
5468
scope = var.container_registry_scope
5569
}
5670

71+
resource "azurerm_role_assignment" "acr_pull_private" {
72+
principal_id = var.cloud_provider_user_identity_id
73+
role_definition_name = "AcrPull"
74+
scope = var.e2eprivate_registry_scope
75+
}
76+
5777
resource "azurerm_role_definition" "custom_role" {
5878
name = "WriteAccessOnly"
5979
scope = "/subscriptions/${var.subscription_id}"

0 commit comments

Comments
 (0)