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

Fix retention_policy.schedule empty state #373

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

dmitry-g
Copy link
Contributor

@dmitry-g dmitry-g commented Sep 8, 2023

  • Save empty string to the state when no schedule is given

Having a harbor_retention_policy resource with an empty schedule (which matches None schedule in Harbor UI), provider tries to update it on every terraform apply execution:

# harbor_retention_policy.retention_policy[0] will be updated in-place
~ resource "harbor_retention_policy" "retention_policy" {
      id       = "/retentions/1"
    - schedule = "None" -> ""
}

This happens because the state is saved as "None" and desired state is actually an empty string.

"schedule": "None",

With the fix applied terraform stops updating the state on every run:

harbor_retention_policy.retention_policy[0]: Refreshing state... [id=/retentions/1]
No changes. Your infrastructure matches the configuration.

and saves the schedule as an empty string:

"schedule": "",

@dmitry-g dmitry-g requested a review from a team as a code owner September 8, 2023 16:21
@flbla
Copy link
Contributor

flbla commented Sep 18, 2023

Hi,
thank you!
LGTM.

could you please fix the DCO : https://github.com/goharbor/terraform-provider-harbor/pull/373/checks?check_run_id=16623349353. thanks.

 - Save empty string to the state when no schedule is given

Signed-off-by: Dmitry G <[email protected]>
@dmitry-g dmitry-g force-pushed the fix/retention_policy_schedule_none branch from 73cea0b to 5fb8b58 Compare September 19, 2023 12:15
@dmitry-g
Copy link
Contributor Author

Hi @flbla, sorry, forgot to add it. Fixed, thank you

@flbla flbla merged commit d9ed110 into goharbor:main Sep 26, 2023
3 of 10 checks passed
@dmitry-g dmitry-g deleted the fix/retention_policy_schedule_none branch September 26, 2023 12:31
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 this pull request may close these issues.

2 participants