diff --git a/5-app-infra/business_unit_1/development/main.tf b/5-app-infra/business_unit_1/development/main.tf index 689c2e1eb..ecf5a8f4d 100644 --- a/5-app-infra/business_unit_1/development/main.tf +++ b/5-app-infra/business_unit_1/development/main.tf @@ -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" diff --git a/5-app-infra/business_unit_1/non-production/main.tf b/5-app-infra/business_unit_1/non-production/main.tf index 9b53c4fe7..418162fcf 100644 --- a/5-app-infra/business_unit_1/non-production/main.tf +++ b/5-app-infra/business_unit_1/non-production/main.tf @@ -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" diff --git a/5-app-infra/business_unit_1/production/main.tf b/5-app-infra/business_unit_1/production/main.tf index 24c64757a..f28ad5921 100644 --- a/5-app-infra/business_unit_1/production/main.tf +++ b/5-app-infra/business_unit_1/production/main.tf @@ -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" diff --git a/5-app-infra/modules/env_base/README.md b/5-app-infra/modules/env_base/README.md index 6671f4d46..24d986bee 100644 --- a/5-app-infra/modules/env_base/README.md +++ b/5-app-infra/modules/env_base/README.md @@ -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 | diff --git a/5-app-infra/modules/env_base/main.tf b/5-app-infra/modules/env_base/main.tf index 76f72d5b7..496502f9e 100644 --- a/5-app-infra/modules/env_base/main.tf +++ b/5-app-infra/modules/env_base/main.tf @@ -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"] diff --git a/5-app-infra/modules/env_base/variables.tf b/5-app-infra/modules/env_base/variables.tf index ce90c7175..b90c5ed21 100644 --- a/5-app-infra/modules/env_base/variables.tf +++ b/5-app-infra/modules/env_base/variables.tf @@ -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" diff --git a/test/integration/app-infra/controls/gcp_projects.rb b/test/integration/app-infra/controls/gcp_projects.rb index 3169a09ee..df20a93ff 100644 --- a/test/integration/app-infra/controls/gcp_projects.rb +++ b/test/integration/app-infra/controls/gcp_projects.rb @@ -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 @@ -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 @@ -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