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

Plan for harbor_robot_account always shows changes after upgrade #495

Open
BlueIce opened this issue Feb 10, 2025 · 3 comments
Open

Plan for harbor_robot_account always shows changes after upgrade #495

BlueIce opened this issue Feb 10, 2025 · 3 comments

Comments

@BlueIce
Copy link

BlueIce commented Feb 10, 2025

Describe the bug
When planing, a change is always shown for harbor_robot_account resource.

To Reproduce

  1. Create harbor_robot_account with provider version 3.10.18 (or lower)
  2. Upgrade to provider version 3.10.19
  3. Do a planing
  4. Observe changes in the plan

Applying the changes and doing a planing again will show the same changes again.

I tested with this configuration:

resource "harbor_robot_account" "project_robot" {
  name        = "test-robot"
  description = "project level robot account for testing"
  level       = "project"
  permissions {
    kind      = "project"
    namespace = "test-project"

    access {
      action   = "read"
      resource = "project"
    }
    access {
      action   = "update"
      resource = "project"
    }
    access {
      action   = "read"
      resource = "repository"
    }
    access {
      action   = "list"
      resource = "repository"
    }
  }
}

The plan looks like this:

14:25:36.312 STDOUT tofu: OpenTofu used the selected providers to generate the following execution
14:25:36.312 STDOUT tofu: plan. Resource actions are indicated with the following symbols:
14:25:36.312 STDOUT tofu:   ~ update in-place
14:25:36.312 STDOUT tofu: OpenTofu will perform the following actions:
14:25:36.312 STDOUT tofu:   # harbor_robot_account.project_robot will be updated in-place
14:25:36.312 STDOUT tofu:   ~ resource "harbor_robot_account" "project_robot" {
14:25:36.312 STDOUT tofu:         id          = "/robots/xxxxx"
14:25:36.312 STDOUT tofu:         name        = "test-robot"
14:25:36.312 STDOUT tofu:         # (7 unchanged attributes hidden)
14:25:36.312 STDOUT tofu:       - permissions {
14:25:36.312 STDOUT tofu:           - kind      = "project" -> null
14:25:36.312 STDOUT tofu:           - namespace = "test-project" -> null
14:25:36.313 STDOUT tofu:           - access {
14:25:36.313 STDOUT tofu:               - action   = "list" -> null
14:25:36.313 STDOUT tofu:               - effect   = "allow" -> null
14:25:36.313 STDOUT tofu:               - resource = "repository" -> null
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           - access {
14:25:36.313 STDOUT tofu:               - action   = "read" -> null
14:25:36.313 STDOUT tofu:               - effect   = "allow" -> null
14:25:36.313 STDOUT tofu:               - resource = "project" -> null
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           - access {
14:25:36.313 STDOUT tofu:               - action   = "read" -> null
14:25:36.313 STDOUT tofu:               - effect   = "allow" -> null
14:25:36.313 STDOUT tofu:               - resource = "repository" -> null
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           - access {
14:25:36.313 STDOUT tofu:               - action   = "update" -> null
14:25:36.313 STDOUT tofu:               - effect   = "allow" -> null
14:25:36.313 STDOUT tofu:               - resource = "project" -> null
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:         }
14:25:36.313 STDOUT tofu:       + permissions {
14:25:36.313 STDOUT tofu:           + kind      = "project"
14:25:36.313 STDOUT tofu:           + namespace = "test-project"
14:25:36.313 STDOUT tofu:           + access {
14:25:36.313 STDOUT tofu:               + action   = "list"
14:25:36.313 STDOUT tofu:               + resource = "repository"
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           + access {
14:25:36.313 STDOUT tofu:               + action   = "read"
14:25:36.313 STDOUT tofu:               + resource = "project"
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           + access {
14:25:36.313 STDOUT tofu:               + action   = "read"
14:25:36.313 STDOUT tofu:               + resource = "repository"
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:           + access {
14:25:36.313 STDOUT tofu:               + action   = "update"
14:25:36.313 STDOUT tofu:               + resource = "project"
14:25:36.313 STDOUT tofu:             }
14:25:36.313 STDOUT tofu:         }
14:25:36.313 STDOUT tofu:     }
14:25:36.313 STDOUT tofu: Plan: 0 to add, 1 to change, 0 to destroy.

Expected behavior
No changes are shown when planing

Additional context
When creating the same robot account directly with version 3.10.19, no change is shown when doing a plan and everything seems to be fine.
This could be related to the handling of effect which was changed in #494.

Another way to get rid of the changes in the plan seems to be to explicitly set effect = "allow".

  • Provider Version 3.10.19
  • OpenTofu Version 1.9.0
  • Harbor Version 2.11.2
@yeswexav
Copy link

yeswexav commented Feb 11, 2025

Same problem with

  • Provider Version 3.10.19
  • Terraform Version 1.10.5
  • Harbor Version 2.11.2

@flbla
Copy link
Contributor

flbla commented Feb 11, 2025

Okay
Thank you for the bug report.
I had to do this to handle the creation of robots accounts from a robot account.
Does an apply fix it ?

@BlueIce
Copy link
Author

BlueIce commented Feb 11, 2025

No, unfortunately not. After apply, the next plan shows the same changes again.

I found two workarounds:

  1. Either explicitly set effect = "allow"
  2. Or delete the robot account and recreate it (with version 3.10.19)

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

No branches or pull requests

3 participants