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

env0_cost_credentials_project_assignment Not Working - "Bad Request: /body must be object" #366

Closed
paul-hugill opened this issue May 8, 2022 · 0 comments · Fixed by #369
Assignees
Labels
bug Something isn't working

Comments

@paul-hugill
Copy link

paul-hugill commented May 8, 2022

When trying to assign Cost Credentials to a Project, I get the following error:
Error: could not assign cost credentials to project: 400 Bad Request: /body must be object

My code is:

resource "env0_aws_cost_credentials" "cost" {
  name        = "${var.account_name}-cost"
  arn         = aws_iam_role.env0_cost.arn
  external_id = "$${ssm:env0/${var.org_name}/cost-external-id}"
}
resource "env0_cost_credentials_project_assignment" "cost" {
  credential_id = env0_aws_cost_credentials.cost.id
  project_id    = env0_project.main.id
}

Provider version 1.0.2 in use.
Have tested with both TF version 0.13.7 and 1.0.8 just to rule it out.

I'm probably wrong but looks like the issue might be here:

err := client.http.Put("/costs/project/"+projectId+"/credentials", credentialId, &result)

According to the API, it expects the body as a json object:

'{
  "credentialsId": "string"
}'

If I am not mistaken, looks like it is just be being passed in as a string of the ID itself but my GoLang is not that strong so I could be well off.

@yaronya yaronya added this to To do in Ongoing Issues via automation May 8, 2022
@yaronya yaronya added the bug Something isn't working label May 8, 2022
@TomerHeber TomerHeber moved this from To do to In progress in Ongoing Issues May 9, 2022
Ongoing Issues automation moved this from In progress to Done May 9, 2022
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
Development

Successfully merging a pull request may close this issue.

3 participants