<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Databricks Terraform Provider Issues Passing Providers to Child Modules in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23536#M16260</link>
    <description>&lt;P&gt;That's odd, it makes me wonder if any attributes of that resource are getting exported, I suppose one could try to write the values out during an apply using a null resource and just echoing the values into a local file&lt;/P&gt;</description>
    <pubDate>Sun, 06 Nov 2022 08:41:33 GMT</pubDate>
    <dc:creator>absolutelyRice</dc:creator>
    <dc:date>2022-11-06T08:41:33Z</dc:date>
    <item>
      <title>Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23534#M16258</link>
      <description>&lt;P&gt;I have been following the documentation on the terraform databricks documentation in order to provision account level resources on AWS. I can create the workspace fine, add users, etc... However, when I go to use the provider in non-mws mode, I am receiving errors saying:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; Error: workspace is most likely not created yet, because the `host` is empty. Please add `depends_on = [databricks_mws_workspaces.this]` or `depends_on = [azurerm_databricks_workspace.this]` to every data resource. See &lt;A href="https://www.terraform.io/docs/language/resources/behavior.html" target="test_blank"&gt;https://www.terraform.io/docs/language/resources/behavior.html&lt;/A&gt; more info. Please check &lt;A href="https://registry.terraform.io/providers/databricks/databricks/latest/docs#authentication" target="test_blank"&gt;https://registry.terraform.io/providers/databricks/databricks/latest/docs#authentication&lt;/A&gt; for details
