Created
September 2, 2020 01:01
-
-
Save echohtp/be9e33771d82d23a299118a3cd7dc5f9 to your computer and use it in GitHub Desktop.
Make a google bucket using terraform and an account that can generate service tokens.
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
provider "google" { | |
version = "~> 2.0, >= 2.5.1" | |
alias = "tokengen" | |
} | |
data "google_client_config" "default" { | |
provider = "google.tokengen" | |
} | |
data "google_service_account_access_token" "sa" { | |
provider = "google.tokengen" | |
target_service_account = "[email protected]" | |
lifetime = "600s" | |
scopes = [ | |
"https://www.googleapis.com/auth/cloud-platform", | |
] | |
} | |
/****************************************** | |
GA Provider configuration | |
*****************************************/ | |
provider "google" { | |
version = "~> 2.0, >= 2.5.1" | |
access_token = data.google_service_account_access_token.sa.access_token | |
project = "my-project-id" | |
} | |
/****************************************** | |
Beta Provider configuration | |
*****************************************/ | |
provider "google-beta" { | |
version = "~> 2.0, >= 2.5.1" | |
access_token = data.google_service_account_access_token.sa.access_token | |
project = "my-project-id" | |
} | |
resource "google_storage_bucket" "test" { | |
name = "my-project-id-test-bucket" | |
location = "us-west1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment