Skip to content

Commit ba862ee

Browse files
author
radomarina
committed
feat: 1.2.0 - update provider blocks
1 parent 10611c0 commit ba862ee

File tree

6 files changed

+45
-28
lines changed

6 files changed

+45
-28
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ provider "azuread" {
6969
7070
provider "azurerm" {
7171
features {}
72+
alias = "deployment_subscription"
7273
client_id = var.client_id
7374
client_secret = var.client_secret
7475
tenant_id = var.tenant_id
@@ -77,7 +78,10 @@ provider "azurerm" {
7778
}
7879
7980
module "firefly_azure" {
80-
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.1.0"
81+
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.2.0"
82+
providers = {
83+
azurerm.deployment_subscription = azurerm.deployment_subscription
84+
}
8185
8286
client_id = var.client_id
8387
client_secret = var.client_secret
@@ -105,7 +109,7 @@ Use this option if you want to integrate Firefly with specific Azure subscriptio
105109

106110
```hcl
107111
module "firefly_azure_subscription_1" {
108-
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.1.0"
112+
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.2.0"
109113
110114
client_id = var.client_id
111115
client_secret = var.client_secret
@@ -128,7 +132,7 @@ module "firefly_azure_subscription_1" {
128132
129133
# For additional subscriptions, create new modules and reference existing resources
130134
module "firefly_azure_subscription_2" {
131-
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.1.0"
135+
source = "github.com/gofireflyio/terraform-firefly-azure-onboarding?ref=v1.2.0"
132136
133137
# ... (similar configuration as above)
134138

eventdriven.tf

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
resource "azurerm_resource_group" "current" {
22
count = var.eventdriven_enabled && var.existing_resource_group_name == "" ? 1 : 0
3+
provider = azurerm.deployment_subscription
34
location = var.location
45
name = "${module.naming.resource_group.name}-${var.prefix}firefly${var.suffix}"
56
tags = local.tags
67
}
78

89
resource "azurerm_storage_account" "current" {
910
count = var.eventdriven_enabled && var.existing_storage_account_id == "" ? 1 : 0
11+
provider = azurerm.deployment_subscription
1012
account_replication_type = "LRS"
1113
cross_tenant_replication_enabled = false
1214
account_tier = "Standard"
1315
location = var.location
1416
name = "${module.naming.storage_account.name}${var.prefix != "" ? regex("\\w+", var.prefix) : ""}firefly${var.suffix != "" ? regex("\\w+", var.suffix) : ""}"
1517
resource_group_name = local.resource_group_name
18+
tags = local.tags
1619
dynamic "network_rules" {
1720
for_each = var.enforce_storage_network_rules ? [1] : []
1821
content {
1922
default_action = "Deny"
20-
ip_rules = var.firefly_eips
23+
ip_rules = var.firefly_eips
2124
}
2225
}
23-
tags = local.tags
2426
}
2527

2628
resource "azurerm_eventgrid_system_topic" "current" {
2729
count = var.eventdriven_enabled && var.existing_eventgrid_topic_name == "" ? 1 : 0
30+
provider = azurerm.deployment_subscription
2831
name = "${module.naming.eventgrid_topic.name}-${var.prefix}firefly${var.suffix}"
2932
location = var.location
3033
resource_group_name = local.resource_group_name
@@ -35,6 +38,7 @@ resource "azurerm_eventgrid_system_topic" "current" {
3538

3639
resource "azurerm_eventgrid_system_topic_event_subscription" "current" {
3740
count = var.eventdriven_enabled && var.existing_eventgrid_topic_name == "" ? 1 : 0
41+
provider = azurerm.deployment_subscription
3842
name = "${module.naming.eventgrid_event_subscription.name}-${var.prefix}firefly${var.suffix}"
3943
resource_group_name = local.resource_group_name
4044
system_topic = local.eventgrid_system_topic_name
@@ -52,7 +56,9 @@ resource "azurerm_eventgrid_system_topic_event_subscription" "current" {
5256
}
5357

5458
resource "azurerm_role_definition" "FireflyStorageAccountBlobReader" {
55-
count = var.eventdriven_enabled ? 1 : 0
59+
count = var.eventdriven_enabled ? 1 : 0
60+
provider = azurerm.deployment_subscription
61+
5662
name = "${module.naming.role_definition.name}-${var.prefix}FireflyStorageAccountBlobReader-${var.subscription_id}${var.suffix}"
5763
scope = "/subscriptions/${var.subscription_id}"
5864
description = "Firefly's requested permissions"
@@ -68,7 +74,9 @@ resource "azurerm_role_definition" "FireflyStorageAccountBlobReader" {
6874
}
6975

7076
resource "azurerm_role_assignment" "FireflyStorageAccountBlobReader" {
71-
count = var.eventdriven_enabled ? 1 : 0
77+
count = var.eventdriven_enabled ? 1 : 0
78+
provider = azurerm.deployment_subscription
79+
7280
principal_id = azuread_service_principal.current.id
7381
role_definition_name = azurerm_role_definition.FireflyStorageAccountBlobReader[0].name
7482
scope = "/subscriptions/${var.subscription_id}"
@@ -93,6 +101,7 @@ EOT
93101

94102
resource "azurerm_monitor_diagnostic_setting" "current" {
95103
for_each = var.eventdriven_enabled ? local.kv_filtered_subscriptions : {}
104+
provider = azurerm.deployment_subscription
96105
name = "${module.naming.monitor_diagnostic_setting.name}-${var.prefix}firefly${each.key}${var.suffix}"
97106
target_resource_id = "/subscriptions/${each.key}"
98107
storage_account_id = local.storage_account_id

locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ locals {
1515
}
1616

1717
module "naming" {
18-
source = "Azure/naming/azurerm"
18+
source = "Azure/naming/azurerm"
1919
}

permission.tf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,37 @@ resource "azuread_service_principal_password" "current" {
1818

1919
resource "azurerm_role_assignment" "BillingReader" {
2020
principal_id = azuread_service_principal.current.object_id
21+
provider = azurerm.deployment_subscription
2122
role_definition_name = "Billing Reader"
2223
scope = local.scope
2324
}
2425

2526
resource "azurerm_role_assignment" "Reader" {
2627
principal_id = azuread_service_principal.current.object_id
28+
provider = azurerm.deployment_subscription
2729
role_definition_name = "Reader"
2830
scope = local.scope
2931
}
3032

3133
resource "azurerm_role_assignment" "AppConfigurationDataReader" {
32-
principal_id = azuread_service_principal.current.object_id
34+
principal_id = azuread_service_principal.current.object_id
35+
provider = azurerm.deployment_subscription
36+
3337
role_definition_name = "App Configuration Data Reader"
3438
scope = local.scope
3539
}
3640

3741
resource "azurerm_role_assignment" "SecurityReader" {
38-
principal_id = azuread_service_principal.current.object_id
42+
principal_id = azuread_service_principal.current.object_id
43+
provider = azurerm.deployment_subscription
44+
3945
role_definition_name = "Security Reader"
4046
scope = local.scope
4147
}
4248

4349
resource "azurerm_role_definition" "Firefly" {
4450
name = "${module.naming.role_definition.name}-${var.prefix}Firefly${var.suffix}"
51+
provider = azurerm.deployment_subscription
4552
scope = local.scope
4653
description = "Firefly's requested permissions"
4754

@@ -67,7 +74,9 @@ resource "azurerm_role_definition" "Firefly" {
6774
}
6875

6976
resource "azurerm_role_assignment" "Firefly" {
70-
principal_id = azuread_service_principal.current.object_id
77+
principal_id = azuread_service_principal.current.object_id
78+
provider = azurerm.deployment_subscription
79+
7180
role_definition_name = azurerm_role_definition.Firefly.name
7281
scope = local.scope
7382
}

providers.tf

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
terraform {
22
required_providers {
33
azurerm = {
4-
source = "hashicorp/azurerm"
5-
version = "4.3.0"
4+
source = "hashicorp/azurerm"
5+
version = "4.3.0"
6+
configuration_aliases = [azurerm.deployment_subscription]
67
}
78
azuread = {
89
source = "hashicorp/azuread"
@@ -11,17 +12,11 @@ terraform {
1112
}
1213
}
1314

14-
# provider "azuread" {
15-
# client_id = var.client_id
16-
# client_secret = var.client_secret
17-
# tenant_id = var.tenant_id
18-
# }
19-
#
20-
# provider "azurerm" {
21-
# features {}
22-
# client_id = var.client_id
23-
# client_secret = var.client_secret
24-
# tenant_id = var.tenant_id
25-
# subscription_id = var.subscription_id
26-
# resource_provider_registrations = "none"
27-
# }
15+
provider "azurerm" {
16+
features {}
17+
client_id = var.client_id
18+
client_secret = var.client_secret
19+
tenant_id = var.tenant_id
20+
subscription_id = var.subscription_id
21+
resource_provider_registrations = "none"
22+
}

vars.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ variable "client_secret" {
111111
}
112112

113113
variable "enforce_storage_network_rules" {
114-
type = bool
114+
type = bool
115115
default = false
116116
}
117117

0 commit comments

Comments
 (0)