dbt-labs / terraform-provider-dbtcloud

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

Bug - Updating environment #157

Closed edebrye closed 1 year ago

edebrye commented 1 year ago

Hello ! When I tried to update an environment because it was changed outside of terraform :

Plan :

 # dbt_cloud_environment.name will be updated in-place
  ~ resource "dbt_cloud_environment" "name" {
      - custom_branch     = "main" -> null
        id                = "<hidden>"
        name              = "<hidden>"
      ~ use_custom_branch = true -> false
        # (6 unchanged attributes hidden)
    }

Apply:

dbt_cloud_environment.name: Modifying... [id=<hidden>]
╷
│ Error: POST url: https://emea.dbt.com/api/v3/accounts/<hidden>/projects/<hidden>/environments/<hidden>/, status: 400, body: {"status":{"code":400,"is_success":false,"user_message":"The request was invalid. Please double check the provided data and try again.","developer_message":""},"data":{"credentials":"{'id': <hidden>, 'account_id': <hidden>, 'project_id': <hidden>, 'type': 'adapter', 'state': 1, 'threads': 4, 'user': '', 'auth_type': '', 'database': '', 'role': '', 'warehouse': '', 'schema': ''} is not valid under any of the given schemas"}}
│ 
│   with dbt_cloud_environment.name,
│   on modules/dbt-project/environments.tf line 25, in resource "dbt_cloud_environment" "name":
│   25: resource "dbt_cloud_environment" "name" {
│ 
╵

If this can be relevant, it is a deployment environment.

b-per commented 1 year ago

Thanks. I am about to release a new version but will try to include the fix for this one there.