-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
40 lines (35 loc) · 1.03 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
# Define your GCP provider configuration
provider "google" {
credentials = file("<PATH_TO_YOUR_GCP_SERVICE_ACCOUNT_KEY_JSON>")
project = var.project
region = var.region
}
# Include the vpc-network module
module "my_vpc" {
source = "./modules/vpc-network"
# Define input variables for the vpc-network module
vpc_name = var.name_prefix
region = var.region
subnet_cidr_blocks = [cidrsubnet(var.cidr_block, 8, var.cidr_subnetwork_spacing)]
firewall_rules = [
{
name = "allow-http-https",
description = "Allow HTTP and HTTPS traffic",
direction = "INGRESS",
action = "ALLOW",
targets = ["tag('http-https')"],
source_ips = ["0.0.0.0/0"],
protocols = ["tcp"],
ports = ["80", "443"],
},
]
# Additional variables based on your requirements
log_config = var.log_config
}
# Output values from the vpc-network module
output "vpc_id" {
value = module.my_vpc.vpc_id
}
output "subnets" {
value = module.my_vpc.subnets
}