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

TtlSchedule and DriftSchedule - pulumi refresh loses schedule ID so update adds schedule #257

Closed
MitchellGerdisch opened this issue Apr 24, 2024 · 2 comments
Assignees
Labels
bug-bash-candidate kind/bug Some behavior is incorrect or out of spec
Milestone

Comments

@MitchellGerdisch
Copy link

What happened?

I have a stack with a TtlSchedule resource and DriftSchedule resource.
If I run pulumi refresh -y the schedules' ids are removed from state.
So, if change the resource (say modify the time or cron) a subsequent pulumi up creates additional schedules.

Example

  • Use your favorite pulumi (python) program/stack with deployments configured and add the code below.
  • pulumi up -y
  • See the two schedules that were created.
  • pulumi refresh -y
    • Note that schedule Ids were removed from state
  • Modify the two schedule resources by modifying the time or cron properties
  • pulumi up -y
  • In Pulumi Cloud UI see that there are now two of each type of schedule instead of just modifying the original schedules.
org = pulumi.get_organization()
project = pulumi.get_project()
stack = pulumi.get_stack()

ttlSchedule = ps.TtlSchedule("ttlsched", 
                             organization=org,
                             project=project,
                             stack=stack,
                             timestamp="2024-07-01T00:00:00Z",
                             delete_after_destroy=False)

driftSchedule = ps.DriftSchedule("driftsched", 
                             organization=org,
                             project=project,
                             stack=stack,
                             schedule_cron="0 * * * *") 

Output of pulumi about

CLI
Version 3.113.3
Go Version go1.22.2
Go Compiler gc

Plugins
KIND NAME VERSION
resource aws 6.32.0
resource pulumiservice 0.20.0
language python unknown
resource stackmgmt 3.1.0

Host
OS darwin
Version 13.6.6
Arch x86_64

This project is written in python: version='3.10.11'

Backend
Name pulumi.com

Dependencies:
NAME VERSION
pequod-stackmgmt 3.1.0
pip 23.0.1
pulumi_aws 6.32.0
setuptools 65.5.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@MitchellGerdisch MitchellGerdisch added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 24, 2024
@MitchellGerdisch
Copy link
Author

MitchellGerdisch commented Apr 24, 2024

This also appears to cause issues with destroy

pulumiservice:index:TtlSchedule (ttlsched):
    error: failed to delete schedule with scheduleId  : failed to parse response body, status code 404: invalid character 'p' after top-level value

It requires state surgery to remove the TTL schedule URN.

@IaroslavTitov IaroslavTitov self-assigned this Apr 24, 2024
@cleverguy25 cleverguy25 removed the needs-triage Needs attention from the triage team label Apr 25, 2024
@cleverguy25 cleverguy25 added this to the 0.104 milestone Apr 25, 2024
IaroslavTitov added a commit that referenced this issue May 6, 2024
### Summary
- Fixing 2 bugs:
- [First](#257) is
me forgetting to add scheduleId to output properties on Read
- Second one I discovered while working on the first one, when booleans
are not provided, they are still saved to output state, which causes
eternal diff when running pulumi update. Not sure how I missed that
originally.

### Testing
- make build and install
- Tested locally using Dotnet SDK
@IaroslavTitov
Copy link
Contributor

This is fixed in pull request, resolving the issue. We will do a new release of the provider this week, so that the change will be live. Resolving the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-bash-candidate kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

3 participants