│
│   with module.workspaces.data.databricks_spark_version.latest,
│   on ../modules/aws_workspaces/init.tf line 11, in data "databricks_spark_version" "latest":
│   11: data "databricks_spark_version" "latest" {}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To show how this created I have a file called root.tf which creates the root mws level resources absolutely fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;provider "databricks" {
  alias    = "mws"
  host     = "https://accounts.cloud.databricks.com"
  username = var.databricks_account_username
  password = var.databricks_account_password
}
&amp;nbsp;
&amp;nbsp;
module "root" {
  source = "../modules/aws_root"
&amp;nbsp;
  databricks_account_id = var.databricks_account_id
&amp;nbsp;
  tags = var.tags
&amp;nbsp;
&amp;nbsp;
  region = var.region
&amp;nbsp;
  cidr_block = var.cidr_block
&amp;nbsp;
  databricks_users            = var.databricks_users
  databricks_metastore_admins = var.databricks_metastore_admins
&amp;nbsp;
  unity_admin_group = var.unity_admin_group
&amp;nbsp;
  providers = {
    databricks.mws = databricks.mws
  }
&amp;nbsp;
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;With outputs coming from that module:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;output "databricks_host" {
  value = databricks_mws_workspaces.this.workspace_url
}
&amp;nbsp;
output "databricks_token" {
  value     = databricks_mws_workspaces.this.token[0].token_value
  sensitive = true
}
&amp;nbsp;
output "databricks_workspace_id" {
  value     = databricks_mws_workspaces.this.workspace_id
  sensitive = false
}
&amp;nbsp;
output "databricks_account_id" {
  value     = databricks_mws_workspaces.this.account_id
  sensitive = true
}
&amp;nbsp;
output "aws_iam_role_metastore_data_access_arn" {
  value = aws_iam_role.metastore_data_access.arn
}
&amp;nbsp;
output "aws_iam_role_metastore_data_access_name" {
  value = aws_iam_role.metastore_data_access.name
}
&amp;nbsp;
output "aws_s3_bucket_metastore_id" {
  value = aws_s3_bucket.metastore.id
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;These can be seen in the created resources when I do a &lt;/P&gt;&lt;P&gt;`terraform state show &amp;lt;outputs&amp;gt;`&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I go to create a workspace level provider to create some notebooks, clusters, etc... I seem to be unable to get the child module resources to use the newly created provider with a host, even though it is being set and I can see it's value. Even hard coding the host does not work. They all output the above error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The creation of this provider and module can be seen here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;provider "databricks" {
  alias      = "workspace"
  host       = module.root.databricks_host
  token      = module.root.databricks_token
  account_id = module.root.databricks_account_id
}
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp;
module "workspaces" {
  source = "../modules/aws_workspaces"
&amp;nbsp;
  aws_s3_bucket_metastore_id              = module.root.aws_s3_bucket_metastore_id
  aws_iam_role_metastore_data_access_arn  = module.root.aws_iam_role_metastore_data_access_arn
  aws_iam_role_metastore_data_access_name = module.root.aws_iam_role_metastore_data_access_name
&amp;nbsp;
  cidr_block = var.cidr_block
&amp;nbsp;
  databricks_account_id        = var.databricks_account_id
  databricks_bronze_users      = var.databricks_bronze_users
  databricks_gold_users        = var.databricks_gold_users
  databricks_host              = module.root.databricks_host
  databricks_metastore_admins  = var.databricks_metastore_admins
  databricks_silver_users      = var.databricks_silver_users
  databricks_token             = module.root.databricks_token
  databricks_users             = var.databricks_users
  databricks_workspace_id      = module.root.databricks_workspace_id
  python_module_version_number = local.python_module_version_number
  shed_databricks_egg_name     = var.shed_databricks_egg_name
&amp;nbsp;
  tags              = var.tags
  unity_admin_group = var.unity_admin_group
  config            = local.config
&amp;nbsp;
  depends_on = [
    module.root
  ]
  providers = {
    databricks = databricks.workspace
  }
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the init method that uses this provider and is throwing the error can be seen here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;terraform {
  required_providers {
    databricks = {
      source                = "databricks/databricks"
      version               = "~&amp;gt; 1.6.2"
      configuration_aliases = [databricks.workspace]
    }
  }
}
&amp;nbsp;
data "databricks_spark_version" "latest" {}
data "databricks_node_type" "smallest" {
  local_disk = true
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The suggestion to add a depends_on for the&lt;/P&gt;&lt;P&gt;`databricks_mws_workspace.this` isn't possible to do as it is created in the root module where the `databricks.mws` provider is used. (The documentation says each module should isolate providers.)&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 17:19:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23534#M16258</guid>
      <dc:creator>absolutelyRice</dc:creator>
      <dc:date>2022-11-05T17:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23535#M16259</link>
      <description>&lt;P&gt;I'm also curious about this as I haven't been able to successfully create an output for the databricks account_id.​&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 17:26:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23535#M16259</guid>
      <dc:creator>Jfoxyyc</dc:creator>
      <dc:date>2022-11-05T17:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23536#M16260</link>
      <description>&lt;P&gt;That's odd, it makes me wonder if any attributes of that resource are getting exported, I suppose one could try to write the values out during an apply using a null resource and just echoing the values into a local file&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 08:41:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23536#M16260</guid>
      <dc:creator>absolutelyRice</dc:creator>
      <dc:date>2022-11-06T08:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23537#M16261</link>
      <description>&lt;P&gt;So the answer to this was that you need to explicitly pass the provider argument to each of the data resources blocks. The docs should be updated to accommodate that. ​&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data "databricks_spark_version" "latest" {
  provider = databricks.workspace
}
data "databricks_node_type" "smallest" {
  provider = databricks.workspace
  local_disk = true
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 17:11:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23537#M16261</guid>
      <dc:creator>absolutelyRice</dc:creator>
      <dc:date>2022-11-06T17:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23538#M16262</link>
      <description>&lt;P&gt;Were you able to output the databricks account_id ?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 22:37:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23538#M16262</guid>
      <dc:creator>Jfoxyyc</dc:creator>
      <dc:date>2022-11-07T22:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Terraform Provider Issues Passing Providers to Child Modules</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23539#M16263</link>
      <description>&lt;P&gt;I am going to be honest, I don't recall off the top of my head, but it is getting passed in as an argument to the other modules above so I assume so. I was able to verify that the other two were getting exported by adding a null resource that was something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    resource "null_resource" "echo" {
      local-exec = "echo '${module.root_mws.account_id}' &amp;gt; output.txt"
    }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 22:41:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-provider-issues-passing-providers-to-child/m-p/23539#M16263</guid>
      <dc:creator>absolutelyRice</dc:creator>
      <dc:date>2022-11-07T22:41:21Z</dc:date>
    </item>
  </channel>
</rss>

