Skip to content

Commit

Permalink
chore: Add service_account variable on examples missing it (#234)
Browse files Browse the repository at this point in the history
* Add service_account variable on examples missing it

* Fix indentation. Not sure why it did not run automatically
  • Loading branch information
thiagonache authored Feb 14, 2022
1 parent 4f21330 commit 1abd8c7
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 10 deletions.
1 change: 1 addition & 0 deletions examples/compute_instance/disk_snapshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This is a simple example of how to use the compute_disk_snapshot module
|------|-------------|------|---------|:--------:|
| project\_id | The GCP project to use for integration tests | `string` | n/a | yes |
| region | The GCP region to create and test resources in | `string` | `"us-central1"` | no |
| 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 |
| subnetwork | The subnetwork selflink to host the compute instances in | `any` | n/a | yes |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion examples/compute_instance/disk_snapshot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module "instance_template" {
project_id = var.project_id
subnetwork = var.subnetwork
name_prefix = "instance-disk-snapshot"
service_account = null
service_account = var.service_account

additional_disks = [
{
Expand Down
9 changes: 8 additions & 1 deletion examples/compute_instance/disk_snapshot/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ variable "subnetwork" {
description = "The subnetwork selflink to host the compute instances in"
}


variable "service_account" {
default = null
type = object({
email = string,
scopes = set(string)
})
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
}
1 change: 1 addition & 0 deletions examples/mig/healthcheck/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ group with an autoscaler.
|------|-------------|------|---------|:--------:|
| project\_id | The GCP project to use for integration tests | `string` | n/a | yes |
| region | The GCP region to create and test resources in | `string` | `"us-central1"` | no |
| 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 |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion examples/mig/healthcheck/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module "instance_template" {
source = "../../../modules/instance_template"
project_id = var.project_id
subnetwork = google_compute_subnetwork.main.name
service_account = null
service_account = var.service_account
}

/** Instance Group within autoscale and health check **/
Expand Down
9 changes: 9 additions & 0 deletions examples/mig/healthcheck/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ variable "region" {
type = string
default = "us-central1"
}

variable "service_account" {
default = null
type = object({
email = string,
scopes = set(string)
})
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
}
9 changes: 5 additions & 4 deletions test/fixtures/compute_instance/disk_snapshot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@


module "disk_snapshot" {
source = "../../../../examples/compute_instance/disk_snapshot"
project_id = var.project_id
region = "us-central1"
subnetwork = google_compute_subnetwork.main.self_link
source = "../../../../examples/compute_instance/disk_snapshot"
project_id = var.project_id
region = "us-central1"
subnetwork = google_compute_subnetwork.main.self_link
service_account = var.service_account
}
9 changes: 8 additions & 1 deletion test/fixtures/compute_instance/disk_snapshot/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ variable "project_id" {
description = "The GCP project to use for integration tests"
}


variable "service_account" {
default = null
type = object({
email = string
scopes = list(string)
})
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
}
5 changes: 3 additions & 2 deletions test/fixtures/mig/healthcheck/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

module "mig_healthcheck" {
source = "../../../../examples/mig/healthcheck"
project_id = var.project_id
source = "../../../../examples/mig/healthcheck"
project_id = var.project_id
service_account = var.service_account
}
9 changes: 9 additions & 0 deletions test/fixtures/mig/healthcheck/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@
variable "project_id" {
description = "The GCP project to use for integration tests"
}

variable "service_account" {
default = null
type = object({
email = string
scopes = list(string)
})
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account."
}

0 comments on commit 1abd8c7

Please sign in to comment.