-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.tf
43 lines (37 loc) · 1.2 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
provider "google" {
project = var.project_id
}
variable "project_id" {
type = string
description = "Enter a unique project-id"
}
locals {
service_name = "terraform"
region = "us-central1"
zone = "us-central1-a"
environment = "dev"
tags = ["alice", "bob"]
}
module "gcp_cloud_platform" {
source = "./modules/google_cloud_platform"
project_id = var.project_id
account_id = "compute-engine-account"
display_name = "Test Service Account for Compute Engine"
}
module "gcp_compute_engine" {
source = "./modules/google_compute_engine"
project_id = var.project_id
service_name = local.service_name
region = local.region
zone = local.zone
network = module.gcp_compute_engine.vpc_network_id
machine_type = "e2-micro" # 2 vCPU, 1 GB memory
instance_template_id = module.gcp_compute_engine.google_compute_instance_template_id
instance_group_id = module.gcp_compute_engine.google_compute_instance_group_manager_id
email = module.gcp_cloud_platform.google_service_account_email
environment = local.environment
tags = local.tags
metadata = {
foo = "bar"
}
}