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

Terraform fails when trying to assign a role to an Azure Web App #12194

Closed
giovannifl opened this issue Jun 13, 2021 · 3 comments
Closed

Terraform fails when trying to assign a role to an Azure Web App #12194

giovannifl opened this issue Jun 13, 2021 · 3 comments

Comments

@giovannifl
Copy link

While running Terraform to assign the "AcrPull" role ion Azure Container Registry to an Azure Web App, execution failes with the following error:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_role_assignment.acr_Pull, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker. 

Below there is the affected code:

data "azurerm_container_registry" "acr" {
  name                = var.acrName
  resource_group_name = var.acrRGName
}

resource "azurerm_role_assignment" "acr_Pull" {
  scope                = data.azurerm_container_registry.acr.id
  role_definition_name = "AcrPull"
  principal_id         = azurerm_app_service.wap.identity[0].principal_id
}

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v1.0.0
on linux_amd64

  • provider registry.terraform.io/hashicorp/azurerm v2.62.0

Affected Resource(s)

  • azurerm_container_registry
  • azurerm_role_assignment

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

data "azurerm_container_registry" "acr" {
name = var.acrName
resource_group_name = var.acrRGName
}

resource "azurerm_role_assignment" "acr_Pull" {
scope = data.azurerm_container_registry.acr.id
role_definition_name = "AcrPull"
principal_id = azurerm_app_service.wap.identity[0].principal_id
}

Debug Output

azurerm_role_assignment.acr_Pull: Creating...
azurerm_role_assignment.acr_Pull: Still creating... [10s elapsed]
azurerm_role_assignment.acr_Pull: Still creating... [20s elapsed]

│ Error: Provider produced inconsistent result after apply

│ When applying changes to azurerm_role_assignment.acr_Pull, provider "provider["registry.terraform.io/hashicorp/azurerm"]" produced an unexpected new value: Root resource was present, but now absent.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Panic Output

Expected Behaviour

Actual Behaviour

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@giovannifl giovannifl changed the title Terraform fails trying to assign a role to an Azure Web App Terraform fails when trying to assign a role to an Azure Web App Jun 13, 2021
@OmerLaza
Copy link

Hey @giovannifl
I just had this problem yesterday on #12195 and @tombuildsstuff helped me. It seems you'll need to upgrade your provider version to the newest v2.63.0 (or just v2.62.1) or downgrade to older version since there was a regression in v2.62.0.

Hope this will help 😄

@katbyte
Copy link
Collaborator

katbyte commented Jun 23, 2021

thanks @OmerLaza - as this has been fixed in 2.63 i'm going to close this

@katbyte katbyte closed this as completed Jun 23, 2021
@katbyte katbyte added this to the v2.62.1 milestone Jun 23, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants