-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using the Power Platform Terraform provider (v3.8.0) with environments that are members of an Environment Group with rules, Terraform crashes during the Read operation of ManagedEnvironmentResource. The provider process exits with exit status 2, causing Terraform to fail with Plugin did not respond errors.
This issue occurs consistently after assigning environments to an Environment Group with rules. Before that, the same configuration worked without errors.
This is my current understanding about the issue.
Sample Terraform Code
resource "powerplatform_managed_environment" "managed_development" {
environment_id = powerplatform_environment.development.id
is_usage_insights_disabled = true
is_group_sharing_disabled = true
limit_sharing_mode = "ExcludeSharingToSecurityGroups"
max_limit_user_sharing = 10
solution_checker_mode = "None"
suppress_validation_emails = true
maker_onboarding_markdown = "this is example markdown"
maker_onboarding_url = "https://www.microsoft.com"
}
REMINDER: REMOVE SENSITIVE DATA SUCH AS SECRETS, USER NAMES, EMAILS, TENANT INFORMATION, ETC.
Expected behavior
The provider should not panic.
ManagedEnvironmentResource.Read should handle environments in Environment Groups gracefully, either by:
- Returning valid state, or
- Returning a clear error message without crashing.
Error
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ReadDataSource call. The plugin logs may contain
│ more details.
╵
Stack trace from the terraform-provider-power-platform_v3.8.0 plugin:
panic: runtime error: slice bounds out of range [:1] with length 0
goroutine 134 [running]:
github.com/microsoft/terraform-provider-power-platform/internal/services/managed_environment.(*ManagedEnvironmentResource).Read(0xc000410e40, {0x117ac58?, 0xc000834f00?}, {{{{0x1180890, 0xc00091cc90}, {0xe8b8e0, 0xc00091c9f0}}, {0x1183718, 0xc00089b310}}, 0x0, ...}, ...)
github.com/microsoft/terraform-provider-power-platform/internal/services/managed_environment/resource_managed_environment.go:234 +0xb45
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadResource(0xc000378008, {0x117ac58, 0xc000834f00}, 0xc0008365a0, 0xc0005f15d8)
github.com/hashicorp/[email protected]/internal/fwserver/server_readresource.go:156 +0xbae
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadResource(0xc000378008, {0x117ac58?, 0xc000834e10?}, 0xc000836500)
github.com/hashicorp/[email protected]/internal/proto6server/server_readresource.go:71 +0x592
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc00033a0a0, {0x117ac58?, 0xc000834630?}, 0xc0000f07e0)
github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:860 +0x2f3
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0xfa8e60, 0xc00033a0a0}, {0x117ac58, 0xc000834630}, 0xc000904000, 0x0)
github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:651 +0x1a9
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000374000, {0x117ac58, 0xc0008345a0}, 0xc00041aa80, 0xc00032bbf0, 0x186e018, 0x0)
google.golang.org/[email protected]/server.go:1405 +0x1036
google.golang.org/grpc.(*Server).handleStream(0xc000374000, {0x117b6c0, 0xc00015e000}, 0xc00041aa80)
google.golang.org/[email protected]/server.go:1815 +0xb88
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1035 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 35
google.golang.org/[email protected]/server.go:1046 +0x11d
Error: The terraform-provider-power-platform_v3.8.0 plugin crashed!
System Information
- Provider Version: v3.8.0
- Terraform Version: v1.12.2
Additional context
- Issue started immediately after assigning environments to an Environment Group with rules.
- Removing the environment from the group did not help.
- Logs captured with TF_LOG=TRACE and TF_LOG_PATH enabled (available on request).
- Panic occurs at resource_managed_environment.go:234 with slice bounds out of range [:1] with length 0.
- Report drafted with AI, validated by me.
- I think it is kind of logical the settings do not work when environment group is defined as the settings are greyed out even in the portal.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working