<?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 Terraform Databricks Integration - specially for Unity Catalog in AWS S3 in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/98897#M2308</link>
    <description>&lt;P&gt;We are attempting to provision Unity Catalog using Terraform, but we're encountering issues with establishing authentication with AWS through IAM Roles and Policies.&lt;/P&gt;&lt;P&gt;For EC2/Cluster instances, the instance profile works fine with a trust relationship of "ec2.amazonaws.com." However, when it comes to creating Unity Catalog, we need to use an AWS Role to access S3 resources.&lt;/P&gt;&lt;P&gt;Please note, this is all being done with AWS Roles/Policies, not AWS credentials/keys.&lt;/P&gt;&lt;P&gt;Any assistance, guidance, or links to relevant materials would be greatly appreciated!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 09:55:52 GMT</pubDate>
    <dc:creator>debal</dc:creator>
    <dc:date>2024-11-15T09:55:52Z</dc:date>
    <item>
      <title>Terraform Databricks Integration - specially for Unity Catalog in AWS S3</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/98897#M2308</link>
      <description>&lt;P&gt;We are attempting to provision Unity Catalog using Terraform, but we're encountering issues with establishing authentication with AWS through IAM Roles and Policies.&lt;/P&gt;&lt;P&gt;For EC2/Cluster instances, the instance profile works fine with a trust relationship of "ec2.amazonaws.com." However, when it comes to creating Unity Catalog, we need to use an AWS Role to access S3 resources.&lt;/P&gt;&lt;P&gt;Please note, this is all being done with AWS Roles/Policies, not AWS credentials/keys.&lt;/P&gt;&lt;P&gt;Any assistance, guidance, or links to relevant materials would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 09:55:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/98897#M2308</guid>
      <dc:creator>debal</dc:creator>
      <dc:date>2024-11-15T09:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform Databricks Integration - specially for Unity Catalog in AWS S3</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/98971#M2312</link>
      <description>&lt;P&gt;&lt;SPAN&gt;To provision Unity Catalog using Terraform and authenticate with AWS through IAM Roles and Policies, you'll need to follow these steps:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8"&gt;
&lt;LI&gt;&lt;SPAN&gt;Create an IAM Role for Unity Catalog:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;First, you need to create an IAM role that Unity Catalog can assume to access your S3 resources. This role needs a trust relationship with Databricks and should be self-assuming.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resource "aws_iam_role" "unity_catalog_role" {
  name = "unity-catalog-role"

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          AWS = [
            "arn:aws:iam::414351767826:role/unity-catalog-prod-UCMasterRole-14S5ZJVKOTYTL",
            "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${aws_iam_role.unity_catalog_role.name}"
          ]
        }
        Action = "sts:AssumeRole"
        Condition = {
          StringEquals = {
            "sts:ExternalId" = var.databricks_account_id
          }
        }
      }
    ]
  })
}&lt;/LI-CODE&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8" start="2"&gt;
&lt;LI&gt;&lt;SPAN&gt;Attach necessary policies to the IAM Role:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Attach policies that grant the necessary permissions to access your S3 resources:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resource "aws_iam_role_policy_attachment" "unity_catalog_s3_access" {
  role       = aws_iam_role.unity_catalog_role.name
  policy_arn = aws_iam_policy.s3_access_policy.arn
}

resource "aws_iam_policy" "s3_access_policy" {
  name        = "unity-catalog-s3-access"
  description = "Policy for Unity Catalog to access S3"

  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Action = [
          "s3:GetBucketLocation",
          "s3:ListBucket",
          "s3:GetObject",
          "s3:PutObject",
          "s3:DeleteObject",
          "s3:ListMultipartUploadParts",
          "s3:AbortMultipartUpload"
        ]
        Resource = [
          "arn:aws:s3:::your-unity-catalog-bucket",
          "arn:aws:s3:::your-unity-catalog-bucket/*"
        ]
      }
    ]
  })
}&lt;/LI-CODE&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8" start="3"&gt;
&lt;LI&gt;&lt;SPAN&gt;Create a Storage Credential in Unity Catalog:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Use the Databricks Terraform provider to create a storage credential using the IAM role:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resource "databricks_storage_credential" "unity_catalog_credential" {
  name = "unity-catalog-credential"
  aws_iam_role {
    role_arn = aws_iam_role.unity_catalog_role.arn
  }
  comment = "Credential for Unity Catalog"
}&lt;/LI-CODE&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8" start="4"&gt;
&lt;LI&gt;&lt;SPAN&gt;Create an External Location:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Create an external location in Unity Catalog that uses the storage credential:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resource "databricks_external_location" "unity_catalog_location" {
  name            = "unity-catalog-location"
  url             = "s3://your-unity-catalog-bucket"
  credential_name = databricks_storage_credential.unity_catalog_credential.name
  comment         = "External location for Unity Catalog"
}&lt;/LI-CODE&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8" start="5"&gt;
&lt;LI&gt;&lt;SPAN&gt;Create a Metastore:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Finally, create the Unity Catalog metastore:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resource "databricks_metastore" "this" {
  name = "unity-catalog-metastore"
  storage_root = "s3://your-unity-catalog-bucket/metastore"
  force_destroy = true
}&lt;/LI-CODE&gt;
&lt;OL class="marker:text-textOff list-decimal pl-8" start="6"&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;Assign the Metastore to your Workspace:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;LI-CODE lang="markup"&gt;resource "databricks_metastore_assignment" "this" {
  workspace_id         = var.databricks_workspace_id
  metastore_id         = databricks_metastore.this.id
  default_catalog_name = "hive_metastore"
}&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 16:28:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/98971#M2312</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-11-15T16:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform Databricks Integration - specially for Unity Catalog in AWS S3</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/127799#M3832</link>
      <description>&lt;P&gt;Is this work tested? I'm getting an error&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: Self-referential block

  on index.tf line 31, in resource "aws_iam_role" "reader":
  31:             "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${aws_iam_role.reader.name}"

Configuration for aws_iam_role.reader may not
refer to itself.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2025 11:41:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-databricks-integration-specially-for-unity-catalog-in/m-p/127799#M3832</guid>
      <dc:creator>sumit-sampang</dc:creator>
      <dc:date>2025-08-08T11:41:24Z</dc:date>
    </item>
  </channel>
</rss>

