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

Provider not detecting azuredevops_branch_policy_build_validation has been deleted #330

Closed
tullydwyer opened this issue Mar 18, 2021 · 2 comments
Assignees
Labels

Comments

@tullydwyer
Copy link

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

Overview of issue

Hi there, if I manually delete a Build Validation created by Terraform it never detects that the build validation has been deleted, and never re-creates the build validation.

Terraform (and Azure DevOps Provider) Version

Terraform v0.14.7
+ provider registry.terraform.io/microsoft/azuredevops v0.1.2

Affected Resource(s)

  • azuredevops_branch_policy_build_validation

Terraform Configuration Files

resource "azuredevops_branch_policy_build_validation" "master_pr" {
  project_id = data.azuredevops_project.REDACTED.id

  enabled  = true
  blocking = true

  settings {
    display_name        = "Terraform-Plan-Validation"
    build_definition_id = azuredevops_build_definition.REDACTED.id
    valid_duration      = 720

    scope {
      repository_id  = data.azuredevops_git_repository.REDACTED.id
      repository_ref = "refs/heads/master"
      match_type     = "Exact"
    }
  }
}

Debug Output

Client project, can't provide debug.

Panic Output

Expected Behavior

Terraform should detect that the Build Validation has been manually deleted and re-create it.

Actual Behavior

State is refreshed and no changes are detected.

terraform apply
Acquiring state lock. This may take a few moments...
...
azuredevops_branch_policy_build_validation.master_pr: Refreshing state... [id=18]
...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Releasing state lock. This may take a few moments...

Steps to Reproduce

  1. terraform apply
  2. Manually delete the build validation in Azure DevOps.
  3. Run terraform plan or terraform apply again and there are no changes detected.

Important Factoids

I tried to taint the resource in Terraform and got the following error that the resource does not exist:

azuredevops_branch_policy_build_validation.master_pr: Destroying... [id=18]

Error: Error deleting policy in Azure DevOps: The policy configuration with ID '18' and revision '3' does not exist.

References

Kind regards,

@tullydwyer tullydwyer changed the title Provider not detecting resource has been deleted - azuredevops_branch_policy_build_validation Provider not detecting azuredevops_branch_policy_build_validation has been deleted Mar 18, 2021
@xuzhang3 xuzhang3 self-assigned this Mar 19, 2021
@xuzhang3
Copy link
Collaborator

Hi @tullydwyer Thanks for your feedback. Looks like ADO ignore the changes when compare the .tfstate and service response, need more investigation.

@xuzhang3
Copy link
Collaborator

Fixed in v0.1.3, closing this issue. Feel free to open another issue if you have questions.

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

No branches or pull requests

2 participants