dbt-labs / terraform-provider-dbtcloud

dbt Cloud Terraform Provider
https://registry.terraform.io/providers/dbt-labs/dbtcloud
MIT License
80 stars 18 forks source link

Unable to deploy Groups to dbt using the provider #207

Closed marychaudry closed 8 months ago

marychaudry commented 8 months ago

When trying to use the resource: resource "dbt_cloud_group" it is giving error: Error: POST url: https:///api/v3/accounts//groups/, status: 404, body: {"status":{"code":404,"is_success":false,"user_message":"The requested resource was not found. Please check that you have the proper permissions. If you are seeing this in error, please contact support!","developer_message":""},"data":null}

b-per commented 8 months ago

Hi!

Could you please share a sanitised version for the config of the group?

And is the error message the full one you are getting back from the provider? Or did you remove your account number etc.. (the URL just looks odd)

b-per commented 8 months ago

OK, thanks for clarifying.

Would it be possible to share the group config though? You can change any sensitive information but it will help me to know what fields are being used.

b-per commented 8 months ago

I will try to replicate it in the latest version of the provider, but please be aware that the version you are using which is no longer maintained and the new provider is dbt-labs/dbtcloud.

There is some info here on how to switch from the previous one to the new one.

If there is actually a bug, we could fix it in dbt-labs/dbtcloud but there is no way to fix/update GtheSheep/dbt-cloud anymore.

b-per commented 8 months ago

@marychaudry , by the way, just be aware that when you reply to the GH comments by email it adds some personal details. I have been editing your last messages to remove them but I just wanted to let you know.

marychaudry commented 8 months ago

okay Ill delete the above messages didn't realize thanks for above :)

b-per commented 8 months ago

Let me know how it goes with the "new" provider. And if there is the same issue, I would just need to get the config that you shared before to try to replicate and fix it.

marychaudry commented 8 months ago

`Sure let me put it here: This is snippet of apply

module..module.dbt-cloud-group.dbt_cloud_group.dbt-cloud-group["group_developer"] will be created

Plan: 1 to add, 0 to change, 0 to destroy. module..dbt_cloud_group.dbt-cloud-group["group_developer"]: Creating...

Error: POST url: https:///api/v3/accounts//groups/, status: 404, body: {"status":{"code":404,"is_success":false,"user_message":"The requested resource was not found. Please check that you have the proper permissions. If you are seeing this in error, please contact support!","developer_message":""},"data":null}

with module..module.dbt-cloud-group.dbt_cloud_group.dbt-cloud-group["group_developer"], on .terraform/modules//terraform-modules/dbt/module-group/module-group.tf line 11, in resource "dbt_cloud_group" "dbt-cloud-group": 11: resource "dbt_cloud_group" "dbt-cloud-group" { `

marychaudry commented 8 months ago

Hi I have tried using the provider:

required_providers { dbtcloud = { source = "dbt-labs/dbtcloud" version = "0.2.12" }

but it is still not able to apply the groups:

module.dbt__project.module.dbt-cloud-group.dbtcloud_group.dbt-cloud-group["group_developer"] will be created resource "dbtcloud_group" "dbt-cloud-group" { assign_by_default = false id = (known after apply) is_active = true name = "_dbt_nonprod_deployer" sso_mapping_groups = [ "<>", ] group_permissions { all_projects = false permission_set = "developer" project_id = } }

b-per commented 8 months ago

Thanks, I will try on my side then.

b-per commented 8 months ago

I tried the same config on my side and it is working fine.

@marychaudry , could you please raise a support ticket from dbt Cloud about this issue? I guess that you are on Single Tenant, no?

In that case, when getting in touch with support, please tell them that your account is on ST and you are getting a 404 on one of the v3 API endpoints.

marychaudry commented 8 months ago

Yes we are single tenant so maybe it is because of that. Thank you for looking into it I will raise it with dbt :)

b-per commented 8 months ago

Hi @marychaudry. Did you end raising a ticket with support? If so, do you have a number I could check?

marychaudry commented 8 months ago

Your request (56913) has been updated.

b-per commented 8 months ago

Thinking about it a bit more now, what token to you use for connecting to Terraform?

I am wondering if this is not related to the token not having the access required

marychaudry commented 8 months ago

It is service token, I will check what permission token has

jeremyyeo commented 8 months ago

A service token requires either of these roles in order to create dbt Cloud user groups:

I believe @marychaudry was able to resolve the problem after creating a token with one of the roles mentioned above so it was indeed a permission issue (or lack thereof).

b-per commented 8 months ago

Thanks @jeremyyeo ! I wish we returned a 401 instead of a 404...

jeremyyeo commented 8 months ago

Fwiw - some services return 404 when you are unauthorized to access a resource in order to not provide any information at all (no information) vs providing some information that a resource exist but you are unauthorized (more information that before).

GitHub does this. And so maybe does dbt Cloud (intentionally? 😉).