Merge pull request #271 from terraform-google-modules/df-cmek-01
Add support for CMEK keys in Data Foundation end to end example
This commit is contained in:
commit
37b19ec330
|
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
## [Unreleased]
|
||||
- create `pubsub` service identity if service is enabled
|
||||
- support for creation of GKE Autopilot clusters
|
||||
- Add support for CMEK keys in Data Foundation end to end example
|
||||
|
||||
## [5.0.0] - 2021-06-17
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ Once done testing, you can clean up resources by running `terraform destroy`.
|
|||
| *prefix* | Prefix used to generate project id and name. | <code title="">string</code> | | <code title="">null</code> |
|
||||
| *project_names* | Override this variable if you need non-standard names. | <code title="object({ datamart = string dwh = string landing = string services = string transformation = string })">object({...})</code> | | <code title="{ datamart = "datamart" dwh = "datawh" landing = "landing" services = "services" transformation = "transformation" }">...</code> |
|
||||
| *service_account_names* | Override this variable if you need non-standard names. | <code title="object({ main = string })">object({...})</code> | | <code title="{ main = "data-platform-main" }">...</code> |
|
||||
| *service_encryption_key_ids* | Cloud KMS encryption key in {LOCATION => [KEY_URL]} format. Keys belong to existing project. | <code title="object({ multiregional = string global = string })">object({...})</code> | | <code title="{ multiregional = null global = null }">...</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
@ -50,4 +51,5 @@ Once done testing, you can clean up resources by running `terraform destroy`.
|
|||
|---|---|:---:|
|
||||
| project_ids | Project ids for created projects. | |
|
||||
| service_account | Main service account. | |
|
||||
| service_encryption_key_ids | Cloud KMS encryption keys in {LOCATION => [KEY_URL]} format. | |
|
||||
<!-- END TFDOC -->
|
||||
|
|
|
@ -25,16 +25,19 @@ module "project-datamart" {
|
|||
prefix = var.prefix
|
||||
name = var.project_names.datamart
|
||||
services = [
|
||||
"bigtable.googleapis.com",
|
||||
"bigtableadmin.googleapis.com",
|
||||
"bigquery.googleapis.com",
|
||||
"bigquerystorage.googleapis.com",
|
||||
"bigqueryreservation.googleapis.com",
|
||||
"storage.googleapis.com",
|
||||
"storage-component.googleapis.com",
|
||||
]
|
||||
iam = {
|
||||
"roles/editor" = [module.sa-services-main.iam_email]
|
||||
}
|
||||
service_encryption_key_ids = {
|
||||
bq = [var.service_encryption_key_ids.multiregional]
|
||||
storage = [var.service_encryption_key_ids.multiregional]
|
||||
}
|
||||
}
|
||||
|
||||
module "project-dwh" {
|
||||
|
@ -47,11 +50,16 @@ module "project-dwh" {
|
|||
"bigquery.googleapis.com",
|
||||
"bigquerystorage.googleapis.com",
|
||||
"bigqueryreservation.googleapis.com",
|
||||
"storage.googleapis.com",
|
||||
"storage-component.googleapis.com",
|
||||
]
|
||||
iam = {
|
||||
"roles/editor" = [module.sa-services-main.iam_email]
|
||||
}
|
||||
service_encryption_key_ids = {
|
||||
bq = [var.service_encryption_key_ids.multiregional]
|
||||
storage = [var.service_encryption_key_ids.multiregional]
|
||||
}
|
||||
}
|
||||
|
||||
module "project-landing" {
|
||||
|
@ -62,11 +70,16 @@ module "project-landing" {
|
|||
name = var.project_names.landing
|
||||
services = [
|
||||
"pubsub.googleapis.com",
|
||||
"storage.googleapis.com",
|
||||
"storage-component.googleapis.com",
|
||||
]
|
||||
iam = {
|
||||
"roles/editor" = [module.sa-services-main.iam_email]
|
||||
}
|
||||
service_encryption_key_ids = {
|
||||
pubsub = [var.service_encryption_key_ids.global]
|
||||
storage = [var.service_encryption_key_ids.multiregional]
|
||||
}
|
||||
}
|
||||
|
||||
module "project-services" {
|
||||
|
@ -76,14 +89,19 @@ module "project-services" {
|
|||
prefix = var.prefix
|
||||
name = var.project_names.services
|
||||
services = [
|
||||
"storage.googleapis.com",
|
||||
"storage-component.googleapis.com",
|
||||
"sourcerepo.googleapis.com",
|
||||
"stackdriver.googleapis.com",
|
||||
"cloudasset.googleapis.com",
|
||||
"cloudkms.googleapis.com"
|
||||
]
|
||||
iam = {
|
||||
"roles/editor" = [module.sa-services-main.iam_email]
|
||||
}
|
||||
service_encryption_key_ids = {
|
||||
storage = [var.service_encryption_key_ids.multiregional]
|
||||
}
|
||||
}
|
||||
|
||||
module "project-transformation" {
|
||||
|
@ -97,11 +115,17 @@ module "project-transformation" {
|
|||
"compute.googleapis.com",
|
||||
"dataflow.googleapis.com",
|
||||
"servicenetworking.googleapis.com",
|
||||
"storage.googleapis.com",
|
||||
"storage-component.googleapis.com",
|
||||
]
|
||||
iam = {
|
||||
"roles/editor" = [module.sa-services-main.iam_email]
|
||||
}
|
||||
service_encryption_key_ids = {
|
||||
compute = [var.service_encryption_key_ids.global]
|
||||
storage = [var.service_encryption_key_ids.multiregional]
|
||||
dataflow = [var.service_encryption_key_ids.global]
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
@ -25,6 +25,11 @@ output "project_ids" {
|
|||
}
|
||||
}
|
||||
|
||||
output "service_encryption_key_ids" {
|
||||
description = "Cloud KMS encryption keys in {LOCATION => [KEY_URL]} format."
|
||||
value = var.service_encryption_key_ids
|
||||
}
|
||||
|
||||
output "service_account" {
|
||||
description = "Main service account."
|
||||
value = module.sa-services-main.email
|
||||
|
|
|
@ -55,3 +55,15 @@ variable "service_account_names" {
|
|||
main = "data-platform-main"
|
||||
}
|
||||
}
|
||||
|
||||
variable "service_encryption_key_ids" {
|
||||
description = "Cloud KMS encryption key in {LOCATION => [KEY_URL]} format. Keys belong to existing project."
|
||||
type = object({
|
||||
multiregional = string
|
||||
global = string
|
||||
})
|
||||
default = {
|
||||
multiregional = null
|
||||
global = null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ Once done testing, you can clean up resources by running `terraform destroy`.
|
|||
| *landing_pubsub* | List of landing pubsub topics and subscriptions to create | <code title="map(map(object({ iam = map(list(string)) labels = map(string) options = object({ ack_deadline_seconds = number message_retention_duration = number retain_acked_messages = bool expiration_policy_ttl = number }) })))">map(map(object({...})))</code> | | <code title="{ landing-1 = { sub1 = { iam = { } labels = {} options = null } sub2 = { iam = {} labels = {}, options = null }, } }">...</code> |
|
||||
| *landing_service_account* | landing service accounts list. | <code title="">string</code> | | <code title="">sa-landing</code> |
|
||||
| *service_account_names* | Project service accounts list. | <code title="object({ datamart = string dwh = string landing = string services = string transformation = string })">object({...})</code> | | <code title="{ datamart = "sa-datamart" dwh = "sa-datawh" landing = "sa-landing" services = "sa-services" transformation = "sa-transformation" }">...</code> |
|
||||
| *service_encryption_key_ids* | Cloud KMS encryption key in {LOCATION => [KEY_URL]} format. Keys belong to existing project. | <code title="object({ multiregional = string global = string })">object({...})</code> | | <code title="{ multiregional = null global = null }">...</code> |
|
||||
| *transformation_buckets* | List of transformation buckets to create | <code title="map(object({ location = string name = string }))">map(object({...}))</code> | | <code title="{ temp = { location = "EU" name = "temp" }, templates = { location = "EU" name = "templates" }, }">...</code> |
|
||||
| *transformation_subnets* | List of subnets to create in the transformation Project. | <code title="list(object({ ip_cidr_range = string name = string region = string secondary_ip_range = map(string) }))">list(object({...}))</code> | | <code title="[ { ip_cidr_range = "10.1.0.0/20" name = "transformation-subnet" region = "europe-west3" secondary_ip_range = {} }, ]">...</code> |
|
||||
| *transformation_vpc_name* | Name of the VPC created in the transformation Project. | <code title="">string</code> | | <code title="">transformation-vpc</code> |
|
||||
|
|
|
@ -85,6 +85,7 @@ module "landing-buckets" {
|
|||
"roles/storage.objectCreator" = [module.landing-sa.iam_email]
|
||||
"roles/storage.admin" = [module.transformation-sa.iam_email]
|
||||
}
|
||||
encryption_key = var.service_encryption_key_ids.multiregional
|
||||
}
|
||||
|
||||
module "transformation-buckets" {
|
||||
|
@ -97,6 +98,7 @@ module "transformation-buckets" {
|
|||
iam = {
|
||||
"roles/storage.admin" = [module.transformation-sa.iam_email]
|
||||
}
|
||||
encryption_key = var.service_encryption_key_ids.multiregional
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -116,6 +118,7 @@ module "datamart-bq" {
|
|||
: v
|
||||
)
|
||||
}
|
||||
encryption_key = var.service_encryption_key_ids.multiregional
|
||||
}
|
||||
|
||||
module "dwh-bq" {
|
||||
|
@ -131,6 +134,7 @@ module "dwh-bq" {
|
|||
: v
|
||||
)
|
||||
}
|
||||
encryption_key = var.service_encryption_key_ids.multiregional
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -160,4 +164,5 @@ module "landing-pubsub" {
|
|||
"roles/pubsub.subscriber" = [module.transformation-sa.iam_email]
|
||||
})
|
||||
}
|
||||
kms_key = var.service_encryption_key_ids.global
|
||||
}
|
||||
|
|
|
@ -169,3 +169,15 @@ variable "transformation_vpc_name" {
|
|||
type = string
|
||||
default = "transformation-vpc"
|
||||
}
|
||||
|
||||
variable "service_encryption_key_ids" {
|
||||
description = "Cloud KMS encryption key in {LOCATION => [KEY_URL]} format. Keys belong to existing project."
|
||||
type = object({
|
||||
multiregional = string
|
||||
global = string
|
||||
})
|
||||
default = {
|
||||
multiregional = null
|
||||
global = null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,4 @@ def test_resources(e2e_plan_runner):
|
|||
"Test that plan works and the numbers of resources is as expected."
|
||||
modules, resources = e2e_plan_runner(FIXTURES_DIR)
|
||||
assert len(modules) == 6
|
||||
assert len(resources) == 35
|
||||
assert len(resources) == 44
|
||||
|
|
Loading…
Reference in New Issue