Skip to content

Commit f6711fc

Browse files
committed
mm3 terraform
1 parent 20e57d0 commit f6711fc

File tree

3 files changed

+153
-0
lines changed

3 files changed

+153
-0
lines changed

terraform/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
## Terraform to launch mm3 instance
3+
4+
Modify the steps as necessary.
5+
6+
gcloud config configurations create cppal
7+
gcloud config configurations activate cppal
8+
gcloud config set project boostorg-project1
9+
gcloud config set account [email protected]
10+
11+
gcloud auth application-default login
12+
13+
terraform init
14+
terraform apply
15+

terraform/example-instance.config

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
# A more full example of a "google_compute_instance".
3+
# Most of these settings don't need to be specified.
4+
# Adjust as needed.
5+
# The main.tf file is more appropriate.
6+
7+
provider "google" {
8+
project = "boostorg-project1"
9+
region = "us-central1"
10+
zone = "us-central1-c"
11+
}
12+
13+
resource "google_compute_instance" "example" {
14+
allow_stopping_for_update = null
15+
can_ip_forward = false
16+
deletion_protection = false
17+
description = null
18+
desired_status = null
19+
enable_display = false
20+
hostname = null
21+
key_revocation_action_type = "NONE"
22+
labels = {}
23+
machine_type = "n2-standard-2"
24+
metadata = {}
25+
metadata_startup_script = null
26+
min_cpu_platform = null
27+
name = "lists"
28+
resource_policies = []
29+
tags = ["elasticsearch", "munin", "nrpe", "email", "http-server", "https-server", "lb-health-check", "mailman3-core", "postgres-client", "prometheus"]
30+
zone = "us-central1-c"
31+
boot_disk {
32+
auto_delete = true
33+
device_name = "lists"
34+
disk_encryption_key_raw = null # sensitive
35+
interface = null
36+
kms_key_self_link = null
37+
mode = "READ_WRITE"
38+
# source = "https://www.googleapis.com/compute/v1/projects/boostorg-project1/zones/us-central1-c/disks/mm3-test"
39+
initialize_params {
40+
enable_confidential_compute = false
41+
image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2404-noble-amd64-v20241004"
42+
labels = {}
43+
provisioned_iops = 0
44+
provisioned_throughput = 0
45+
resource_manager_tags = {}
46+
resource_policies = []
47+
size = 50
48+
storage_pool = null
49+
type = "pd-balanced"
50+
}
51+
}
52+
confidential_instance_config {
53+
confidential_instance_type = null
54+
enable_confidential_compute = false
55+
}
56+
network_interface {
57+
internal_ipv6_prefix_length = 0
58+
ipv6_address = null
59+
network = "https://www.googleapis.com/compute/v1/projects/boostorg-project1/global/networks/default"
60+
network_ip = "10.128.0.15"
61+
nic_type = null
62+
queue_count = 0
63+
stack_type = "IPV4_ONLY"
64+
subnetwork = "https://www.googleapis.com/compute/v1/projects/boostorg-project1/regions/us-central1/subnetworks/default"
65+
subnetwork_project = "boostorg-project1"
66+
access_config {
67+
nat_ip = "104.154.182.161"
68+
network_tier = "PREMIUM"
69+
public_ptr_domain_name = null
70+
}
71+
}
72+
reservation_affinity {
73+
type = "ANY_RESERVATION"
74+
}
75+
scheduling {
76+
automatic_restart = true
77+
instance_termination_action = null
78+
min_node_cpus = 0
79+
on_host_maintenance = "MIGRATE"
80+
preemptible = false
81+
provisioning_model = "STANDARD"
82+
}
83+
service_account {
84+
85+
scopes = ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/trace.append"]
86+
}
87+
shielded_instance_config {
88+
enable_integrity_monitoring = true
89+
enable_secure_boot = false
90+
enable_vtpm = true
91+
}
92+
}
93+

terraform/main.tf

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# A terraform configuration to launch a mailman service instance
3+
4+
provider "google" {
5+
project = "boostorg-project1"
6+
region = "us-central1"
7+
zone = "us-central1-a"
8+
}
9+
10+
resource "google_compute_address" "lists_ip_address_ext" {
11+
name = "lists-ip-address-ext"
12+
address_type = "EXTERNAL"
13+
}
14+
15+
resource "google_compute_address" "lists_ip_address_int" {
16+
name = "lists-ip-address-int"
17+
address_type = "INTERNAL"
18+
}
19+
20+
resource "google_compute_instance" "example" {
21+
machine_type = "n2-standard-2"
22+
name = "lists"
23+
tags = ["elasticsearch", "munin", "nrpe", "email", "http-server", "https-server", "lb-health-check", "mailman3-core", "postgres-client", "prometheus"]
24+
zone = "us-central1-c"
25+
boot_disk {
26+
auto_delete = true
27+
device_name = "lists"
28+
mode = "READ_WRITE"
29+
initialize_params {
30+
image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2404-noble-amd64-v20241004"
31+
size = 150
32+
type = "pd-balanced"
33+
}
34+
}
35+
network_interface {
36+
network = "default"
37+
network_ip = google_compute_address.lists_ip_address_int.address
38+
stack_type = "IPV4_ONLY"
39+
access_config {
40+
nat_ip = google_compute_address.lists_ip_address_ext.address
41+
network_tier = "PREMIUM"
42+
}
43+
}
44+
}
45+

0 commit comments

Comments
 (0)