Closed tony-farias closed 2 years ago
@tony-farias Any particular reason why they are still on tf v0.12, that is a pretty old version.
If they try with a newer tf version, do they still run into the issue?
@tony-farias can you reproduce this failure in Terraform 0.12.x and 1.1.x?
They experience the failure still in Terraform 0.13, the highest version they have enterprise access to. I will try TF 1.1 on my side.
On Thu, Aug 4, 2022 at 4:35 AM Serge Smertin @.***> wrote:
@tony-farias https://github.com/tony-farias can you reproduce this failure on Terraform 1.1?
— Reply to this email directly, view it on GitHub https://github.com/databricks/terraform-provider-databricks/issues/1518#issuecomment-1204942133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVAH3M76OOYAWEIFJGZYYNLVXN6EXANCNFSM55PGY2FA . You are receiving this because you were mentioned.Message ID: @.*** com>
@tony-farias Following up - is this issue still relevant? could you attach the logs? otherwise i'll have to close this issue.
Yes, still relevant. I will scrub and attach logs now.
A user uses a count in databricks_mws_workspaces, so they can define a conditional in the output variable around token. The call to the token API is ok 2022-07-29T20:33:40.252Z [DEBUG] plugin.terraform-provider-databricks_v0.6.1: 200 OK {} <- GET /api/2.0/token/list: timestamp=2022-07-29T20:33:40.252Z
This line produces the issue: value = var.databricks_enable_workspace ? databricks_mws_workspaces.this[0].token[0].token_value : null
Seems like databricks_mws_workspaces.this[0] is empty, but with databricks_mws_workspaces.this.token.token_value the apply is successful. See error below.
The customer needs this to proceed. Many teams use conditionals so they can move code into prod across the team, without blocking each other. Customer comments:
""" it's a blocker to even dev, because I can't commit it into my mainline until I can shut it off per env. And since I can't do that, other peoples changes blow away my work """
Configuration
resource "databricks_mws_workspaces" "this" { provider = databricks.mws count = var.databricks_enable_workspace ? 1 : 0 account_id = var.databricks_account_id aws_region = local.region workspace_name = var.databricks_naming_prefix deployment_name = var.databricks_naming_prefix
credentials_id = databricks_mws_credentials.this[count.index].credentials_id storage_configuration_id = databricks_mws_storage_configurations.this[count.index].storage_configuration_id managed_services_customer_managed_key_id = databricks_mws_customer_managed_keys.mws_cmk[count.index].customer_managed_key_id storage_customer_managed_key_id = databricks_mws_customer_managed_keys.storage_cmk[count.index].customer_managed_key_id network_id = databricks_mws_networks.this[count.index].network_id
token {} }
provider "databricks" { alias = "created_workspace" host = var.databricks_enable_workspace ? databricks_mws_workspaces.this[0].workspace_url : null }
output "databricks_token" { value = var.databricks_enable_workspace ? databricks_mws_workspaces.this[0].token[0].token_value : null sensitive = true }
Expected Behavior
The apply should work
Actual Behavior
[1m[31mError: [0m[0m[1mInvalid index[0m
[0m on databricks_workspace/outputs.tf line 9, in output "databricks_token": 9: value = var.databricks_enable_workspace ? databricks_mws_workspaces.this[0].token[4m[0][0m.token_value : null [0m [90m|----------------[0m [0m [90m|[0m [1mdatabricks_mws_workspaces.this[0].token[0m is empty list of object[0m [0m The given key does not identify an element in this collection value. [0m[0m
Steps to Reproduce
terraform apply on config above
Terraform and provider versions
tf v0.12.31 current provider
Debug Output
I can provide this, though the summary above should contain the necessary details.
Important Factoids