Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created May 19, 2020 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magickatt/dadc95748c6ac74d42787fa6a11d322e to your computer and use it in GitHub Desktop.
Save magickatt/dadc95748c6ac74d42787fa6a11d322e to your computer and use it in GitHub Desktop.
Create Google Cloud Platform service account credentials JSON using Terraform
resource "google_service_account" "service_account" {
account_id = "test
display_name = "Test"
}
resource "google_service_account_key" "service_account" {
service_account_id = google_service_account.service_account.name
public_key_type = "TYPE_X509_PEM_FILE"
}
resource "local_file" "service_account" {
content = base64decode(google_service_account_key.service_account.private_key)
filename = "../../serviceaccount.json"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment