azuredevops_git_repository - allow disabling on destroy - #1580
Open
v-kenntan wants to merge 1 commit into
Open
Conversation
Member
|
Thanks for submitting this PR! In fact, I'm hesitated to merge this feature since this property is not a resource native property, but some "control" over the behavior of the resource. This kind of "control"-ish property can introduce other problems. For the original ask, I think the user would need to just do multiple steps to disable the repos and rm them from the state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Description
This PR adds a new property
disable_on_destroy, which allows the user to disable the repository instead of destroying it if it's removed from the terraform configuration. The currentdisableflag will only work if the config still includes the repository resource, and the resource is destroyed when it is removed from the config.disable_on_destroywould help with allowing the user to remove the resource in the configuration without destroying the repository.Does this introduce a breaking change?
Test Result
The tests seems to have racing conditions for the read and write, which means that it is inconsistent whenever it is run and will have different errors.
=== RUN TestAccGitRepository_DataSource === PAUSE TestAccGitRepository_DataSource === RUN TestAccGitRepository_DataSource_notExist === PAUSE TestAccGitRepository_DataSource_notExist === RUN TestAccGitRepository_withDefaultBranch === PAUSE TestAccGitRepository_withDefaultBranch === RUN TestAccGitRepository_update === PAUSE TestAccGitRepository_update === RUN TestAccGitRepository_disabled === PAUSE TestAccGitRepository_disabled === RUN TestAccGitRepository_disableOnDestroy --- PASS: TestAccGitRepository_disableOnDestroy (25.07s) === RUN TestAccGitRepository_disabledCannotUpdate === PAUSE TestAccGitRepository_disabledCannotUpdate === RUN TestAccGitRepository_incorrectInitialization === PAUSE TestAccGitRepository_incorrectInitialization === RUN TestAccGitRepository_importGitRepository === PAUSE TestAccGitRepository_importGitRepository === RUN TestAccGitRepository_import_by_name === PAUSE TestAccGitRepository_import_by_name === RUN TestAccGitRepository_initializationClean === PAUSE TestAccGitRepository_initializationClean === RUN TestAccGitRepository_uninitialized === PAUSE TestAccGitRepository_uninitialized === RUN TestAccGitRepository_forkBranchNotEmpty === PAUSE TestAccGitRepository_forkBranchNotEmpty === CONT TestAccGitRepository_DataSource --- PASS: TestAccGitRepository_DataSource (22.20s) === CONT TestAccGitRepository_incorrectInitialization --- PASS: TestAccGitRepository_incorrectInitialization (0.15s) === CONT TestAccGitRepository_forkBranchNotEmpty --- PASS: TestAccGitRepository_forkBranchNotEmpty (25.56s) === CONT TestAccGitRepository_uninitialized --- PASS: TestAccGitRepository_uninitialized (23.10s) === CONT TestAccGitRepository_initializationClean --- PASS: TestAccGitRepository_initializationClean (24.11s) === CONT TestAccGitRepository_import_by_name --- PASS: TestAccGitRepository_import_by_name (24.55s) === CONT TestAccGitRepository_importGitRepository --- PASS: TestAccGitRepository_importGitRepository (48.36s) === CONT TestAccGitRepository_update --- PASS: TestAccGitRepository_update (23.19s) === CONT TestAccGitRepository_disabledCannotUpdate resource_git_repository_test.go:176: Step 3/3 error: Error running apply: exit status 1 Error: Updating repository in Azure DevOps: TF401019: The Git repository with name or identifier b9a7f5fd-680b-4a5a-ba28-afbfd126cd7c does not exist or you do not have permissions for the operation you are attempting. with azuredevops_git_repository.test, on terraform_plugin_test.tf line 16, in resource "azuredevops_git_repository" "test": 16: resource "azuredevops_git_repository" "test" { --- FAIL: TestAccGitRepository_disabledCannotUpdate (25.56s) === CONT TestAccGitRepository_disabled --- PASS: TestAccGitRepository_disabled (25.34s) === CONT TestAccGitRepository_withDefaultBranch --- PASS: TestAccGitRepository_withDefaultBranch (34.09s) === CONT TestAccGitRepository_DataSource_notExist --- PASS: TestAccGitRepository_DataSource_notExist (21.67s) FAILTestAccGitRepository_disabledCannotUpdatewill suceed or fail depending on the race condition. The test is able to succeed after running it a couple more times.Related Issue(s)
Fix #1540