Created
September 27, 2021 22:05
-
-
Save trodemaster/98e49be72a04436b70fbf6288fa0061d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# setup the secrets engine | |
resource "vault_gcp_secret_backend" "gcp" { | |
description = var.GCP_SE_DESCRIPTION | |
path = "gcp/${var.GCP_SE_PATH}" | |
credentials = file(var.GCP_SE_CREDENTIALS_PATH) # google credentials in a json file | |
default_lease_ttl_seconds = var.GCP_SE_TTL | |
max_lease_ttl_seconds = var.GCP_SE_TTL_MAX | |
} | |
# Setup the role binding | |
resource "vault_gcp_secret_roleset" "gcp_se" { | |
backend = vault_gcp_secret_backend.gcp.path | |
roleset = var.GCP_SE_ROLESET | |
secret_type = "service_account_key" | |
project = var.GCP_SE_PROJECT | |
token_scopes = ["https://www.googleapis.com/auth/cloud-platform"] | |
binding { | |
resource = "//cloudresourcemanager.googleapis.com/projects/${var.GCP_SE_PROJECT}" | |
roles = var.GCP_SE_ROLES | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment