Is your feature request related to a problem? Please describe.
When I apply a seemingly-reasonable terraform plan only to then see opaque, API-relevant errors from the provider, I'm not sure what I'm doing wrong.
Describe the solution you would like
I would like the provider to respect the CF_TRACE=true environment variable, so that I can see what API calls the provider is making.
Describe alternatives you have considered
I tried using TF_LOG=DEBUG but the output was not helpful since it didn't tell me anything about what the provider was actually doing, only the parts that Terraform cares about.
Additional context
In this particular case, I was seeing:
│ Error: Error pushing app
│
│ with module.spiff.cloudfoundry_app.connector,
│ on ../main.tf line 134, in resource "cloudfoundry_app" "connector":
│ 134: resource "cloudfoundry_app" "connector" {
│
│ error while waiting for app spiffworkflow-connector package to build: received state FAILED while waiting for async process
╵
The actual problem was that I was pushing a docker image using a bad imageref, and staging was failing with a 403. Setting CF_TRACE=true might not have revealed that was the problem, but it was something I tried along the way, and I was surprised that it didn't work.
Similarly, I was seeing:
│ Error: API Error in creating managed service instance
│
│ with module.spiff.cloudfoundry_service_instance.database,
│ on ../main.tf line 24, in resource "cloudfoundry_service_instance" "database":
│ 24: resource "cloudfoundry_service_instance" "database" {
│
│ Unable to create service instance spiffworkflow-database: executing POST request for /v3/service_instances failed: cfclient error (CF-UnprocessableEntity|10008): Invalid
│ space. Ensure that the space exists and you have access to it.
The actual problem was that cloudfoundry_service_instance wants the space attribute to be the .id (GUID) for the space, not the name, which is what I supplied. It would be good to get a "that doesn't look like a GUID" hint. Or, to be consistent, cloudfoundry_service_instance could optionally accept org_name + space_name in lieu of space, with behavior similar to cloudfoundry_app: it expects names attributes for its target org and space and looks up the GUID transparently.
Thanks for the feature request. We evaluate it and update the issue accordingly.
Community Note
Voting for Prioritization
Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
What area do you want to see improved?
terraform provider
Is your feature request related to a problem? Please describe.
When I apply a seemingly-reasonable terraform plan only to then see opaque, API-relevant errors from the provider, I'm not sure what I'm doing wrong.
Describe the solution you would like
I would like the provider to respect the
CF_TRACE=true
environment variable, so that I can see what API calls the provider is making.Describe alternatives you have considered
I tried using
TF_LOG=DEBUG
but the output was not helpful since it didn't tell me anything about what the provider was actually doing, only the parts that Terraform cares about.Additional context
In this particular case, I was seeing:
The actual problem was that I was pushing a docker image using a bad imageref, and staging was failing with a 403. Setting
CF_TRACE=true
might not have revealed that was the problem, but it was something I tried along the way, and I was surprised that it didn't work.Similarly, I was seeing:
The actual problem was that
cloudfoundry_service_instance
wants thespace
attribute to be the.id
(GUID) for the space, not the name, which is what I supplied. It would be good to get a "that doesn't look like a GUID" hint. Or, to be consistent,cloudfoundry_service_instance
could optionally acceptorg_name
+space_name
in lieu ofspace
, with behavior similar tocloudfoundry_app
: it expects names attributes for its target org and space and looks up the GUID transparently.