Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Terraform examples #167

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions examples/aws-workspace-basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,37 @@ This template provides an example of a simple deployment of AWS Databricks E2 wo
6. (Optional) Configure your [remote backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3)
7. Run `terraform init` to initialize terraform and get provider ready.
8. Run `terraform apply` to create the resources.

## Requirements

| Name | Version |
|------------------------------------------------------------------------------|----------|
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | >=1.13.0 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|---------|
| <a name="module_aws-workspace-basic"></a> [aws-workspace-basic](#module\_aws-workspace-basic) | github.com/databricks/terraform-databricks-examples/modules/aws-workspace-basic | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|-------------------------------------------------------------------------------------------------------|-------------------------------------------|---------------|-----------------|:--------:|
| <a name="input_cidr_block"></a> [cidr\_block](#input\_cidr\_block) | IP range for AWS VPC | `string` | `"10.4.0.0/16"` | no |
| <a name="input_databricks_account_id"></a> [databricks\_account\_id](#input\_databricks\_account\_id) | Databricks Account ID | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | AWS region to deploy to | `string` | `"eu-west-1"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Optional tags to add to created resources | `map(string)` | `{}` | no |

## Outputs

No outputs.
32 changes: 11 additions & 21 deletions examples/aws-workspace-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,49 +69,39 @@ The process will be: provision ordinary users -> assign users to groups -> assig

You can manage users/groups inside terraform. Examples were given in `main.tf`. Note that with Unity Catalog, you can have account level users/groups. The example here is at workspace level.

<!-- BEGIN_TF_DOCS -->
## Requirements

No requirements.

## Providers

| Name | Version |
| ---------------------------------------------------------------------------------- | ------- |
|------------------------------------------------------------------------------------|---------|
| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | 1.3.1 |
| <a name="provider_databricks.ws1"></a> [databricks.ws1](#provider\_databricks.ws1) | 1.3.1 |

## Modules

| Name | Source | Version |
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ------- |
| <a name="module_engineering_compute_policy"></a> [engineering\_compute\_policy](#module\_engineering\_compute\_policy) | ./modules/base_policy | n/a |
| <a name="module_ip_access_list_workspace_1"></a> [ip\_access\_list\_workspace\_1](#module\_ip\_access\_list\_workspace\_1) | ./modules/ip_access_list | n/a |
| <a name="module_ip_access_list_workspace_2"></a> [ip\_access\_list\_workspace\_2](#module\_ip\_access\_list\_workspace\_2) | ./modules/ip_access_list | n/a |

## Resources

| Name | Type |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| [databricks_cluster.tiny](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) | resource |
| [databricks_group.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) | resource |
| [databricks_group_member.vip_member](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_member) | resource |
| [databricks_user.user2](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/user) | resource |
| Name | Type |
|------|------|
| [databricks_cluster.tiny](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) | resource |
| [databricks_group.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) | resource |
| [databricks_group_member.vip_member](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_member) | resource |
| [databricks_user.user2](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/user) | resource |
| [databricks_spark_version.latest_lts](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/spark_version) | data source |
| [databricks_user.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/user) | data source |
| [databricks_user.this](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/user) | data source |

## Inputs

| Name | Description | Type | Default | Required |
| -------------------------------------------------------------- | ----------- | -------- | ------- | :------: |
|----------------------------------------------------------------|-------------|----------|---------|:--------:|
| <a name="input_pat_ws_1"></a> [pat\_ws\_1](#input\_pat\_ws\_1) | n/a | `string` | n/a | yes |
| <a name="input_pat_ws_2"></a> [pat\_ws\_2](#input\_pat\_ws\_2) | n/a | `string` | n/a | yes |

## Outputs

| Name | Description |
| --------------------------------------------------------------------------------------------------------------- | ----------- |
|-----------------------------------------------------------------------------------------------------------------|-------------|
| <a name="output_all_allow_lists_patched"></a> [all\_allow\_lists\_patched](#output\_all\_allow\_lists\_patched) | n/a |
| <a name="output_all_block_lists_patched"></a> [all\_block\_lists\_patched](#output\_all\_block\_lists\_patched) | n/a |
| <a name="output_sample_cluster_id"></a> [sample\_cluster\_id](#output\_sample\_cluster\_id) | n/a |
<!-- END_TF_DOCS -->
| <a name="output_sample_cluster_id"></a> [sample\_cluster\_id](#output\_sample\_cluster\_id) | n/a |
67 changes: 67 additions & 0 deletions examples/aws-workspace-uc-simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,70 @@ When running tf configs for UC resources, due to sometimes requires a few minute
> Step 1: Fill in values in `terraform.tfvars`; also configure env necessary variables for AWS provider authentication.

> Step 2: Run `terraform init` and `terraform apply` to deploy the resources. This will deploy both AWS resources that Unity Catalog requires and Databricks Account Level resources.

## Requirements

| Name | Version |
|------------------------------------------------------------------------------|-------------------|
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | >= 1.2.0, < 2.0.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | =3.4.1 |
| <a name="requirement_time"></a> [time](#requirement\_time) | =0.9.1 |

## Providers

| Name | Version |
|------------------------------------------------------------------------------------------------------|-------------------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
| <a name="provider_databricks.mws"></a> [databricks.mws](#provider\_databricks.mws) | >= 1.2.0, < 2.0.0 |
| <a name="provider_databricks.workspace"></a> [databricks.workspace](#provider\_databricks.workspace) | >= 1.2.0, < 2.0.0 |
| <a name="provider_random"></a> [random](#provider\_random) | =3.4.1 |
| <a name="provider_time"></a> [time](#provider\_time) | =0.9.1 |


## Resources

| Name | Type |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| [databricks_catalog.demo_catalog](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/catalog) | resource |
| [databricks_cluster.unity_catalog_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) | resource |
| [databricks_grants.unity_catalog_grants](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) | resource |
| [databricks_group.admin_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) | resource |
| [databricks_group.users](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) | resource |
| [databricks_group_member.admin_group_member](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_member) | resource |
| [databricks_group_member.my_service_principal](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_member) | resource |
| [databricks_group_member.users_group_members](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_member) | resource |
| [databricks_mws_permission_assignment.add_admin_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/mws_permission_assignment) | resource |
| [databricks_mws_permission_assignment.add_user_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/mws_permission_assignment) | resource |
| [databricks_user.unity_users](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/user) | resource |
| [random_string.naming](https://registry.terraform.io/providers/hashicorp/random/3.4.1/docs/resources/string) | resource |
| [time_sleep.wait_for_permission_apis](https://registry.terraform.io/providers/hashicorp/time/0.9.1/docs/resources/sleep) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [databricks_node_type.smallest](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/node_type) | data source |
| [databricks_service_principal.admin_service_principal](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/service_principal) | data source |
| [databricks_spark_version.latest_version](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/spark_version) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|---------|:--------:|
| <a name="input_aws_access_services_role_name"></a> [aws\_access\_services\_role\_name](#input\_aws\_access\_services\_role\_name) | (Optional) Name for the AWS Services role by this module | `string` | `null` | no |
| <a name="input_aws_profile"></a> [aws\_profile](#input\_aws\_profile) | (Required) AWS cli profile to be used for authentication with AWS | `string` | n/a | yes |
| <a name="input_cidr_block"></a> [cidr\_block](#input\_cidr\_block) | (Required) CIDR block to be used to create the Databricks VPC | `string` | n/a | yes |
| <a name="input_databricks_account_id"></a> [databricks\_account\_id](#input\_databricks\_account\_id) | (Required) Databricks Account ID | `string` | n/a | yes |
| <a name="input_databricks_client_id"></a> [databricks\_client\_id](#input\_databricks\_client\_id) | (Required) Client ID to authenticate the Databricks provider at the account level | `string` | n/a | yes |
| <a name="input_databricks_client_secret"></a> [databricks\_client\_secret](#input\_databricks\_client\_secret) | (Required) Client secret to authenticate the Databricks provider at the account level | `string` | n/a | yes |
| <a name="input_databricks_metastore_admins"></a> [databricks\_metastore\_admins](#input\_databricks\_metastore\_admins) | List of Admins to be added at account-level for Unity Catalog.<br/> Enter with square brackets and double quotes<br/> e.g ["[email protected]", "[email protected]"] | `list(string)` | n/a | yes |
| <a name="input_databricks_users"></a> [databricks\_users](#input\_databricks\_users) | List of Databricks users to be added at account-level for Unity Catalog.<br/> Enter with square brackets and double quotes<br/> e.g ["[email protected]", "[email protected]"] | `list(string)` | n/a | yes |
| <a name="input_my_username"></a> [my\_username](#input\_my\_username) | (Required) Username in the form of an email to be added to the tags and be declared as owner of the assets | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | (Required) AWS region where the assets will be deployed | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | (Optional) List of tags to be propagated accross all assets in this demo | `map(string)` | n/a | yes |
| <a name="input_unity_admin_group"></a> [unity\_admin\_group](#input\_unity\_admin\_group) | (Required) Name of the admin group. This group will be set as the owner of the Unity Catalog metastore | `string` | n/a | yes |
| <a name="input_workspace_name"></a> [workspace\_name](#input\_workspace\_name) | (Required) Databricks workspace name to be used for deployment | `string` | n/a | yes |

## Outputs

| Name | Description |
|------------------------------------------------------------------------------------------------------------------|--------------------------|
| <a name="output_databricks_workspace_id"></a> [databricks\_workspace\_id](#output\_databricks\_workspace\_id) | Databricks workspace ID |
| <a name="output_databricks_workspace_url"></a> [databricks\_workspace\_url](#output\_databricks\_workspace\_url) | Databricks workspace URL |
Loading