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

Deployment error: json string value is null #289

Closed
vnagaraj opened this issue Oct 28, 2024 · 2 comments · Fixed by #290
Closed

Deployment error: json string value is null #289

vnagaraj opened this issue Oct 28, 2024 · 2 comments · Fixed by #290
Labels
bug Something isn't working

Comments

@vnagaraj
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform Version

Affected Resource(s)

  • prefect_2.3.0

Terraform Configuration Files

resource "prefect_flow" "flow" {
  name         = "cowsay-flow"
  workspace_id = var.prefect_cloud_workspace_id
  tags         = ["tf-test"]
}
#
resource "prefect_deployment" "deployment" {
  name                     = "Cowsay Example Deployment"
  description              = "string"
  workspace_id             = var.prefect_cloud_workspace_id
  flow_id                  = prefect_flow.flow.id
  entrypoint               = "cowsay_example.py:cowsay_flow"
  tags                     = ["staging"]
  enforce_parameter_schema = false
  parameters = jsonencode({
    "creature" : "cow",
    "message"  :"Hello World!"
  })
  parameter_openapi_schema = jsonencode({
    "type" : "object",
    "properties" : {
      "creature" :  {"type": "string"}
      "message" : {"type": "string"}
    }
  })
  paused              = false
  storage_document_id = "eb5bbb9b-b499-4895-8932-8e366aa4b627"
  version             = "v1.1.1"
  work_pool_name      = "main"
  work_queue_name     = "default"
}

Debug Output

Panic Output

╷
│ Error: Normalized JSON Unmarshal Error
│ 
│   with module.flows.prefect_deployment.deployment,
│   on ../../modules/flows/main.tf line 7, in resource "prefect_deployment" "deployment":
│    7: resource "prefect_deployment" "deployment" {
│ 
│ json string value is null
╵
2024-10-28T21:47:39.083Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-28T21:47:39.085Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.opentofu.org/prefecthq/prefect/2.3.0/linux_amd64/terraform-provider-prefect_v2.3.0 pid=92
2024-10-28T21:47:39.086Z [DEBUG] provider: plugin exited
[01JBAFEXR70ME9JN0GVB6ES058] Unexpected exit code when applying changes: 1

Expected Behavior

Deployment should succeed

Actual Behavior

Failure as reported in Panic Output

Steps to Reproduce

  1. terraform plan
  2. terraform apply

References

#238

@vnagaraj vnagaraj added the bug Something isn't working label Oct 28, 2024
@mitchnielsen
Copy link
Contributor

Thanks for the report here, I'm working on replicating. What I've found so far is that you apparently need to specify all of the following:

  • job_variables
  • parameters
  • parameter_openapi_schema

They're optional, but it looks like we need to improve the way we unmarshal them in case they're not configured. Will look into it a bit more and put up a PR.

mitchnielsen added a commit that referenced this issue Oct 28, 2024
Checks if an attribute is null before attempting to unmarshal it.

Closes #289
@mitchnielsen mitchnielsen changed the title Deploy Flows via Terraform Deployment error: json string value is null Oct 29, 2024
mitchnielsen added a commit that referenced this issue Oct 29, 2024
* Check if null before unmarshalling

Checks if an attribute is null before attempting to unmarshal it.

Closes #289

* Use a helper for safely unamrshalling

Uses a helper method for this so we have it handy next time we need to
unmarshal an attribute that could be null.
@mitchnielsen
Copy link
Contributor

Thanks again @vnagaraj, we've just released https://github.com/PrefectHQ/terraform-provider-prefect/releases/tag/v2.5.1 which should address this. Please reach out if you run into any other issues.

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
Development

Successfully merging a pull request may close this issue.

2 participants