Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 3.75 KB

mws_credentials.md

File metadata and controls

78 lines (55 loc) · 3.75 KB
subcategory
AWS

databricks_mws_credentials Resource

-> Note This resource has an evolving API, which will change in the upcoming versions of the provider in order to simplify user experience.

This resource to configure the cross-account role for creation of new workspaces within AWS.

Please follow this complete runnable example with new VPC and new workspace setup. Please pay special attention to the fact that there you have two different instances of a databricks provider - one for deploying workspaces (with host="https://accounts.cloud.databricks.com/") and another for the workspace you've created with databricks_mws_workspaces resource. If you want both creation of workspaces & clusters within workspace within the same terraform module (essentially same directory), you should use the provider aliasing feature of Terraform. We strongly recommend having one terraform module for creation of workspace + PAT token and the rest in different modules.

Example Usage

-> Note This resource has an evolving API, which may change in future versions of the provider.

variable "databricks_account_id" {
  description = "Account Id that could be found in the bottom left corner of https://accounts.cloud.databricks.com/"
}

data "databricks_aws_assume_role_policy" "this" {
  external_id = var.databricks_account_id
}

resource "aws_iam_role" "cross_account_role" {
  name               = "${local.prefix}-crossaccount"
  assume_role_policy = data.databricks_aws_assume_role_policy.this.json
  tags               = var.tags
}

data "databricks_aws_crossaccount_policy" "this" {
}

resource "aws_iam_role_policy" "this" {
  name   = "${local.prefix}-policy"
  role   = aws_iam_role.cross_account_role.id
  policy = data.databricks_aws_crossaccount_policy.this.json
}

resource "databricks_mws_credentials" "this" {
  provider         = databricks.mws
  account_id       = var.databricks_account_id
  credentials_name = "${local.prefix}-creds"
  role_arn         = aws_iam_role.cross_account_role.arn
}

Argument Reference

The following arguments are required:

  • account_id - (Required) Account Id that could be found in the bottom left corner of Accounts Console
  • credentials_name - (Required) name of credentials to register
  • role_arn - (Required) ARN of cross-account role

Attribute Reference

In addition to all arguments above, the following attributes are exported:

  • id - Canonical unique identifier for the mws credentials.
  • creation_time - (Integer) time of credentials registration
  • credentials_id - (String) identifier of credentials

Import

-> Note Importing this resource is not currently supported.

Related Resources

The following resources are used in the same context: