Skip to content

Commit 7690724

Browse files
authored
chore: Removes token usage to native impersonation (terraform-google-modules#656)
* Removes token usage to native impersonation * Remove unnecessary blank line
1 parent 6e17729 commit 7690724

File tree

16 files changed

+40
-299
lines changed

16 files changed

+40
-299
lines changed

1-org/envs/shared/providers.tf

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,13 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "600s"
35-
}
36-
3721
/******************************************
3822
Provider credential configuration
3923
*****************************************/
4024
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
25+
impersonate_service_account = local.tf_sa
4226
}
4327

4428
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
29+
impersonate_service_account = local.tf_sa
4630
}
47-

2-environments/envs/development/providers.tf

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,13 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "600s"
35-
}
36-
3721
/******************************************
3822
Provider credential configuration
3923
*****************************************/
4024
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
25+
impersonate_service_account = local.tf_sa
4226
}
4327

4428
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
29+
impersonate_service_account = local.tf_sa
4630
}
47-

2-environments/envs/non-production/providers.tf

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,13 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "600s"
35-
}
36-
3721
/******************************************
3822
Provider credential configuration
3923
*****************************************/
4024
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
25+
impersonate_service_account = local.tf_sa
4226
}
4327

4428
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
29+
impersonate_service_account = local.tf_sa
4630
}
47-

2-environments/envs/production/providers.tf

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,13 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "600s"
35-
}
36-
3721
/******************************************
3822
Provider credential configuration
3923
*****************************************/
4024
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
25+
impersonate_service_account = local.tf_sa
4226
}
4327

4428
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
29+
impersonate_service_account = local.tf_sa
4630
}
47-

3-networks/envs/development/providers.tf

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,16 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
42-
request_timeout = "60s"
26+
impersonate_service_account = local.tf_sa
27+
request_timeout = "60s"
4328
}
4429

4530
provider "google-beta" {
46-
access_token = data.google_service_account_access_token.default.access_token
47-
request_timeout = "60s"
31+
impersonate_service_account = local.tf_sa
32+
request_timeout = "60s"
4833
}
49-

3-networks/envs/non-production/providers.tf

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,16 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
42-
request_timeout = "60s"
26+
impersonate_service_account = local.tf_sa
27+
request_timeout = "60s"
4328
}
4429

4530
provider "google-beta" {
46-
access_token = data.google_service_account_access_token.default.access_token
47-
request_timeout = "60s"
31+
impersonate_service_account = local.tf_sa
32+
request_timeout = "60s"
4833
}
49-

3-networks/envs/production/providers.tf

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,16 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
42-
request_timeout = "60s"
26+
impersonate_service_account = local.tf_sa
27+
request_timeout = "60s"
4328
}
4429

4530
provider "google-beta" {
46-
access_token = data.google_service_account_access_token.default.access_token
47-
request_timeout = "60s"
31+
impersonate_service_account = local.tf_sa
32+
request_timeout = "60s"
4833
}
49-

3-networks/envs/shared/providers.tf

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,16 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
42-
request_timeout = "60s"
26+
impersonate_service_account = local.tf_sa
27+
request_timeout = "60s"
4328
}
4429

4530
provider "google-beta" {
46-
access_token = data.google_service_account_access_token.default.access_token
47-
request_timeout = "60s"
31+
impersonate_service_account = local.tf_sa
32+
request_timeout = "60s"
4833
}
49-

4-projects/business_unit_1/development/providers.tf

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,14 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
26+
impersonate_service_account = local.tf_sa
4227
}
4328

4429
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
30+
impersonate_service_account = local.tf_sa
4631
}

4-projects/business_unit_1/non-production/providers.tf

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,13 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
36-
3721
/******************************************
3822
Provider credential configuration
3923
*****************************************/
4024
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
25+
impersonate_service_account = local.tf_sa
4226
}
4327

4428
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
29+
impersonate_service_account = local.tf_sa
4630
}

4-projects/business_unit_1/production/providers.tf

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,14 @@ locals {
1818
tf_sa = var.terraform_service_account
1919
}
2020

21-
provider "google" {
22-
alias = "impersonate"
23-
24-
scopes = [
25-
"https://www.googleapis.com/auth/cloud-platform",
26-
"https://www.googleapis.com/auth/userinfo.email",
27-
]
28-
}
29-
30-
data "google_service_account_access_token" "default" {
31-
provider = google.impersonate
32-
target_service_account = local.tf_sa
33-
scopes = ["userinfo-email", "cloud-platform"]
34-
lifetime = "1200s"
35-
}
3621

3722
/******************************************
3823
Provider credential configuration
3924
*****************************************/
4025
provider "google" {
41-
access_token = data.google_service_account_access_token.default.access_token
26+
impersonate_service_account = local.tf_sa
4227
}
4328

4429
provider "google-beta" {
45-
access_token = data.google_service_account_access_token.default.access_token
30+
impersonate_service_account = local.tf_sa
4631
}

0 commit comments

Comments
 (0)