microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 279 forks source link

Changing `resource_id` of `azuredevops_securityrole_assignment` should force recreation #1198

Closed alexanderlinne closed 4 weeks ago

alexanderlinne commented 1 month ago

Community Note

Terraform (and Azure DevOps Provider) Version

Affected Resource(s)

Terraform Configuration Files

resource "azuredevops_serviceendpoint_azurerm" "this" {
  […]
  service_endpoint_authentication_scheme = …
  […]
}

resource "azuredevops_securityrole_assignment" "this" {
  scope        = "distributedtask.serviceendpointrole"
  resource_id = resource.azuredevops_serviceendpoint_azurerm.this.id
  identity_id = …
  role_name   = "User"
}

Debug Output

Panic Output

Expected Behavior

When changing the service_endpoint_authentication_scheme both the azuredevops_serviceendpoint_azurerm and azuredevops_securityrole_assignment are planned for recreation.

Actual Behavior

The azuredevops_serviceendpoint_azurerm is planned for recreation, but the provider plans to update the azuredevops_securityrole_assignment in-place. During apply, the service endpoint gets destroyed and the update of the security role assignment fails since the service endpoint no longer exists.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

alexanderlinne commented 1 month ago

I think the same goes for scope and identity_id, changing them should probably also force a recreation of the resource.