Skip to content

harness_platform_gitops_repo_cred broken when i modify the identifier. #1342

Description

@mara1346

I am using Terraform provider version 0.41.3.

This is an example code to show the error

resource "harness_platform_gitops_repo_cred" "test" {
  identifier = "ABC"
  # account_id = "account_id"
  agent_id   = "ABC"
  project_id = "ABC"
  org_id     = "ABC"
  creds {
    type            = "git"
    url             = "ABC"
    username = "username"
    password = "password!"
  }
}

When I apply the above code, it works fine, and a template credential works fine.

when i modify the identifier from identifier = "ABC" to identifier = "XYZ" terraform realizes there is a change should happen. But it doesn't work as expected.

That's what happens:

Terraform will perform the following actions:

  # harness_platform_gitops_repo_cred.test will be updated in-place
  ~ resource "harness_platform_gitops_repo_cred" "test" {
        id         = "ABC"
      ~ identifier = "ABC" -> "XYZ"
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions in workspace "ABC"?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

harness_platform_gitops_repo_cred.test: Modifying... [id=ABC]
╷
│ Error: resource with ID **ABC** not found: Unable to find repository credentials with identifier **XYZ**

Then, when I revert the change, moving the identifier from XYZ to ABC, and do terraform apply, that will add a new resource; it should just say no infrastructure changes.

And when it tries to add the resource, it fails because there is already a credential template with ABC.

To summarize this:

  • Changing the identifier fails even though we can change that from the portal. At the portal, it is called credential template name.
  • When I revert the code, it acts as if I am trying to create a new resource with the same name, and it fails.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions