Skip to content

Commit aa46c60

Browse files
authored
Merge pull request #143 from EventTriangle/AZ400-306
AZ400-306. Move ACR to separate resource group
2 parents c6945cd + dcc3e7c commit aa46c60

10 files changed

Lines changed: 29 additions & 17 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec
1616
- HELM deployment pipelines
1717
- Terraform infrastructure provision azure pipelines
1818
- Cloudflare DNS automation using PowerShell
19+
- Move ACR to separate resource group

build/auth-azure-pipelines-acr-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ stages:
5050
shouldRunUnitTests: 'false'
5151
shouldRunIntegrationTests: 'false'
5252
integrationTestsProjectPath: ''
53-
dockerRegistryUrl: 'myaksacr$(library-prefix).azurecr.io'
53+
dockerRegistryUrl: 'azuredevopsacrd01.azurecr.io'
5454
dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/'
5555
imageRepository: 'auth-service'
5656
dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile'

build/consumer-azure-pipelines-acr-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ stages:
4949
unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj'
5050
shouldRunIntegrationTests: 'true'
5151
integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj'
52-
dockerRegistryUrl: 'myaksacr$(library-prefix).azurecr.io'
52+
dockerRegistryUrl: 'azuredevopsacrd01.azurecr.io'
5353
imageRepository: 'consumer-service'
5454
dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile'
5555
dockerServiceConnection: 'Azure_ACR_Connection'

build/sender-azure-pipelines-acr-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ stages:
4949
unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj'
5050
shouldRunIntegrationTests: 'true'
5151
integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj'
52-
dockerRegistryUrl: 'myaksacr$(library-prefix).azurecr.io'
52+
dockerRegistryUrl: 'azuredevopsacrd01.azurecr.io'
5353
imageRepository: 'sender-service'
5454
dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile'
5555
dockerServiceConnection: 'Azure_ACR_Connection'

terraform/locals.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
locals {
22
resource_group_name = "${var.resource_group_name}-${var.prefix}"
33
aks_name = "${var.cluster_name}-${var.prefix}"
4-
acr_name = "${var.acr_name}${var.prefix}"
54
prometheus_name = "prometheus-aks-${var.prefix}"
65
grafana_name = "grafana-aks-${var.prefix}"
76
workspace_name = "loganalytics-${var.prefix}"

terraform/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ module "aks" {
3434
module "acr" {
3535
count = var.should_deploy_acr ? 1 : 0
3636
source = "./modules/acr"
37-
acr_name = local.acr_name
37+
acr_name = var.acr_name
3838
aks_identity_principal_id = module.aks.principal_id
39-
resource_group_location = azurerm_resource_group.public.location
40-
resource_group_name = azurerm_resource_group.public.name
39+
resource_group_name = "rg-azure-devops-acr-d01"
4140

4241
depends_on = [
4342
module.aks

terraform/modules/acr/main.tf

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
resource "azurerm_container_registry" "acr" {
1+
# resource "azurerm_container_registry" "acr" {
2+
# name = var.acr_name
3+
# resource_group_name = var.resource_group_name
4+
# location = var.resource_group_location
5+
# sku = "Standard"
6+
# admin_enabled = true
7+
# }
8+
9+
data "azurerm_container_registry" "acr" {
210
name = var.acr_name
311
resource_group_name = var.resource_group_name
4-
location = var.resource_group_location
5-
sku = "Standard"
6-
admin_enabled = true
712
}
813

914
resource "azurerm_role_assignment" "role_acrpull" {
10-
scope = azurerm_container_registry.acr.id
15+
scope = data.azurerm_container_registry.acr.id
1116
role_definition_name = "AcrPull"
1217
principal_id = var.aks_identity_principal_id
1318
skip_service_principal_aad_check = true
19+
20+
depends_on = [data.azurerm_container_registry.acr]
1421
}

terraform/modules/acr/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ variable "resource_group_name" {
88
description = "The name of the Azure Resource Group"
99
}
1010

11-
variable "resource_group_location" {
12-
type = string
13-
description = "The location of the Azure Resource Group"
14-
}
11+
# variable "resource_group_location" {
12+
# type = string
13+
# description = "The location of the Azure Resource Group"
14+
# }
1515

1616
variable "aks_identity_principal_id" {
1717
type = string

terraform/modules/aks/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ resource "azurerm_kubernetes_cluster" "aks" {
1111
vm_size = var.default_node_pool_vm_size
1212
type = var.default_node_pool_type
1313
temporary_name_for_rotation = "rotationpool"
14+
15+
upgrade_settings {
16+
drain_timeout_in_minutes = 0
17+
max_surge = "10%"
18+
node_soak_duration_in_minutes = 0
19+
}
1420
}
1521

1622
identity {

terraform/terraform.auto.tfvars.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"should_deploy_acr": true,
1212
"should_deploy_log_analytics": true,
1313
"should_deploy_prometheus": true,
14-
"acr_name": "myaksacr",
14+
"acr_name": "azuredevopsacrd01",
1515
"subscription_id": "f32f6566-8fa0-4198-9c91-a3b8ac69e89a",
1616
"tenant_id": "b40a105f-0643-4922-8e60-10fc1abf9c4b",
1717
"client_id": "ab0a5dc1-ee52-4574-96e0-469f237928a6",

0 commit comments

Comments
 (0)