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

[ISSUE] Unable to delete databricks_sql_global_config resource configured with instance profile #1076

Closed
kr-arjun opened this issue Jan 31, 2022 · 0 comments · Fixed by #1080
Assignees
Labels
needs-api changes to Databricks Platform APIs are required

Comments

@kr-arjun
Copy link

kr-arjun commented Jan 31, 2022

Configuration

# variable "databricks_connection_profile" {
  description = "The name of the Databricks connection profile to use."
  type = string
  default = "my-profile"
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.27"
    }

  databricks = {
    source = "databrickslabs/databricks"
    version = "~> 0.3"
    } 
  }
}

provider "aws" {
  profile = var.aws_connection_profile
  region = var.aws_region
}

provider "databricks" {
  profile = var.databricks_connection_profile
}

data "databricks_current_user" "me" {}

resource "databricks_sql_global_config" "this" {
  security_policy      = "DATA_ACCESS_CONTROL"
  instance_profile_arn = "arn:aws:iam::12345678:instance-profile/data-access-role"
  data_access_config = {
    "spark.sql.session.timeZone" : "UTC"
  }
}

Expected Behavior

The SQLendpoint global config should be deleted.

Actual Behavior

On trying to destroy databricks_sql_global_config resources, it fails with below error.

Error: cannot delete sql global config: Instance profile has invalid format. 
Example valid ARN: arn:aws:iam::1234567890:profile/name.

Steps to Reproduce

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

  1. terraform apply to create the sqlendpoint with sqlendpoint global config set
  2. terraform destroy to destroy the sqlendpoints and sqlendpoint global configs.

Terraform and provider versions

Terraform v1.0.0
on darwin_amd64

  • provider registry.terraform.io/databrickslabs/databricks v0.4.7
  • provider registry.terraform.io/hashicorp/aws v3.74.0

Debug Output

It looks like the instance_profile_arn is set to empty string - should ideally be removed from API payload while deletion?

2022-01-31T16:52:50.937-0600 [INFO]  provider.terraform-provider-databricks_v0.4.7: Configured databricks-cli auth: host=https://xyz.cloud.databricks.com/, username=token, password=***REDACTED***, profile=my-profile: timestamp=2022-01-31T16:52:50.937-0600
2022-01-31T16:52:50.937-0600 [DEBUG] provider.terraform-provider-databricks_v0.4.7: PUT /api/2.0/sql/config/endpoints {
  "data_access_config": [],
  "enable_serverless_compute": false,
  "instance_profile_arn": "",
  "security_policy": "DATA_ACCESS_CONTROL"
}: timestamp=2022-01-31T16:52:50.937-0600
2022-01-31T16:52:51.482-0600 [DEBUG] provider.terraform-provider-databricks_v0.4.7: 400 Bad Request {
  "error_code": "INVALID_PARAMETER_VALUE",
  "message": "Instance profile has invalid format. Example valid ARN: arn:aws:iam::1234567890:profile/name."
}: timestamp=2022-01-31T16:52:51.481-0600
2022-01-31T16:52:51.482-0600 [WARN]  provider.terraform-provider-databricks_v0.4.7: /api/2.0/sql/config/endpoints:400 - Instance profile has invalid format. Example valid ARN: arn:aws:iam::1234567890:profile/name.: timestamp=2022-01-31T16:52:51.482-0600

Important Factoids

@nfx nfx added the needs-api changes to Databricks Platform APIs are required label Feb 1, 2022
alexott added a commit that referenced this issue Feb 2, 2022
Also added a new parameter `sql_config_params`

this fixes #1076
@alexott alexott self-assigned this Feb 2, 2022
alexott added a commit that referenced this issue Feb 2, 2022
Also added a new parameter `sql_config_params`

this fixes #1076
@nfx nfx closed this as completed in #1080 Feb 2, 2022
nfx pushed a commit that referenced this issue Feb 2, 2022
Also added a new parameter `sql_config_params`

this fixes #1076
@nfx nfx mentioned this issue Feb 3, 2022
100 tasks
michael-berk pushed a commit to michael-berk/terraform-provider-databricks that referenced this issue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-api changes to Databricks Platform APIs are required
Projects
None yet
3 participants