Skip to content

Commit 5b7a5c9

Browse files
authored
Merge pull request #30 from tomarv2/develop
fixing PAT token and adding custom tags to s3
2 parents 9a1a9a1 + 5a3126d commit 5b7a5c9

File tree

11 files changed

+74
-46
lines changed

11 files changed

+74
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ _testmain.go
8181

8282
# ignore test file(s)
8383
**test**
84+
.external_modules

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ repos:
2525
- id: check-yaml
2626

2727
- repo: https://github.com/bridgecrewio/checkov.git
28-
rev: '2.0.531'
28+
rev: '2.0.868'
2929
hooks:
3030
- id: checkov
3131
verbose: true
32-
args: [-d, '.', --framework, 'terraform']
32+
args: [-d, '.', --framework, 'terraform', --download-external-modules, 'True', '--skip-check', "CKV2_AWS_6,CKV2_AWS_11,CKV2_AWS_12,CKV_AWS_18,CKV2_AWS_19,CKV_AWS_130,CKV_AWS_144,CKV_AWS_145"]

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,58 +177,60 @@ Error: MALFORMED_REQUEST: Failed credentials validation checks: Spot Cancellatio
177177
|------|---------|
178178
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.1 |
179179
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.47 |
180-
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | 0.3.5 |
180+
| <a name="requirement_databricks"></a> [databricks](#requirement\_databricks) | 0.4.7 |
181181
| <a name="requirement_random"></a> [random](#requirement\_random) | ~> 3.1 |
182182
| <a name="requirement_time"></a> [time](#requirement\_time) | ~> 0.7 |
183183

184184
## Providers
185185

186186
| Name | Version |
187187
|------|---------|
188-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.38.0 |
189-
| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | 0.3.3 |
190-
| <a name="provider_databricks.mws"></a> [databricks.mws](#provider\_databricks.mws) | 0.3.3 |
191-
| <a name="provider_random"></a> [random](#provider\_random) | 3.1.0 |
192-
| <a name="provider_time"></a> [time](#provider\_time) | 0.7.1 |
188+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.47 |
189+
| <a name="provider_databricks"></a> [databricks](#provider\_databricks) | 0.4.7 |
190+
| <a name="provider_databricks.mws"></a> [databricks.mws](#provider\_databricks.mws) | 0.4.7 |
191+
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.1 |
192+
| <a name="provider_time"></a> [time](#provider\_time) | ~> 0.7 |
193193

194194
## Modules
195195

196196
| Name | Source | Version |
197197
|------|--------|---------|
198198
| <a name="module_iam_policies"></a> [iam\_policies](#module\_iam\_policies) | git::git@github.com:tomarv2/terraform-aws-iam-policies.git | v0.0.4 |
199-
| <a name="module_iam_role"></a> [iam\_role](#module\_iam\_role) | git::git@github.com:tomarv2/terraform-aws-iam-role.git//modules/iam_role_external | v0.0.4 |
200-
| <a name="module_s3"></a> [s3](#module\_s3) | git::git@github.com:tomarv2/terraform-aws-s3.git | v0.0.3 |
199+
| <a name="module_iam_role"></a> [iam\_role](#module\_iam\_role) | git::git@github.com:tomarv2/terraform-aws-iam-role.git//modules/iam_role_external | v0.0.7 |
200+
| <a name="module_s3"></a> [s3](#module\_s3) | git::git@github.com:tomarv2/terraform-aws-s3.git | v0.0.7 |
201201
| <a name="module_vpc"></a> [vpc](#module\_vpc) | git::git@github.com:tomarv2/terraform-aws-vpc.git | v0.0.4 |
202202

203203
## Resources
204204

205205
| Name | Type |
206206
|------|------|
207207
| [aws_s3_bucket_policy.root_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
208-
| [databricks_mws_credentials.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/resources/mws_credentials) | resource |
209-
| [databricks_mws_networks.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/resources/mws_networks) | resource |
210-
| [databricks_mws_storage_configurations.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/resources/mws_storage_configurations) | resource |
211-
| [databricks_mws_workspaces.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/resources/mws_workspaces) | resource |
208+
| [databricks_mws_credentials.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/resources/mws_credentials) | resource |
209+
| [databricks_mws_networks.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/resources/mws_networks) | resource |
210+
| [databricks_mws_storage_configurations.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/resources/mws_storage_configurations) | resource |
211+
| [databricks_mws_workspaces.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/resources/mws_workspaces) | resource |
212212
| [random_string.naming](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |
213213
| [time_sleep.wait](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
214-
| [databricks_aws_assume_role_policy.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/data-sources/aws_assume_role_policy) | data source |
215-
| [databricks_aws_bucket_policy.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/data-sources/aws_bucket_policy) | data source |
216-
| [databricks_aws_crossaccount_policy.cross_account_iam_policy](https://registry.terraform.io/providers/databrickslabs/databricks/0.3.5/docs/data-sources/aws_crossaccount_policy) | data source |
214+
| [databricks_aws_assume_role_policy.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/data-sources/aws_assume_role_policy) | data source |
215+
| [databricks_aws_bucket_policy.this](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/data-sources/aws_bucket_policy) | data source |
216+
| [databricks_aws_crossaccount_policy.cross_account_iam_policy](https://registry.terraform.io/providers/databrickslabs/databricks/0.4.7/docs/data-sources/aws_crossaccount_policy) | data source |
217217

218218
## Inputs
219219

220220
| Name | Description | Type | Default | Required |
221221
|------|-------------|------|---------|:--------:|
222222
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | default aws region | `string` | `"us-west-2"` | no |
223223
| <a name="input_cidr_block"></a> [cidr\_block](#input\_cidr\_block) | The CIDR block for the VPC | `string` | `"10.4.0.0/16"` | no |
224+
| <a name="input_custom_tags"></a> [custom\_tags](#input\_custom\_tags) | Extra custom tags | `any` | `null` | no |
224225
| <a name="input_databricks_account_id"></a> [databricks\_account\_id](#input\_databricks\_account\_id) | External ID provided by third party. | `string` | n/a | yes |
225226
| <a name="input_databricks_account_password"></a> [databricks\_account\_password](#input\_databricks\_account\_password) | databricks account password | `string` | n/a | yes |
226227
| <a name="input_databricks_account_username"></a> [databricks\_account\_username](#input\_databricks\_account\_username) | databricks account username | `string` | n/a | yes |
228+
| <a name="input_databricks_hostname"></a> [databricks\_hostname](#input\_databricks\_hostname) | databricks hostname | `string` | `"https://accounts.cloud.databricks.com"` | no |
227229
| <a name="input_existing_role_name"></a> [existing\_role\_name](#input\_existing\_role\_name) | If you want to use existing role name, else a new role will be created | `string` | `null` | no |
228-
| <a name="input_prjid"></a> [prjid](#input\_prjid) | (Required) Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes |
230+
| <a name="input_prjid"></a> [prjid](#input\_prjid) | Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes |
229231
| <a name="input_profile_for_iam"></a> [profile\_for\_iam](#input\_profile\_for\_iam) | profile to use for IAM | `string` | `null` | no |
230232
| <a name="input_profile_to_use"></a> [profile\_to\_use](#input\_profile\_to\_use) | Getting values from ~/.aws/credentials | `string` | `"default"` | no |
231-
| <a name="input_teamid"></a> [teamid](#input\_teamid) | (Required) Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes |
233+
| <a name="input_teamid"></a> [teamid](#input\_teamid) | Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes |
232234

233235
## Outputs
234236

@@ -249,6 +251,6 @@ Error: MALFORMED_REQUEST: Failed credentials validation checks: Spot Cancellatio
249251
| <a name="output_storage_configuration_id"></a> [storage\_configuration\_id](#output\_storage\_configuration\_id) | databricks storage configuration id |
250252
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | vpc id |
251253
| <a name="output_vpc_route_table_ids"></a> [vpc\_route\_table\_ids](#output\_vpc\_route\_table\_ids) | list of VPC route tables IDs |
252-
| <a name="output_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#output\_vpc\_security\_group\_ids) | list of VPC security group IDs |
254+
| <a name="output_vpc_security_group_id"></a> [vpc\_security\_group\_id](#output\_vpc\_security\_group\_id) | list of VPC security group ID |
253255
| <a name="output_vpc_subnet_ids"></a> [vpc\_subnet\_ids](#output\_vpc\_subnet\_ids) | list of subnet ids within VPC |
254256
| <a name="output_workspace_url"></a> [workspace\_url](#output\_workspace\_url) | databricks workspace url |

examples/sample/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ module "databricks_workspace" {
1414
databricks_account_username = "example@example.com"
1515
databricks_account_password = "sample123!"
1616
databricks_account_id = "1234567-1234-1234-1234-1234567"
17+
18+
custom_tags = tomap(
19+
{
20+
"Dept" = "data",
21+
"Application" = "demo"
22+
}
23+
)
1724
# -----------------------------------------
1825
# Do not change the teamid, prjid once set.
1926
teamid = var.teamid

examples/sample/outputs.tf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ output "databricks_deployment_name" {
5454
value = module.databricks_workspace.databricks_deployment_name
5555
}
5656

57-
/*
58-
output "pat_token" {
59-
description = "databricks pat"
57+
output "sensitive_databricks_token" {
58+
description = "Value of the newly created token"
6059
value = module.databricks_workspace.databricks_token
6160
sensitive = true
6261
}
63-
*/
62+
63+
output "databricks_token" {
64+
description = "Value of the newly created token (nonsensitive)"
65+
value = module.databricks_workspace.nonsensitive_databricks_token
66+
}
67+
68+
output "databricks_token_lifetime_hours" {
69+
description = "Token validity"
70+
value = module.databricks_workspace.databricks_token_lifetime_hours
71+
}

examples/sample/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
variable "teamid" {
2-
description = "(Required) Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'"
2+
description = "Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'"
33
type = string
44
}
55

66
variable "prjid" {
7-
description = "(Required) Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'"
7+
description = "Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'"
88
type = string
99
}

main.tf

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,3 @@ module "iam_policies" {
5858
aws = aws.iam-management
5959
}
6060
}
61-
62-
module "s3" {
63-
source = "git::git@github.com:tomarv2/terraform-aws-s3.git?ref=v0.0.7"
64-
65-
# -----------------------------------------
66-
# Do not change the teamid, prjid once set.
67-
teamid = var.teamid
68-
prjid = "${var.prjid}-${local.suffix}"
69-
}

outputs.tf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,18 @@ output "workspace_url" {
8787
value = databricks_mws_workspaces.this
8888
}
8989

90-
/*
9190
output "databricks_token" {
92-
description = "databricks token"
93-
value = databricks_token.pat.id
91+
description = "Value of the newly created token"
92+
value = databricks_token.pat.token_value
9493
sensitive = true
9594
}
96-
*/
95+
96+
output "nonsensitive_databricks_token" {
97+
description = "Value of the newly created token (nonsensitive)"
98+
value = nonsensitive(databricks_token.pat.token_value)
99+
}
100+
101+
output "databricks_token_lifetime_hours" {
102+
description = "Token validity"
103+
value = databricks_token.pat.lifetime_seconds / 3600
104+
}

pat_token.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
/* Create PAT token to provision entities within workspace
2-
https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/resources/token
3-
*/
4-
/*
51
resource "databricks_token" "pat" {
62
provider = databricks.created_workspace
73

84
comment = "Terraform managed: ${var.teamid}-${var.prjid}"
95
lifetime_seconds = 86400
106
}
11-
*/

s3.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
module "s3" {
2+
source = "git::git@github.com:tomarv2/terraform-aws-s3.git?ref=v0.0.7"
3+
4+
custom_tags = var.custom_tags
5+
# -----------------------------------------
6+
# Do not change the teamid, prjid once set.
7+
teamid = var.teamid
8+
prjid = "${var.prjid}-${local.suffix}"
9+
}
10+
111
data "databricks_aws_bucket_policy" "this" {
212
bucket = module.s3.bucket_name
313
}

0 commit comments

Comments
 (0)