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

feat(Deployments): support Parameters #245

Merged
merged 4 commits into from
Aug 21, 2024
Merged

Conversation

mitchnielsen
Copy link
Contributor

@mitchnielsen mitchnielsen commented Aug 20, 2024

Summary

Supports setting Parameters on Deployment resouces.

Related to #238

Testing

First, see that the acceptance tests passed ✅

Also tested manually:

terraform {
  required_providers {
    prefect = {
      source = "registry.terraform.io/prefecthq/prefect"
    }
  }
}

provider "prefect" {
  endpoint = "https://api.stg.prefect.dev"

  account_id   = "my-account-id"
  workspace_id = "<my-workspace-id>"

  api_key = "<my-api-key>"
}

resource "prefect_workspace" "workspace" {
  handle = "mitch-testing"
  name   = "mitch-testing"
}

resource "prefect_flow" "flow" {
  name         = "my-flow"
  workspace_id = prefect_workspace.workspace.id
  tags         = ["tf-test"]
}

resource "prefect_deployment" "deployment" {
  name                     = "my-deployment"
  description              = "string"
  workspace_id             = prefect_workspace.workspace.id
  flow_id                  = prefect_flow.flow.id
  entrypoint               = "hello_world.py:hello_world"
  tags                     = ["test"]
  enforce_parameter_schema = false
  manifest_path            = "./bar/foo"
  parameters               = jsonencode({ "some-parameter" : "some-value" })
  path                     = "./foo/bar"
  paused                   = false
  version                  = "v1.1.1"
  work_pool_name           = "mitch-testing-pool"
  work_queue_name          = "default"
}
$ go install
...

$ tf apply
...
image

Then I updated my config to add another field with an int and applied it, and ran a job:

image

Supports setting Parameters on Deployment resouces.

Related to #238
@mitchnielsen
Copy link
Contributor Author

Need #246 to unblock the tests.

Comment on lines +36 to +39
parameters = jsonencode({
"some-parameter" : "some-value",
"some-parameter2" : "some-value2"
})
Copy link
Contributor

Choose a reason for hiding this comment

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

is it a TF typing nightmare to make this a plain object, vs. a jsonecoded one?

@mitchnielsen mitchnielsen merged commit b1d88a8 into main Aug 21, 2024
7 checks passed
@mitchnielsen mitchnielsen deleted the add-deployment-fields branch August 21, 2024 20:45
@mitchnielsen mitchnielsen mentioned this pull request Aug 21, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants