databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
454 stars 392 forks source link

[ISSUE] `databricks_mws_customer_managed_keys` resource not setting `use_cases` array for the REST API #641

Closed tonybaron closed 3 years ago

tonybaron commented 3 years ago

Hello! It looks like the REST API might have changed for configuring a customer managed key. Previously this appeared to be working, but it looks like the REST API now requires a use_cases array (https://docs.databricks.com/dev-tools/api/latest/account.html#operation/create-key-config) that you cannot specify with the Databricks provider.

Terraform Version

0.13.6

Provider Version

0.3.3

Affected Resource(s)

Debug Output

databricks_mws_customer_managed_keys.this: Creating...
...
...
POST /accounts/<redacted>/customer-managed-keys {
  "account_id": <redacted>
  "aws_key_info": {
    "key_alias": <redacted>
    "key_arn": <redacted>
  }
}: timestamp=2021-05-11T17:30:26.817-0400
2021-05-11T17:30:27.512-0400 [DEBUG] plugin.terraform-provider-databricks_v0.3.3: 400 Bad Request: timestamp=2021-05-11T17:30:27.512-0400
2021-05-11T17:30:27.512-0400 [WARN]  plugin.terraform-provider-databricks_v0.3.3: /api/2.0/accounts/<redacted>/customer-managed-keys:400 - MALFORMED_REQUEST: Missing required parameters: use_cases: timestamp=2021-05-11T17:30:27.512-0400
2021-05-11T17:30:27.512-0400 [WARN]  plugin.terraform-provider-databricks_v0.3.3: /api/2.0/accounts/<redacted>/customer-managed-keys:400 - MALFORMED_REQUEST: Missing required parameters: use_cases: timestamp=2021-05-11T17:30:27.512-0400
2021/05/11 17:30:27 [DEBUG] databricks_mws_customer_managed_keys.this: apply errored, but we're indicating that via the Error pointer rather than returning it: MALFORMED_REQUEST: Missing required parameters: use_cases
2021/05/11 17:30:27 [ERROR] eval: *terraform.EvalApplyPost, err: MALFORMED_REQUEST: Missing required parameters: use_cases
2021/05/11 17:30:27 [ERROR] eval: *terraform.EvalSequence, err: MALFORMED_REQUEST: Missing required parameters: use_cases
...

Expected Behavior

The customer managed key resource should be created or the provider should allow setting the use-cases array.

Actual Behavior

The customer managed key resource fails to create due to a 400 response from the REST API.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Define a databricks_mws_customer_managed_keys resource.
  2. terraform apply
alexott commented 3 years ago

I'm looking into it. There are more changes in API as well