Skip to content

Commit c562e08

Browse files
authored
Improve aws-workspace-basic example (#185)
* Improve `aws-workspace-basic` example * Update README * Pass all variables * Remove deprecated argument to `databricks_mws_credentials` * don't set default value for prefix
1 parent a59eb4d commit c562e08

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

examples/aws-workspace-basic/README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ This template provides an example of a simple deployment of AWS Databricks E2 wo
1313
1. Reference this module using one of the different [module source types](https://developer.hashicorp.com/terraform/language/modules/sources)
1414
2. Add a `variables.tf` with the same content in [variables.tf](variables.tf)
1515
3. Add a `terraform.tfvars` file and provide values to each defined variable
16-
4. Configure the following environment variables:
17-
* TF_VAR_databricks_account_client_id, set to the value of application ID of your Databricks account-level service principal with admin permission.
18-
* TF_VAR_databricks_account_client_secret, set to the value of the client secret for your Databricks account-level service principal.
19-
* TF_VAR_databricks_account_id, set to the value of the ID of your Databricks account. You can find this value in the corner of your Databricks account console.
16+
4. Configure authentication to the Databricks Account (i.e., via Databricks CLI profiles or service principal).
2017
5. Add a `output.tf` file.
2118
6. (Optional) Configure your [remote backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3)
2219
7. Run `terraform init` to initialize terraform and get provider ready.
@@ -51,7 +48,8 @@ No resources.
5148
| <a name="input_databricks_account_id"></a> [databricks\_account\_id](#input\_databricks\_account\_id) | Databricks Account ID | `string` | n/a | yes |
5249
| <a name="input_region"></a> [region](#input\_region) | AWS region to deploy to | `string` | `"eu-west-1"` | no |
5350
| <a name="input_tags"></a> [tags](#input\_tags) | Optional tags to add to created resources | `map(string)` | `{}` | no |
51+
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Optional prefix to add to resource names | `string` | `""` | no |
5452

5553
## Outputs
5654

57-
No outputs.
55+
No outputs.

examples/aws-workspace-basic/main.tf

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
module "aws-workspace-basic" {
22
source = "github.com/databricks/terraform-databricks-examples/modules/aws-workspace-basic"
33
databricks_account_id = var.databricks_account_id
4-
}
4+
region = var.region
5+
tags = var.tags
6+
prefix = var.prefix
7+
cidr_block = var.cidr_block
8+
}

examples/aws-workspace-basic/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ variable "region" {
2020
type = string
2121
description = "AWS region to deploy to"
2222
}
23+
24+
variable "prefix" {
25+
default = ""
26+
type = string
27+
description = "Prefix for use in the generated names"
28+
}

examples/aws-workspace-basic/versions.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ provider "aws" {
1919

2020
provider "databricks" {
2121
host = "https://accounts.cloud.databricks.com"
22-
}
22+
account_id = var.databricks_account_id
23+
}

modules/aws-workspace-basic/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ variable "region" {
2222
}
2323

2424
variable "prefix" {
25-
default = "demo"
25+
default = ""
2626
type = string
2727
description = "Prefix for use in the generated names"
2828
}

modules/aws-workspace-basic/workspace.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ resource "databricks_mws_storage_configurations" "this" {
1313
}
1414

1515
resource "databricks_mws_credentials" "this" {
16-
account_id = var.databricks_account_id
1716
role_arn = aws_iam_role.cross_account_role.arn
1817
credentials_name = "${local.prefix}-creds"
1918
depends_on = [time_sleep.wait]
@@ -39,4 +38,4 @@ resource "databricks_mws_workspaces" "this" {
3938
token {
4039
comment = "Terraform"
4140
}
42-
}
41+
}

0 commit comments

Comments
 (0)