summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-02-28 09:59:02 +0100
committerMike Vink <mike1994vink@gmail.com>2023-02-28 10:14:29 +0100
commit32cb7f4cdcdc08557dde388c89b08606f50a1929 (patch)
tree7fa3954298ea3b8afe668cbd2603fd0ed0a2307e
parentca38e7bad17a5e3831877bb7888607fb94ce8ecb (diff)
fix: Remove import
Current import forced recreate of resource if exactly one of ref_commit_id, ref_tag, ref_branch was given. This is a bit contradicting with the schema. Probably we can add better import that also supports setting ref_tag, ref_branch or ref_commit_id manually using import expression. Something like this is also done in github_branch: <repository_id>:<name>:<ref_(commit_id | tag | branch)> Not sure if necessary. I'll remove import for now I think and maybe make another issue.
-rw-r--r--azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go7
-rw-r--r--azuredevops/internal/service/git/resource_git_repository_branch.go11
2 files changed, 0 insertions, 18 deletions
diff --git a/azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go b/azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go
index 6a4db19a..5a56f18d 100644
--- a/azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go
+++ b/azuredevops/internal/acceptancetests/resource_git_repository_branch_test.go
@@ -38,13 +38,6 @@ func TestAccGitRepoBranch_CreateAndUpdate(t *testing.T) {
resource.TestCheckResourceAttrSet("azuredevops_git_repository_branch.from_commit_id", "last_commit_id"),
),
},
- // Test import branch created from ref, ignore fields set only on create
- {
- ResourceName: "azuredevops_git_repository_branch.from_master",
- ImportState: true,
- ImportStateVerify: true,
- ImportStateVerifyIgnore: []string{"ref_branch", "ref_tag", "ref_commit_id"},
- },
// Test replace/update branch when name changes
{
Config: hclGitRepoBranches(projectName, gitRepoName, "Clean", branchNameChanged),
diff --git a/azuredevops/internal/service/git/resource_git_repository_branch.go b/azuredevops/internal/service/git/resource_git_repository_branch.go
index 86a97643..4066f872 100644
--- a/azuredevops/internal/service/git/resource_git_repository_branch.go
+++ b/azuredevops/internal/service/git/resource_git_repository_branch.go
@@ -26,9 +26,6 @@ func ResourceGitRepositoryBranch() *schema.Resource {
CreateContext: resourceGitRepositoryBranchCreate,
ReadContext: resourceGitRepositoryBranchRead,
DeleteContext: resourceGitRepositoryBranchDelete,
- Importer: &schema.ResourceImporter{
- StateContext: resourceGitRepositoryBranchImport,
- },
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
@@ -215,14 +212,6 @@ func resourceGitRepositoryBranchDelete(ctx context.Context, d *schema.ResourceDa
return nil
}
-func resourceGitRepositoryBranchImport(ctx context.Context, d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
- _, _, err := tfhelper.ParseGitRepoBranchID(d.Id())
- if err != nil {
- return nil, err
- }
- return []*schema.ResourceData{d}, nil
-}
-
func updateRefs(clients *client.AggregatedClient, args git.UpdateRefsArgs) (*[]git.GitRefUpdateResult, error) {
updateRefResults, err := clients.GitReposClient.UpdateRefs(clients.Ctx, args)
if err != nil {