Skip to content

Commit 1abd8c7

Browse files
authored
chore: Add service_account variable on examples missing it (#234)
* Add service_account variable on examples missing it * Fix indentation. Not sure why it did not run automatically
1 parent 4f21330 commit 1abd8c7

File tree

10 files changed

+46
-10
lines changed

10 files changed

+46
-10
lines changed

examples/compute_instance/disk_snapshot/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is a simple example of how to use the compute_disk_snapshot module
99
|------|-------------|------|---------|:--------:|
1010
| project\_id | The GCP project to use for integration tests | `string` | n/a | yes |
1111
| region | The GCP region to create and test resources in | `string` | `"us-central1"` | no |
12+
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | <pre>object({<br> email = string,<br> scopes = set(string)<br> })</pre> | `null` | no |
1213
| subnetwork | The subnetwork selflink to host the compute instances in | `any` | n/a | yes |
1314

1415
## Outputs

examples/compute_instance/disk_snapshot/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module "instance_template" {
3131
project_id = var.project_id
3232
subnetwork = var.subnetwork
3333
name_prefix = "instance-disk-snapshot"
34-
service_account = null
34+
service_account = var.service_account
3535

3636
additional_disks = [
3737
{

examples/compute_instance/disk_snapshot/variables.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,11 @@ variable "subnetwork" {
2929
description = "The subnetwork selflink to host the compute instances in"
3030
}
3131

32-
32+
variable "service_account" {
33+
default = null
34+
type = object({
35+
email = string,
36+
scopes = set(string)
37+
})
38+
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
39+
}

examples/mig/healthcheck/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ group with an autoscaler.
1010
|------|-------------|------|---------|:--------:|
1111
| project\_id | The GCP project to use for integration tests | `string` | n/a | yes |
1212
| region | The GCP region to create and test resources in | `string` | `"us-central1"` | no |
13+
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | <pre>object({<br> email = string,<br> scopes = set(string)<br> })</pre> | `null` | no |
1314

1415
## Outputs
1516

examples/mig/healthcheck/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module "instance_template" {
5454
source = "../../../modules/instance_template"
5555
project_id = var.project_id
5656
subnetwork = google_compute_subnetwork.main.name
57-
service_account = null
57+
service_account = var.service_account
5858
}
5959

6060
/** Instance Group within autoscale and health check **/

examples/mig/healthcheck/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ variable "region" {
2424
type = string
2525
default = "us-central1"
2626
}
27+
28+
variable "service_account" {
29+
default = null
30+
type = object({
31+
email = string,
32+
scopes = set(string)
33+
})
34+
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
35+
}

test/fixtures/compute_instance/disk_snapshot/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717

1818
module "disk_snapshot" {
19-
source = "../../../../examples/compute_instance/disk_snapshot"
20-
project_id = var.project_id
21-
region = "us-central1"
22-
subnetwork = google_compute_subnetwork.main.self_link
19+
source = "../../../../examples/compute_instance/disk_snapshot"
20+
project_id = var.project_id
21+
region = "us-central1"
22+
subnetwork = google_compute_subnetwork.main.self_link
23+
service_account = var.service_account
2324
}

test/fixtures/compute_instance/disk_snapshot/variables.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,11 @@ variable "project_id" {
1818
description = "The GCP project to use for integration tests"
1919
}
2020

21-
21+
variable "service_account" {
22+
default = null
23+
type = object({
24+
email = string
25+
scopes = list(string)
26+
})
27+
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
28+
}

test/fixtures/mig/healthcheck/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
module "mig_healthcheck" {
18-
source = "../../../../examples/mig/healthcheck"
19-
project_id = var.project_id
18+
source = "../../../../examples/mig/healthcheck"
19+
project_id = var.project_id
20+
service_account = var.service_account
2021
}

test/fixtures/mig/healthcheck/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@
1717
variable "project_id" {
1818
description = "The GCP project to use for integration tests"
1919
}
20+
21+
variable "service_account" {
22+
default = null
23+
type = object({
24+
email = string
25+
scopes = list(string)
26+
})
27+
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
28+
}

0 commit comments

Comments
 (0)