-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathmain.tf
38 lines (33 loc) · 1.22 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
# Summary: A simple GCP VPC (google_compute_network)
# Documentation: https://www.terraform.io/docs/language/settings/index.html
terraform {
required_version = ">= 1.0.0"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.0"
}
}
}
# Documentation: https://www.terraform.io/docs/language/values/variables.html
variable "project_id" {
type = string
}
# Documentation: https://www.terraform.io/docs/language/providers/requirements.html
provider "google" {
project = var.project_id
region = "us-central1"
zone = "us-central1-c"
}
# Documentation: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_network
resource "google_compute_network" "changeme_simple_vpc" {
name = "changeme-simple-vpc"
auto_create_subnetworks = "false"
}
# Documentation: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_subnetwork
resource "google_compute_subnetwork" "changeme_simple_vpc_subnet_1" {
name = "${google_compute_network.changeme_simple_vpc.name}-subnet-1"
region = "us-central1"
network = google_compute_network.changeme_simple_vpc.name
ip_cidr_range = "10.10.0.0/24"
}