Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceGroup Mandatroy Tags Azure Policy #500

Open
Romiko opened this issue May 10, 2024 · 2 comments
Open

ResourceGroup Mandatroy Tags Azure Policy #500

Romiko opened this issue May 10, 2024 · 2 comments

Comments

@Romiko
Copy link

Romiko commented May 10, 2024

If we try to create a resource group in a subscription with an Azure Policy requiring mandatory tags for the resource group, it will fail. Seems Azapi is doing a two stage create / update. Possible fix is to apply tags upon creation?

Workaround - Use AzureRM instead of Azap.

##[error]Bash wrote one or more lines to the standard error stream.
##[error]2024-05-09T23:11:30.191Z [ERROR] provider.terraform-provider-azapi_v1.13.1: Response contains error diagnostic: tf_provider_addr=registry.terraform.io/Azure/azapi tf_resource_type=azapi_resource @caller=github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="creating/updating Resource: (ResourceId "/subscriptions/xyz/resourceGroups/rg-xyz-test-001" / Api Version "2021-04-01"): PUT https://management.azure.com/subscriptions/xyz/resourceGroups/rg-xyz-test-001

RESPONSE 403: 403 Forbidden
ERROR CODE: RequestDisallowedByPolicy

@Romiko
Copy link
Author

Romiko commented May 10, 2024

The cause is from another module.

@ms-henglu
Copy link
Collaborator

Hi @Romiko ,

Thank you for taking time to report this issue!

The cause is from another module.

Does this mean that you have found the cause? The azapi_resource is able to create the resource in one PUT request, the tags should be in the request body if specified in the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants