Skip to content

Commit 48a9b07

Browse files
authored
Merge pull request #58 from omazin/fix-test-approach
Fix testing approach. Update examples, tests.
2 parents cc9ee9c + 55241dc commit 48a9b07

File tree

92 files changed

+219
-1169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+219
-1169
lines changed

examples/compute_instance/simple/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ This is a simple, minimal example of how to use the compute_instance module
77

88
| Name | Description | Type | Default | Required |
99
|------|-------------|:----:|:-----:|:-----:|
10-
| credentials\_path | The path to the GCP credentials JSON file | string | n/a | yes |
1110
| num\_instances | Number of instances to create | string | n/a | yes |
1211
| project\_id | The GCP project to use for integration tests | string | n/a | yes |
13-
| region | The GCP region to create and test resources in | string | n/a | yes |
12+
| region | The GCP region to create and test resources in | string | `"us-central1"` | no |
1413
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | object | `"null"` | no |
1514
| subnetwork | The subnetwork to host the compute instances in | string | n/a | yes |
1615

examples/compute_instance/simple/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616

1717
provider "google" {
18-
credentials = file(var.credentials_path)
19-
project = var.project_id
20-
region = var.region
21-
version = "~> 2.7.0"
18+
19+
project = var.project_id
20+
region = var.region
21+
version = "~> 2.7.0"
2222
}
2323

2424
module "instance_template" {

examples/compute_instance/simple/variables.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2019 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,16 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
variable "credentials_path" {
18-
description = "The path to the GCP credentials JSON file"
19-
}
17+
2018

2119
variable "project_id" {
2220
description = "The GCP project to use for integration tests"
21+
type = string
2322
}
2423

2524
variable "region" {
2625
description = "The GCP region to create and test resources in"
26+
type = string
27+
default = "us-central1"
2728
}
2829

2930
variable "subnetwork" {
@@ -34,6 +35,8 @@ variable "num_instances" {
3435
description = "Number of instances to create"
3536
}
3637

38+
39+
3740
variable "service_account" {
3841
default = null
3942
type = object({

examples/instance_template/additional_disks/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ instance templates with additional persistent disks.
88

99
| Name | Description | Type | Default | Required |
1010
|------|-------------|:----:|:-----:|:-----:|
11-
| credentials\_path | The path to the GCP credentials JSON file | string | n/a | yes |
1211
| project\_id | The GCP project to use for integration tests | string | n/a | yes |
13-
| region | The GCP region to create and test resources in | string | n/a | yes |
12+
| region | The GCP region to create and test resources in | string | `"us-central1"` | no |
1413
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | object | `"null"` | no |
1514
| subnetwork | The name of the subnetwork create this instance in. | string | `""` | no |
1615

examples/instance_template/additional_disks/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616

1717
provider "google" {
18-
credentials = file(var.credentials_path)
19-
project = var.project_id
20-
region = var.region
21-
version = "~> 2.7.0"
18+
19+
project = var.project_id
20+
region = var.region
21+
version = "~> 2.7.0"
2222
}
2323

2424
module "instance_template" {

examples/instance_template/additional_disks/variables.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2019 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,16 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
variable "credentials_path" {
18-
description = "The path to the GCP credentials JSON file"
19-
}
17+
2018

2119
variable "project_id" {
2220
description = "The GCP project to use for integration tests"
21+
type = string
2322
}
2423

2524
variable "region" {
2625
description = "The GCP region to create and test resources in"
26+
type = string
27+
default = "us-central1"
2728
}
2829

2930
variable "subnetwork" {

examples/instance_template/simple/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ This is a simple, minimal example of how to use the instance_template module.
77

88
| Name | Description | Type | Default | Required |
99
|------|-------------|:----:|:-----:|:-----:|
10-
| credentials\_path | The path to the GCP credentials JSON file | string | n/a | yes |
1110
| labels | Labels, provided as a map | map(string) | n/a | yes |
1211
| project\_id | The GCP project to use for integration tests | string | n/a | yes |
13-
| region | The GCP region to create and test resources in | string | n/a | yes |
12+
| region | The GCP region to create and test resources in | string | `"us-central1"` | no |
1413
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | object | `"null"` | no |
1514
| subnetwork | The name of the subnetwork create this instance in. | string | `""` | no |
1615
| tags | Network tags, provided as a list | list(string) | n/a | yes |

examples/instance_template/simple/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616

1717
provider "google" {
18-
credentials = file(var.credentials_path)
19-
project = var.project_id
20-
region = var.region
21-
version = "~> 2.7.0"
18+
19+
project = var.project_id
20+
region = var.region
21+
version = "~> 2.7.0"
2222
}
2323

2424
resource "google_compute_address" "ip_address" {

examples/instance_template/simple/variables.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 Google LLC
2+
* Copyright 2019 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,16 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
variable "credentials_path" {
18-
description = "The path to the GCP credentials JSON file"
19-
}
17+
2018

2119
variable "project_id" {
2220
description = "The GCP project to use for integration tests"
21+
type = string
2322
}
2423

2524
variable "region" {
2625
description = "The GCP region to create and test resources in"
26+
type = string
27+
default = "us-central1"
2728
}
2829

2930
variable "subnetwork" {

examples/mig/autoscaler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ group with an autoscaler.
1010
|------|-------------|:----:|:-----:|:-----:|
1111
| autoscaling\_cpu | Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization | list(map(number)) | n/a | yes |
1212
| autoscaling\_enabled | Creates an autoscaler for the managed instance group | string | n/a | yes |
13-
| credentials\_path | The path to the GCP credentials JSON file | string | n/a | yes |
1413
| min\_replicas | The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. | string | n/a | yes |
1514
| project\_id | The GCP project to use for integration tests | string | n/a | yes |
16-
| region | The GCP region to create and test resources in | string | n/a | yes |
15+
| region | The GCP region to create and test resources in | string | `"us-central1"` | no |
1716
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. | object | `"null"` | no |
1817
| subnetwork | The subnetwork to host the compute instances in | string | n/a | yes |
1918

@@ -23,5 +22,6 @@ group with an autoscaler.
2322
|------|-------------|
2423
| instance\_template\_self\_link | Self-link of instance template |
2524
| mig\_self\_link | Self-link for managed instance group |
25+
| region | The GCP region to create and test resources in |
2626

2727
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

0 commit comments

Comments
 (0)