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

SCALRCORE-31246: Add RunScheduleRule resource #323

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Conversation

lyzohub
Copy link
Contributor

@lyzohub lyzohub commented Jun 21, 2024

Changelog

Documentation

  • I have updated resource/data source documentation in docs

State

  • My changes affect the state
  • I have included a state migration and a unit test for it

@lyzohub lyzohub changed the title SCALRCORE-31246 SCALRCORE-31246: Add RunScheduleRule resource Jun 21, 2024
@lyzohub lyzohub force-pushed the SCALRCORE-31246 branch 3 times, most recently from 27d303f to 30e3ebe Compare June 25, 2024 09:11
@@ -95,7 +95,7 @@ go mod edit -dropreplace github.com/scalr/go-scalr

To update the go-scalr version:
```sh
go get github.com/scalr/go-scalr@develop
go get github.com/scalr/go-scalr@master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Required: true,
},
"schedule_mode": {
Description: "Mode of the scheduled run. (\"apply\", \"destroy\", \"refresh\")",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "Mode of the scheduled run. (\"apply\", \"destroy\", \"refresh\")",
Description: "Mode of the scheduled run (\"apply\", \"destroy\", \"refresh\").",


// Get and check the workspace.
if workspaceID, ok := d.GetOk("workspace_id"); ok {
ws, err := scalrClient.Workspaces.ReadByID(ctx, workspaceID.(string))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Provider should not be doing this validation, it's an API responsibility
  • workspace_id is a required attribute, there is no need in d.GetOk() check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Provider should not be doing this validation, it's an API responsibility

@lyzohub The request is still there.

id := d.Id()
if d.HasChange("schedule") || d.HasChange("schedule_mode") {
opts := scalr.RunScheduleRuleUpdateOptions{
ID: id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would skip setting ID here to avoid confusion — keep only updatable attributes.

go.sum Outdated
github.com/scalr/go-scalr v0.0.0-20240620130121-1e510532b379 h1:MP3OOBJmXwNRM0vv2ocrio+Q06+zMF9CtfuPgaoO7Qk=
github.com/scalr/go-scalr v0.0.0-20240620130121-1e510532b379/go.mod h1:p34SHb25YRvbgft7SUjSDYESeoQhWzAlxGXId/BbaSE=
github.com/scalr/go-scalr v0.0.0-20240621143826-3720e9e9274f h1:qwB5rLRDA6alyD/Yg3ln57FBJNejRdHJd+9VaB9lRcE=
github.com/scalr/go-scalr v0.0.0-20240621143826-3720e9e9274f/go.mod h1:p34SHb25YRvbgft7SUjSDYESeoQhWzAlxGXId/BbaSE=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run go mod tidy to clean up the old hashes.

@lyzohub lyzohub force-pushed the SCALRCORE-31246 branch 2 times, most recently from 038c4e4 to 79de1a4 Compare June 25, 2024 12:16
@lyzohub lyzohub merged commit ed977b7 into master Jul 2, 2024
8 checks passed
@lyzohub lyzohub deleted the SCALRCORE-31246 branch July 2, 2024 11:46
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.

None yet

2 participants