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

harbor_project resource updates storage_quota in state file although no change is made in Harbor #470

Closed
nasseredine opened this issue Oct 1, 2024 · 0 comments · Fixed by #471

Comments

@nasseredine
Copy link
Contributor

Describe the bug
Using a robot account with the provider results in the storage_quota from harbor_project resource being updated in the Terraform state although no change is made in Harbor. No error is thrown.

To Reproduce

  1. Create a robot account regardless of its permissions.

  2. Export environnent variables:

export HARBOR_USERNAME=<harbor-robot-account-name>
export HARBOR_PASSWORD=<harbor-robot-account-password>
export HARBOR_URL=<harbor-url>
  1. Write a main.tf configuration file:
terraform {
  required_providers {
    harbor = {
      source  = "goharbor/harbor"
      version = "3.10.15"
    }
  }
}

resource "harbor_project" "foo" {
  name          = "foo"
  storage_quota = 1
}
  1. Initiliaze Terraform working dir and create the foo project with a storage_quota of 1:
terraform init
terraform apply --auto-approve
  1. Update the storage_quota value to 2 and apply the changes:
sed -rE 's/^(\s+storage_quota\s*=) [0-9]+$/\1 2/g' -i main.tf
terraform apply --auto-approve
  1. Verify the storage_quota in the Terraform state file and compare the value with the one in Harbor Project Quotas:
cat terraform.tfstate | grep storage_quota

Expected behavior

  • Terraform apply command must result in a failure with an error message.
  • The storage_quota must not be updated in the Terraform state.

Additional context
Robot account permissions are limited and don't allow the update of a quota. See issue: goharbor/harbor#20076 (comment)
Only admin user accounts can update the quota

  • Provider Version 3.10.15
  • Terraform Version 1.9.6
  • Harbor Version 2.10.0
@nasseredine nasseredine changed the title **harbor_project** resource updates storage_quota in state file although no change is made in Harbor harbor_project resource updates storage_quota in state file although no change is made in Harbor Oct 1, 2024
nasseredine added a commit to nasseredine/terraform-provider-harbor that referenced this issue Oct 11, 2024
nasseredine added a commit to nasseredine/terraform-provider-harbor that referenced this issue Oct 11, 2024
nasseredine added a commit to nasseredine/terraform-provider-harbor that referenced this issue Oct 11, 2024
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

Successfully merging a pull request may close this issue.

1 participant