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

[FEATURE] Support CF_TRACE environment variable #91

Open
mogul opened this issue Dec 2, 2024 · 2 comments
Open

[FEATURE] Support CF_TRACE environment variable #91

mogul opened this issue Dec 2, 2024 · 2 comments

Comments

@mogul
Copy link

mogul commented Dec 2, 2024

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:

│ 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.

@mogul mogul added the enhancement New feature or request label Dec 2, 2024
Copy link

github-actions bot commented Dec 2, 2024

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.

@vipinvkmenon
Copy link
Contributor

This issue has 2 parts to it:

  • For the first part, an issue and fix has been raised in the go-cfclient. We'll need to get this merged before addressing it here.

  • As for the second part of the error, I'd like to point out that a validation for UUID was missing, which has been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants