Skip to content

Commit

Permalink
feat: upgrade minimum terraform provider versions
Browse files Browse the repository at this point in the history
one key change in azurerm is that service principals now need to be
referenced by object_id for assignment instead of by id because
the provider changed the internal format
  • Loading branch information
JohannesRudolph committed Nov 25, 2024
1 parent eb74afd commit 0508b04
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 31 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Upgraded minimum terraform provider versions

## [v0.10.0]

### Added
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ Before opening a Pull Request, please do the following:
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 1.1 |
| <a name="requirement_azapi"></a> [azapi](#requirement\_azapi) | >=1.13.1 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=2.46.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=3.81.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=3.0.2 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=4.11.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.5.0 |
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | >=3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >=4.11.0 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.81.0"
version = ">=4.11.0"
}
azuread = {
source = "hashicorp/azuread"
version = ">=2.46.0"
version = ">=3.0.2"
}
azapi = {
source = "Azure/azapi"
Expand Down
4 changes: 2 additions & 2 deletions modules/meshcloud-mca-service-principal/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.81.0"
version = ">=4.11.0"
}
azuread = {
source = "hashicorp/azuread"
version = ">=2.46.0"
version = ">=3.0.2"
}
azapi = {
source = "Azure/azapi"
Expand Down
10 changes: 5 additions & 5 deletions modules/meshcloud-metering-service-principal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 1.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=2.46.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=3.81.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=3.0.2 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=4.11.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.5.0 |
| <a name="provider_time"></a> [time](#provider\_time) | 0.12.1 |
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | >=3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >=4.11.0 |
| <a name="provider_time"></a> [time](#provider\_time) | n/a |

## Modules

Expand Down
6 changes: 3 additions & 3 deletions modules/meshcloud-metering-service-principal/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.81.0"
version = ">=4.11.0"
}
azuread = {
source = "hashicorp/azuread"
version = ">=2.46.0"
version = ">=3.0.2"
}
}
}
Expand All @@ -22,7 +22,7 @@ resource "azurerm_role_assignment" "meshcloud_metering" {
for_each = toset(var.assignment_scopes)
scope = each.key
role_definition_name = "Cost Management Reader"
principal_id = azuread_service_principal.meshcloud_metering.id
principal_id = azuread_service_principal.meshcloud_metering.object_id
depends_on = [azuread_service_principal.meshcloud_metering]
}

Expand Down
2 changes: 1 addition & 1 deletion modules/meshcloud-metering-service-principal/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "credentials" {
description = "Service Principal application id and object id"
value = {
Enterprise_Application_Object_ID = azuread_service_principal.meshcloud_metering.id
Enterprise_Application_Object_ID = azuread_service_principal.meshcloud_metering.object_id
Application_Client_ID = azuread_application.meshcloud_metering.client_id
Client_Secret = var.create_password ? "Execute `terraform output metering_service_principal_password` to see the password" : "No password was created"
}
Expand Down
10 changes: 5 additions & 5 deletions modules/meshcloud-replicator-service-principal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 1.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=2.46.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=3.81.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=3.0.2 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=4.11.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.5.0 |
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | >=3.0.2 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >=4.11.0 |
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
| <a name="provider_time"></a> [time](#provider\_time) | 0.12.1 |
| <a name="provider_time"></a> [time](#provider\_time) | n/a |

## Modules

Expand Down
10 changes: 5 additions & 5 deletions modules/meshcloud-replicator-service-principal/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.81.0"
version = ">=4.11.0"
}
azuread = {
source = "hashicorp/azuread"
version = ">=2.46.0"
version = ">=3.0.2"
}
}
}
Expand Down Expand Up @@ -187,20 +187,20 @@ resource "azurerm_role_assignment" "meshcloud_replicator" {
for_each = toset(var.assignment_scopes)
scope = each.key
role_definition_id = azurerm_role_definition.meshcloud_replicator.role_definition_resource_id
principal_id = azuread_service_principal.meshcloud_replicator.id
principal_id = azuread_service_principal.meshcloud_replicator.object_id
}

resource "azurerm_role_assignment" "meshcloud_replicator_subscription_canceler" {
for_each = toset(var.can_cancel_subscriptions_in_scopes)
scope = each.key
role_definition_id = azurerm_role_definition.meshcloud_replicator_subscription_canceler.role_definition_resource_id
principal_id = azuread_service_principal.meshcloud_replicator.id
principal_id = azuread_service_principal.meshcloud_replicator.object_id
}

resource "azurerm_role_assignment" "meshcloud_replicator_rg_deleter" {
for_each = toset(var.can_delete_rgs_in_scopes)
scope = each.key
principal_id = azuread_service_principal.meshcloud_replicator.id
principal_id = azuread_service_principal.meshcloud_replicator.object_id

# The azurerm provider requires this must be a scoped id, so unfortuantely we need to construct the id of the role
# definition at the assignment scope in order to make this stable for subsequent terraform apply's.
Expand Down
2 changes: 1 addition & 1 deletion modules/meshcloud-replicator-service-principal/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "credentials" {
description = "Service Principal application id and object id"
value = {
Enterprise_Application_Object_ID = azuread_service_principal.meshcloud_replicator.id
Enterprise_Application_Object_ID = azuread_service_principal.meshcloud_replicator.object_id
Application_Client_ID = azuread_application.meshcloud_replicator.client_id
Client_Secret = var.create_password ? "Execute `terraform output replicator_service_principal_password` to see the password" : "No password was created"
}
Expand Down
4 changes: 2 additions & 2 deletions modules/meshcloud-sso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 1.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=2.46.0 |
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | >=3.0.2 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 3.0.2 |
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | >=3.0.2 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/meshcloud-sso/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = ">=2.46.0"
version = ">=3.0.2"
}
}
}
Expand Down

0 comments on commit 0508b04

Please sign in to comment.