Skip to content

Commit 11b550a

Browse files
fix(bench): fix alias and providers (#60)
* fix(bench) Fix alias and provider
1 parent f16cea3 commit 11b550a

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

examples/organization/main.tf

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@ EOT
88
EOT
99
}
1010

11+
# This provider is project specific, and can only be used to provision resources in the
12+
# specified project. Primarily used for Cloud Connector and Cloud Scanning
1113
provider "google" {
1214
project = var.project_id
1315
region = var.location
1416
}
1517

18+
# This provider is project agnostic, and can be used to provision resources in any project,
19+
# provided the project is specified on the resource. Primarily used for Benchmarks
20+
provider "google" {
21+
alias = "multiproject"
22+
region = var.location
23+
}
24+
25+
# This provider is project agnostic, and can be used to provision resources in any project,
26+
# provided the project is specified on the resource. Primarily used for Benchmarks
1627
provider "google-beta" {
17-
project = var.project_id
18-
region = var.location
28+
alias = "multiproject"
29+
region = var.location
1930
}
2031

2132
provider "sysdig" {
@@ -134,6 +145,11 @@ locals {
134145
}
135146

136147
module "cloud_bench" {
148+
providers = {
149+
google = google.multiproject
150+
google-beta = google-beta.multiproject
151+
}
152+
137153
count = var.deploy_bench ? 1 : 0
138154
source = "../../modules/services/cloud-bench"
139155

modules/services/cloud-bench/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ module "cloud_benchmark_gcp" {
1818
|------|---------|
1919
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 |
2020
| <a name="requirement_google"></a> [google](#requirement\_google) | >= 3.67.0 |
21+
| <a name="requirement_google-beta"></a> [google-beta](#requirement\_google-beta) | >= 3.67.0 |
22+
| <a name="requirement_sysdig"></a> [sysdig](#requirement\_sysdig) | >= 0.5.21 |
2123

2224
## Providers
2325

modules/services/cloud-bench/task/versions.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ terraform {
66
source = "hashicorp/google"
77
version = ">= 3.67.0"
88
}
9-
google-beta = {
10-
source = "hashicorp/google-beta"
11-
version = ">= 3.67.0"
12-
}
139
sysdig = {
1410
source = "sysdiglabs/sysdig"
1511
version = ">= 0.5.21"

modules/services/cloud-bench/trust_relationship/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ locals {
2020

2121
resource "sysdig_secure_cloud_account" "cloud_account" {
2222
account_id = data.google_project.project.number
23-
alias = data.google_project.project.id
2423
cloud_provider = "gcp"
2524
role_enabled = "true"
2625
role_name = var.role_name
26+
27+
# Required as datasource prefixes id with '/projects/':
28+
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project#id
29+
alias = trimprefix(data.google_project.project.id, "projects/")
2730
}
2831

2932
###################################################

modules/services/cloud-bench/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ terraform {
66
source = "hashicorp/google"
77
version = ">= 3.67.0"
88
}
9+
google-beta = {
10+
source = "hashicorp/google-beta"
11+
version = ">= 3.67.0"
12+
}
13+
sysdig = {
14+
source = "sysdiglabs/sysdig"
15+
version = ">= 0.5.21"
16+
}
917
}
1018
}

0 commit comments

Comments
 (0)