Skip to content

Commit

Permalink
fix: use f1-micro as the machine type for the deploy in 5-app-infra s…
Browse files Browse the repository at this point in the history
…tep (#416)

* use f1-micro as the machine type for the deploy in 5-app-infra step

* update machine type in step 5 test assert
  • Loading branch information
daniel-cit authored Apr 10, 2021
1 parent 141c059 commit 1fad10b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/development/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module "base_shared_gce_instance" {
environment = "development"
vpc_type = "base"
num_instances = 1
machine_type = "f1-micro"
folder_id = data.google_active_folder.env.name
business_code = "bu1"
project_suffix = "sample-base"
Expand Down
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/non-production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module "base_shared_gce_instance" {
environment = "non-production"
vpc_type = "base"
num_instances = 1
machine_type = "f1-micro"
folder_id = data.google_active_folder.env.name
business_code = "bu1"
project_suffix = "sample-base"
Expand Down
1 change: 1 addition & 0 deletions 5-app-infra/business_unit_1/production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module "base_shared_gce_instance" {
environment = "production"
vpc_type = "base"
num_instances = 1
machine_type = "f1-micro"
folder_id = data.google_active_folder.env.name
business_code = "bu1"
project_suffix = "sample-base"
Expand Down
1 change: 1 addition & 0 deletions 5-app-infra/modules/env_base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| environment | The environment the single project belongs to | `string` | n/a | yes |
| folder\_id | The folder id where project will be created | `string` | n/a | yes |
| hostname | Hostname of instances | `string` | `"example-app"` | no |
| machine\_type | Machine type to create, e.g. n1-standard-1 | `string` | `"f1-micro"` | no |
| num\_instances | Number of instances to create | `number` | n/a | yes |
| project\_suffix | The name of the GCP project. Max 16 characters with 3 character business unit code. | `string` | n/a | yes |
| region | The GCP region to create and test resources in | `string` | `"us-central1"` | no |
Expand Down
11 changes: 6 additions & 5 deletions 5-app-infra/modules/env_base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ resource "google_service_account" "compute_engine_service_account" {
}

module "instance_template" {
source = "terraform-google-modules/vm/google//modules/instance_template"
version = "6.2.0"
region = var.region
project_id = data.google_project.env_project.project_id
subnetwork = data.google_compute_subnetwork.subnetwork.self_link
source = "terraform-google-modules/vm/google//modules/instance_template"
version = "6.2.0"
machine_type = var.machine_type
region = var.region
project_id = data.google_project.env_project.project_id
subnetwork = data.google_compute_subnetwork.subnetwork.self_link
service_account = {
email = google_service_account.compute_engine_service_account.email
scopes = ["compute-rw"]
Expand Down
5 changes: 5 additions & 0 deletions 5-app-infra/modules/env_base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ variable "num_instances" {
type = number
}

variable "machine_type" {
description = "Machine type to create, e.g. n1-standard-1"
default = "f1-micro"
}

variable "hostname" {
description = "Hostname of instances"
default = "example-app"
Expand Down
6 changes: 3 additions & 3 deletions test/integration/app-infra/controls/gcp_projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
dev_bu1_instances_names.each do |dev_bu1_instance_name|
describe google_compute_instance(project: dev_bu1_project_id, zone: dev_bu1_instances_zones[index], name: dev_bu1_instance_name) do
it { should exist }
its('machine_type') { should match 'n1-standard-1' }
its('machine_type') { should match 'f1-micro' }
end
index += 1
end
Expand All @@ -39,7 +39,7 @@
nonprod_bu1_instances_names.each do |nonprod_bu1_instance_name|
describe google_compute_instance(project: nonprod_bu1_project_id, zone: nonprod_bu1_instances_zones[index], name: nonprod_bu1_instance_name) do
it { should exist }
its('machine_type') { should match 'n1-standard-1' }
its('machine_type') { should match 'f1-micro' }
end
index += 1
end
Expand All @@ -48,7 +48,7 @@
prod_bu1_instances_names.each do |prod_bu1_instance_name|
describe google_compute_instance(project: prod_bu1_project_id, zone: prod_bu1_instances_zones[index], name: prod_bu1_instance_name) do
it { should exist }
its('machine_type') { should match 'n1-standard-1' }
its('machine_type') { should match 'f1-micro' }
end
index += 1
end
Expand Down

0 comments on commit 1fad10b

Please sign in to comment.