Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/unreleased/fixed-20250724-183507.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: fixed
body: Fixed provider configuration and dependency errors in powerplatform_enterprise_policy example
time: 2025-07-24T18:35:07.514075242Z
custom:
Issue: "718"
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
terraform {
required_version = "> 1.7.0"
required_providers {
powerplatform = {
source = "microsoft/power-platform"
version = "~>3.0"
}
azapi = {
source = "azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
time = {
source = "hashicorp/time"
}
}
}

Expand Down Expand Up @@ -195,3 +202,7 @@ output "enterprise_policy_system_id" {
output "enterprise_policy_id" {
value = azapi_resource.powerplatform_policy.output.id
}

output "enterprise_policy_resource" {
value = powerplatform_enterprise_policy.encryption
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
terraform {
required_version = "> 1.7.0"
required_providers {
powerplatform = {
source = "microsoft/power-platform"
version = "~>3.0"
}
azapi = {
source = "azure/azapi"
version = "~>2.2.0"
Expand Down Expand Up @@ -74,6 +78,15 @@ variable "enterprise_policy_location" {
}
}

variable "managed_environment_id" {
description = "The ID of the managed environment that this policy depends on"
type = string
validation {
condition = length(var.managed_environment_id) > 0
error_message = "The managed environment ID must not be empty"
}
}

resource "azurerm_resource_group" "resource_group" {
name = var.resource_group_name
location = var.resource_group_location
Expand Down Expand Up @@ -149,7 +162,7 @@ resource "powerplatform_enterprise_policy" "network_injection" {
system_id = azapi_resource.powerplatform_policy.output.properties.systemId
policy_type = "NetworkInjection"

depends_on = [powerplatform_managed_environment.managed_development]
depends_on = [azapi_resource.powerplatform_policy]
}

output "enterprise_policy_system_id" {
Expand All @@ -159,3 +172,7 @@ output "enterprise_policy_system_id" {
output "enterprise_policy_id" {
value = azapi_resource.powerplatform_policy.output.id
}

output "enterprise_policy_resource" {
value = powerplatform_enterprise_policy.network_injection
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ module "network_injection" {

should_register_provider = false

environment_id = powerplatform_environment.example_environment.id
environment_id = powerplatform_environment.example_environment.id
managed_environment_id = powerplatform_managed_environment.managed_development.id

resource_group_name = "rg_example_network_injection_policy"
resource_group_location = local.europe_location[0].azure_regions[0]
Expand All @@ -94,5 +95,5 @@ module "encryption" {
keyvault_name = "kv-ep-example8"

// let's wait for first policy to be executed
depends_on = [powerplatform_enterprise_policy.network_injection]
depends_on = [module.network_injection]
}
Loading