Skip to content

Commit bc2f729

Browse files
committed
Upgrade azurerm and azuread providers
- Includes changes to parameters that were deprecated. - Includes additions/modifications to the README file
1 parent 1997ca9 commit bc2f729

File tree

16 files changed

+181
-105
lines changed

16 files changed

+181
-105
lines changed

README.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ Tenant wide admin consent must be granted for a succesful meshPlatform setup. Th
1515

1616
## How to use this module
1717

18+
Prerequisites:
19+
20+
- [Azure CLI installed](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
21+
- [Terraform installed](https://learn.hashicorp.com/tutorials/terraform/install-cli)
22+
23+
### Using Azure Portal
24+
1825
1. Login into [Azure Portal](https://portal.azure.com/) with your Admin user.
1926

2027
2. Open a cloud shell.
2128

22-
3. Create a directory and change into it
29+
3. Create a directory and change into it
2330

2431
```sh
2532
mkdir terraform-azure-meshplatform
@@ -53,6 +60,34 @@ Tenant wide admin consent must be granted for a succesful meshPlatform setup. Th
5360
terraform output -json
5461
```
5562
63+
### Using CLI
64+
65+
1. Login with az CLI
66+
```sh
67+
az login --tenant TENANT_ID
68+
```
69+
2. Create a directory and change into it
70+
```sh
71+
mkdir terraform-azure-meshplatform
72+
cd terraform-azure-meshplatform
73+
```
74+
75+
3. Create a `main.tf` and an `output.tf` files in the created directory that references this module
76+
> Sample files can be found in [examples](./examples/basic-azure-integration)
77+
78+
4. Run
79+
80+
```sh
81+
terraform init
82+
terraform apply
83+
```
84+
85+
5. Access terraform output and pass it securely to meshcloud.
86+
87+
```sh
88+
# The JSON output contains sensitive values that must not be transmitted to meshcloud in plain text.
89+
terraform output -json
90+
```
5691
## Advanced Usage
5792
5893
The default case creates kraken, replicator and idplookup service principals.
@@ -61,8 +96,8 @@ The default case creates kraken, replicator and idplookup service principals.
6196
module "meshplatform" {
6297
source = "git@github.com:meshcloud/terraform-azure-meshplatform.git"
6398
64-
spp_name_suffix = "unique-name"
65-
mgmt_group_name = "management-group-name"
99+
spp_name_suffix = "UNIQUE_NAME"
100+
mgmt_group_name = "MANAGEMENT_GROUP_NAME|MANAGEMENT_GROUP_UUID"
66101
}
67102
```
68103
@@ -72,8 +107,8 @@ If UAMI blueprint user principal is needed, you also need to pass a list of subs
72107
module "meshplatform" {
73108
source = "git@github.com:meshcloud/terraform-azure-meshplatform.git"
74109
75-
spp_name_suffix = "unique-name"
76-
mgmt_group_name = "management-group-name"
110+
spp_name_suffix = "UNIQUE_NAME"
111+
mgmt_group_name = "MANAGEMENT_GROUP_NAME|MANAGEMENT_GROUP_UUID"
77112
78113
subscriptions = [
79114
"abcdefgh-abcd-efgh-abcd-abcdefgh1234"
@@ -87,8 +122,10 @@ module "meshplatform" {
87122
88123
| Name | Version |
89124
|------|---------|
90-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
91-
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.12.0 |
125+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
126+
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | 2.18.0 |
127+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.97.0 |
128+
| <a name="requirement_random"></a> [random](#requirement\_random) | 2.2.1 |
92129
93130
## Providers
94131
@@ -109,7 +146,7 @@ module "meshplatform" {
109146
110147
| Name | Type |
111148
|------|------|
112-
| [azurerm_management_group.root](https://registry.terraform.io/providers/hashicorp/azurerm/2.12.0/docs/data-sources/management_group) | data source |
149+
| [azurerm_management_group.root](https://registry.terraform.io/providers/hashicorp/azurerm/2.97.0/docs/data-sources/management_group) | data source |
113150
114151
## Inputs
115152
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# It is recommended to setup a backend to store the terraform state file
2+
# Removing the backend leads to terraform state output stored in the local filesystem.
3+
terraform {
4+
backend "gcs" {
5+
prefix = "meshplatforms/azure"
6+
bucket = "my-terraform-states"
7+
}
8+
}
9+
10+
module "meshplatform" {
11+
source = "git@github.com:meshcloud/terraform-azure-meshplatform.git"
12+
13+
spp_name_suffix = "UNIQUE_NAME"
14+
mgmt_group_name = "MANAGEMENT_GROUP_NAME|MANAGEMENT_GROUP_UUID"
15+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
output "replicator_spp" {
3+
description = "Replicator Service Principal."
4+
value = {
5+
output = module.meshplatform.replicator_spp
6+
}
7+
}
8+
9+
output "replicator_spp_password" {
10+
description = "Password for Replicator Service Principal."
11+
value = {
12+
password = module.meshplatform.replicator_spp_password
13+
}
14+
sensitive = true
15+
}
16+
17+
output "kraken_spp" {
18+
description = "Kraken Service Principal."
19+
value = {
20+
output = module.meshplatform.kraken_spp
21+
}
22+
}
23+
24+
output "kraken_spp_password" {
25+
description = "Password for Kraken Service Principal."
26+
value = {
27+
password = module.meshplatform.kraken_spp_password
28+
}
29+
sensitive = true
30+
}
31+
32+
output "uami_blueprint_user_principal" {
33+
description = "UAMI Blueprint Assignment Service Principal."
34+
value = {
35+
output = module.meshplatform.uami_blueprint_user_principal
36+
}
37+
}
38+
39+
output "uami_blueprint_user_principal_password" {
40+
description = "Password for UAMI Blueprint Assignment Service Principal."
41+
value = {
42+
password = module.meshplatform.uami_blueprint_user_principal_password
43+
}
44+
sensitive = true
45+
}

main.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
terraform {
2-
required_version = ">= 0.13"
2+
required_version = ">= 1.0"
33
required_providers {
44
azurerm = {
55
source = "hashicorp/azurerm"
6-
version = "2.12.0"
6+
version = "2.97.0"
7+
}
8+
random = {
9+
source = "hashicorp/random"
10+
version = "2.2.1"
11+
}
12+
azuread = {
13+
source = "hashicorp/azuread"
14+
version = "2.18.0"
715
}
816
}
9-
# Set backend here
1017
}
1118

1219
provider "azurerm" {

modules/meshcloud-idp-lookup-spp/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
| Name | Version |
44
|------|---------|
55
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
6-
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | 0.9.0 |
7-
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.12.0 |
6+
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | 2.18.0 |
7+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.97.0 |
88
| <a name="requirement_random"></a> [random](#requirement\_random) | 2.2.1 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 0.9.0 |
15-
| <a name="provider_random"></a> [random](#provider\_random) | 2.2.1 |
14+
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 2.18.0 |
1615

1716
## Modules
1817

@@ -22,10 +21,9 @@ No modules.
2221

2322
| Name | Type |
2423
|------|------|
25-
| [azuread_application.meshcloud_idp_lookup](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/application) | resource |
26-
| [azuread_service_principal.meshcloud_idp_lookup](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/service_principal) | resource |
27-
| [azuread_service_principal_password.spp_pw](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/service_principal_password) | resource |
28-
| [random_password.spp_pw](https://registry.terraform.io/providers/hashicorp/random/2.2.1/docs/resources/password) | resource |
24+
| [azuread_application.meshcloud_idp_lookup](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/application) | resource |
25+
| [azuread_service_principal.meshcloud_idp_lookup](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/service_principal) | resource |
26+
| [azuread_service_principal_password.spp_pw](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/service_principal_password) | resource |
2927

3028
## Inputs
3129

modules/meshcloud-idp-lookup-spp/module.tf

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@ terraform {
33
required_providers {
44
azurerm = {
55
source = "hashicorp/azurerm"
6-
version = "2.12.0"
6+
version = "2.97.0"
77
}
88
random = {
99
source = "hashicorp/random"
1010
version = "2.2.1"
1111
}
1212
azuread = {
1313
source = "hashicorp/azuread"
14-
version = "0.9.0"
14+
version = "2.18.0"
1515
}
1616
}
1717
}
1818

1919
resource "azuread_application" "meshcloud_idp_lookup" {
20-
name = "idplookup.${var.spp_name_suffix}"
21-
22-
oauth2_allow_implicit_flow = false
20+
display_name = "idplookup.${var.spp_name_suffix}"
2321

22+
web {
23+
implicit_grant {
24+
access_token_issuance_enabled = false
25+
}
26+
}
2427
required_resource_access {
2528
resource_app_id = "00000003-0000-0000-c000-000000000000" # Microsoft Graph
2629

@@ -48,15 +51,7 @@ resource "azuread_service_principal" "meshcloud_idp_lookup" {
4851
application_id = azuread_application.meshcloud_idp_lookup.application_id
4952
}
5053

51-
resource "random_password" "spp_pw" {
52-
length = 64
53-
# Currently there are some passwords which do not allow you to login using az cli (see https://github.com/Azure/azure-cli/issues/12332)
54-
# Which is the reason we have set the flag to false
55-
special = false
56-
}
57-
5854
resource "azuread_service_principal_password" "spp_pw" {
5955
service_principal_id = azuread_service_principal.meshcloud_idp_lookup.id
60-
value = random_password.spp_pw.result
6156
end_date = "2999-01-01T01:02:03Z" # no expiry
6257
}

modules/meshcloud-idp-lookup-spp/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ output "service_principal" {
1010
output "service_principal_password" {
1111
description = "Password for the Service Principal."
1212
value = {
13-
password = random_password.spp_pw.result
13+
password = azuread_service_principal_password.spp_pw.value
1414
}
1515
sensitive = true
1616
}

modules/meshcloud-kraken-spp/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
| Name | Version |
44
|------|---------|
55
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
6-
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | 0.9.0 |
7-
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.12.0 |
6+
| <a name="requirement_azuread"></a> [azuread](#requirement\_azuread) | 2.18.0 |
7+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 2.97.0 |
88
| <a name="requirement_random"></a> [random](#requirement\_random) | 2.2.1 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 0.9.0 |
15-
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 2.12.0 |
16-
| <a name="provider_random"></a> [random](#provider\_random) | 2.2.1 |
14+
| <a name="provider_azuread"></a> [azuread](#provider\_azuread) | 2.18.0 |
15+
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 2.97.0 |
1716

1817
## Modules
1918

@@ -23,13 +22,12 @@ No modules.
2322

2423
| Name | Type |
2524
|------|------|
26-
| [azuread_application.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/application) | resource |
27-
| [azuread_service_principal.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/service_principal) | resource |
28-
| [azuread_service_principal_password.spp_pw](https://registry.terraform.io/providers/hashicorp/azuread/0.9.0/docs/resources/service_principal_password) | resource |
29-
| [azurerm_role_assignment.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azurerm/2.12.0/docs/resources/role_assignment) | resource |
30-
| [azurerm_role_assignment.meshcloud_kraken_cloud_inventory](https://registry.terraform.io/providers/hashicorp/azurerm/2.12.0/docs/resources/role_assignment) | resource |
31-
| [azurerm_role_definition.meshcloud_kraken_cloud_inventory_role](https://registry.terraform.io/providers/hashicorp/azurerm/2.12.0/docs/resources/role_definition) | resource |
32-
| [random_password.spp_pw](https://registry.terraform.io/providers/hashicorp/random/2.2.1/docs/resources/password) | resource |
25+
| [azuread_application.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/application) | resource |
26+
| [azuread_service_principal.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/service_principal) | resource |
27+
| [azuread_service_principal_password.spp_pw](https://registry.terraform.io/providers/hashicorp/azuread/2.18.0/docs/resources/service_principal_password) | resource |
28+
| [azurerm_role_assignment.meshcloud_kraken](https://registry.terraform.io/providers/hashicorp/azurerm/2.97.0/docs/resources/role_assignment) | resource |
29+
| [azurerm_role_assignment.meshcloud_kraken_cloud_inventory](https://registry.terraform.io/providers/hashicorp/azurerm/2.97.0/docs/resources/role_assignment) | resource |
30+
| [azurerm_role_definition.meshcloud_kraken_cloud_inventory_role](https://registry.terraform.io/providers/hashicorp/azurerm/2.97.0/docs/resources/role_definition) | resource |
3331

3432
## Inputs
3533

modules/meshcloud-kraken-spp/module.tf

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ terraform {
33
required_providers {
44
azurerm = {
55
source = "hashicorp/azurerm"
6-
version = "2.12.0"
6+
version = "2.97.0"
77
}
88
random = {
99
source = "hashicorp/random"
1010
version = "2.2.1"
1111
}
1212
azuread = {
1313
source = "hashicorp/azuread"
14-
version = "0.9.0"
14+
version = "2.18.0"
1515
}
1616
}
1717
}
@@ -79,23 +79,21 @@ resource "azurerm_role_assignment" "meshcloud_kraken_cloud_inventory" {
7979
}
8080

8181
resource "azuread_application" "meshcloud_kraken" {
82-
name = "kraken.${var.spp_name_suffix}"
83-
oauth2_allow_implicit_flow = false
82+
display_name = "kraken.${var.spp_name_suffix}"
83+
84+
web {
85+
implicit_grant {
86+
access_token_issuance_enabled = false
87+
}
88+
}
89+
8490
}
8591

8692
resource "azuread_service_principal" "meshcloud_kraken" {
8793
application_id = azuread_application.meshcloud_kraken.application_id
8894
}
8995

90-
resource "random_password" "spp_pw" {
91-
length = 64
92-
# Currently there are some passwords which do not allow you to login using az cli (see https://github.com/Azure/azure-cli/issues/12332)
93-
# Which is the reason we have set the flag to false
94-
special = false
95-
}
96-
9796
resource "azuread_service_principal_password" "spp_pw" {
9897
service_principal_id = azuread_service_principal.meshcloud_kraken.id
99-
value = random_password.spp_pw.result
10098
end_date = "2999-01-01T01:02:03Z" # no expiry
10199
}

modules/meshcloud-kraken-spp/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ output "service_principal" {
1010
output "service_principal_password" {
1111
description = "Password for the Service Principal."
1212
value = {
13-
password = random_password.spp_pw.result
13+
password = azuread_service_principal_password.spp_pw.value
1414
}
1515
sensitive = true
1616
}

0 commit comments

Comments
 (0)