-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add roles/cloudsql.client binding for the data project (#126)
Requires a new module under data/ because: * apps depends on data to exist for the Cloud SQL connection * This new IAM binding in data requires apps to exist to know the service account Co-authored-by: Martin Petkov <mpetkov@google.com>
- Loading branch information
1 parent
25eabc0
commit 2736151
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Terraform/org/folder.fda-my-studies/project.heroes-hat-dev-apps/apps/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "service_account" { | ||
value = module.heroes_hat_cluster.service_account | ||
} |
9 changes: 9 additions & 0 deletions
9
Terraform/org/folder.fda-my-studies/project.heroes-hat-dev-data/iam/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
backend "gcs" {} | ||
} | ||
|
||
resource "google_project_iam_member" "gke_sql_access" { | ||
project = var.project_id | ||
role = "roles/cloudsql.client" | ||
member = var.gke_service_account | ||
} |
1 change: 1 addition & 0 deletions
1
Terraform/org/folder.fda-my-studies/project.heroes-hat-dev-data/iam/terraform.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
project_id = "heroes-hat-dev-data" |
20 changes: 20 additions & 0 deletions
20
Terraform/org/folder.fda-my-studies/project.heroes-hat-dev-data/iam/terragrunt.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
dependency "project" { | ||
config_path = "../project" | ||
skip_outputs = true | ||
} | ||
|
||
dependency "apps" { | ||
config_path = "../../project.heroes-hat-dev-apps/apps" | ||
|
||
mock_outputs = { | ||
service_account = "mock-service-account" | ||
} | ||
} | ||
|
||
inputs = { | ||
gke_service_account = dependency.apps.outputs.service_account | ||
} |
9 changes: 9 additions & 0 deletions
9
Terraform/org/folder.fda-my-studies/project.heroes-hat-dev-data/iam/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "project_id" { | ||
type = string | ||
} | ||
|
||
variable "gke_service_account" { | ||
description = "The service account used by the GKE cluster" | ||
type = string | ||
} | ||
|