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

Refactor cloud run module to use optionals and support all features #1293

Merged
merged 18 commits into from
Apr 1, 2023
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
59 changes: 33 additions & 26 deletions blueprints/serverless/cloud-run-corporate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ locals {
cloud_run_domain = "run.app."
service_name_cr1 = "cart"
service_name_cr2 = "checkout"
tf_id = (var.tf_identity == null ? null :
length(regexall("iam.gserviceaccount.com", var.tf_identity)) > 0 ?
"serviceAccount:${var.tf_identity}" : "user:${var.tf_identity}")
vpc_sc_create = (length(module.project_prj1) > 0 &&
(var.access_policy != null || var.access_policy_create != null)) ? 1 : 0
tf_id = (
var.tf_identity == null
? null
: (
length(regexall("iam.gserviceaccount.com", var.tf_identity)) > 0
? "serviceAccount:${var.tf_identity}"
: "user:${var.tf_identity}"
)
)
vpc_sc_create = (
(
length(module.project_prj1) > 0
&&
(var.access_policy != null || var.access_policy_create != null)
)
? 1
: 0
)
}

###############################################################################
Expand Down Expand Up @@ -109,13 +122,11 @@ module "cloud_run_hello" {
project_id = module.project_main.project_id
name = "hello"
region = var.region
containers = [{
image = var.image
options = null
ports = null
resources = null
volume_mounts = null
}]
containers = {
default = {
image = var.image
}
}
iam = {
"roles/run.invoker" = ["allUsers"]
}
Expand All @@ -129,13 +140,11 @@ module "cloud_run_cart" {
project_id = module.project_svc1[0].project_id
name = local.service_name_cr1 # "cart"
region = var.region
containers = [{
image = var.image
options = null
ports = null
resources = null
volume_mounts = null
}]
containers = {
default = {
image = var.image
}
}
iam = {
"roles/run.invoker" = ["allUsers"]
}
Expand All @@ -149,13 +158,11 @@ module "cloud_run_checkout" {
project_id = module.project_svc1[0].project_id
name = local.service_name_cr2 # "checkout"
region = var.region
containers = [{
image = var.image
options = null
ports = null
resources = null
volume_mounts = null
}]
containers = {
default = {
image = var.image
}
}
iam = {
"roles/run.invoker" = ["allUsers"]
}
Expand Down
12 changes: 5 additions & 7 deletions blueprints/serverless/cloud-run-explore/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ module "cloud_run" {
project_id = module.project.project_id
name = var.run_svc_name
region = var.region
containers = [{
image = var.image
options = null
ports = null
resources = null
volume_mounts = null
}]
containers = {
default = {
image = var.image
}
}
iam = {
"roles/run.invoker" = ["allUsers"]
}
Expand Down
Loading