Skip to content

Cron Trigger Duplicated When You Try to Modify it #99

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

Closed
korenyoni opened this issue Dec 29, 2022 · 0 comments · Fixed by #100
Closed

Cron Trigger Duplicated When You Try to Modify it #99

korenyoni opened this issue Dec 29, 2022 · 0 comments · Fixed by #100
Labels
bug Something isn't working

Comments

@korenyoni
Copy link
Contributor

When you try to modify the cron trigger from terraform, it creates a new trigger with the new settings but doesn't delete the old one.

Details:

Add a cron trigger and try to update it:

Terraform will perform the following actions:

  # codefresh_pipeline_cron_trigger.test will be updated in-place
  ~ resource "codefresh_pipeline_cron_trigger" "test" {
      ~ expression  = "*/1 * * * 1" -> "*/1 * * * 2"
        id          = "cron:codefresh:*/1 * * * 1:Example Cron Trigger:53be2183993e"
        # (2 unchanged attributes hidden)
    }

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

Apply:

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

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

  Enter a value: yes

codefresh_pipeline_cron_trigger.test: Modifying... [id=cron:codefresh:*/1 * * * 1:Example Cron Trigger:53be2183993e]
codefresh_pipeline_cron_trigger.test: Modifications complete after 1s [id=cron:codefresh:*/1 * * * 2:Example Cron Trigger:53be2183993e]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Two cron triggers now exist in the pipeline:

image
image
image

Expected Behavior:

Cron trigger object modified

Current behavior:

A new cron trigger is created, but the old one isn’t deleted.

@korenyoni korenyoni added the bug Something isn't working label Dec 29, 2022
korenyoni added a commit that referenced this issue Dec 29, 2022
…igger Testing (#100)

## What

* Add Cron Trigger plan-time validation
* Fix Cron Trigger updating (force replacement of resource on any
change, because there is no update verb in the cron trigger API)
* Improve Cron Trigger Testing
* Misc: remove use of "Hermes" service name in Provider logs. While
accurate in the [API
docs](https://g.codefresh.io/api/#tag/Triggers-Events), this may cause
unnecessary confusion to users of the Terraform provider.

## Why

* Updating a Cron Trigger results in duplicates
* No plan-time validation on Cron Triggers

## Notes

* Closes #99 
* Closes #98 
* Adding a `minor` label because now we have plan-validation, which can
potentially break existing cron trigger configurations in Terraform)

Co-authored-by: Yonatan Koren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant