-
Notifications
You must be signed in to change notification settings - Fork 17
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
Can't Datasource a Deployment by its name #330
Comments
Thanks for reaching out @phergoualch I believe you just need to tweak your - data "data" "existing" {
+ data "prefect_deployment" "existing"
# id = "9e1eb232-4f15-404d-8a84-3727cc68f584"
- name = "mysql-backup/mysql-backup"
+ name = "mysql-backup"
} This does the following:
|
Well, the data is a mistake from my copy past, I used the correct data_source name. |
Sure, just pointing out that the documentation shows you only need the deployment name, not Since I wasn't able to replicate the error, can you please:
This will hopefully help me replicate the issue and find the root cause. |
The full codedata "prefect_deployment" "existing" {
# id = "9e1eb232-4f15-404d-8a84-3727cc68f584"
name = "mysql-backup"
}
output "existing_deployment" {
value = data.prefect_deployment.existing
} The error when trying to datasource with name
The deployment output when datasourcing with id
Note that the exisiting deployment was not created using Terraform but Python. Could this be the cause ? |
Thank you, I think I found the problem - there's some missing logic in |
For the Deployment datasource, we were getting it by name by using the /filter endpoint. But we weren't passing any filter body in the request, so it was always getting all Deployments back. This change uses the API endpoint to get a deployment by name, which now requires a flow name as well. Related to #330
I've opened #343 which should help here. In the meantime, you should be able to datasource the deployment by |
For the Deployment datasource, we were getting it by name by using the /filter endpoint. But we weren't passing any filter body in the request, so it was always getting all Deployments back. This change uses the API endpoint to get a deployment by name, which now requires a flow name as well. Related to #330
* Deployment: Replace List with GetByName For the Deployment datasource, we were getting it by name by using the /filter endpoint. But we weren't passing any filter body in the request, so it was always getting all Deployments back. This change uses the API endpoint to get a deployment by name, which now requires a flow name as well. Related to #330 * Validate either id or name and flow_name Validates that the correct combination of fields is provided to retrieve the datasource correctly. * Specify flow_name in datasource test * Generate Terraform Docs --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@phergoualch - give 2.13.4 a try when you have a chance, we pushed a fix for datasourcing Deployments. |
Community Note
Terraform Version
1.9.8
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
It is working fine with the deployment id but not the deployment name. I tested both mysql-backup and mysql-backup/mysql-backup as outputed by the prefect deployment ls.
$ prefect deployment ls
The text was updated successfully, but these errors were encountered: