-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
54 lines (49 loc) · 1.3 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
44
45
46
47
48
49
50
51
52
53
54
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
}
}
provider "google" {
project = "acme-demo-organization"
region = "europe-west10"
}
resource "google_compute_network" "vpc_network" {
project = "acme-demo-organization"
name = "example-vpc-network"
auto_create_subnetworks = false
mtu = 1460
}
resource "google_compute_subnetwork" "subnetwork" {
project = "acme-demo-organization"
name = "example-subnetwork"
ip_cidr_range = "10.0.1.0/24"
region = "europe-west10"
network = google_compute_network.vpc_network.id
}
resource "google_compute_firewall" "ssh" {
project = "acme-demo-organization"
name = "allow-ssh"
allow {
ports = ["22"]
protocol = "tcp"
}
direction = "INGRESS"
network = google_compute_network.vpc_network.id
priority = 1000
source_ranges = ["0.0.0.0/0"]
target_tags = ["ssh"]
}
resource "google_compute_firewall" "flask" {
project = "acme-demo-organization"
name = "flask-app-firewall"
allow {
protocol = "tcp"
ports = ["5000"]
}
direction = "INGRESS"
network = google_compute_network.vpc_network.id
source_ranges = ["0.0.0.0/0"]
}