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] Provider bug: terraform replaces workspace due to deployment_name prefix #382

Closed
hamza-tumturk opened this issue Oct 23, 2020 · 2 comments · Fixed by #400
Closed
Assignees
Milestone

Comments

@hamza-tumturk
Copy link
Contributor

Hi,

when creating a workspace in our account, the deployment name is getting prefixed with our account prefix, which is intended behaviour. Creating the resource with terraform, we don't additionally set the prefix, as it automatically gets set by databricks. So the deployment name will eventually end up being <prefix>-<deployment_name>.
The issue starts when rerunning the terraform deployment, as terraform will not be aware of the prefixed deployment name and tries to recreate the resource.
As a workaround, I tried to prefix the resource myself, rather than letting databricks do it, but the resource then I end up getting a deployment with double prefix like<prefix>-<prefix>-<deployment_name> and the resource still recreates on a terraform rerun.

Terraform Version

Terraform v0.12.25

Affected Resource(s)

  • databricks_mws_workspaces

Environment variable names

AWS

Terraform Configuration Files

resource "databricks_mws_workspaces" "this" {
  provider        = databricks.mws
  account_id      = var.databricks_account_id
  aws_region      = var.aws_region
  workspace_name  = local.workspace_name
  deployment_name = local.deployment_name

  credentials_id            = databricks_mws_credentials.this.credentials_id
  storage_configuration_id  = databricks_mws_storage_configurations.this.storage_configuration_id
  network_id                = databricks_mws_networks.this.network_id
  verify_workspace_runnning = true

}

which correspond in the UI as
image

Debug Output

  # databricks_mws_workspaces.this must be replaced
-/+ resource "databricks_mws_workspaces" "this" {
        account_id                = (sensitive value)
        aws_region                = "us-east-1"
      ~ creation_time             = 1603405747119 -> (known after apply)
        credentials_id            = "XXX"
      ~ deployment_name           = "prefix-deployment_name" -> "deployment_name" # forces replacement

Expected Behavior

Terraform shouldn't recreate the workspace resource for accounts when databricks adds a prefix, but rather detect the prefix and consider it in the change plan.

Actual Behavior

Terraform recreates the workspace resource.

Steps to Reproduce

  1. terraform apply
@hamza-tumturk
Copy link
Contributor Author

hamza-tumturk commented Oct 23, 2020

In the meantime, a possible workaround for this issue is just to add a lifecycle to ignore the changes on the deployment_name for the resource databricks_mws_workspaces

lifecycle {
  ignore_changes = [
    deployment_name
  ]
}

A rerun of tf gives: No changes. Infrastructure is up-to-date. Happy days

@nfx nfx added this to the v0.2.8 milestone Nov 2, 2020
@nfx nfx self-assigned this Nov 2, 2020
@nfx nfx added the Small Size label Nov 3, 2020
@nfx nfx linked a pull request Nov 6, 2020 that will close this issue
@nfx
Copy link
Contributor

nfx commented Nov 6, 2020

Fixed in #400

nfx added a commit that referenced this issue Nov 6, 2020
nfx added a commit that referenced this issue Nov 6, 2020
@nfx nfx closed this as completed in #400 Nov 6, 2020
nfx added a commit that referenced this issue Nov 6, 2020
* Pre-release fixing
* Added NAT to BYOVPC terraform module
* added instance profile locks
* Added sync block for instance profiles integration tests
* Fix #383 Cleaning up clusters that fail to start
* Added log delivery use case docs
* Fix #382 - ignore changes to deployment_name
* Fix test and lints
* Fix #382 by ignoring incoming prefix for deployment_name for databricks_mws_workspaces
* Improve documentation to fix #368
* fix linting issues

Co-authored-by: Serge Smertin <serge.smertin@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants