forked from strvcom/terraform-aws-fargate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
56 lines (43 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
55
56
terraform {
required_version = ">= 0.11.13"
}
provider "aws" {
version = "~> 2.6.0"
region = "us-east-1"
profile = "playground"
}
variable "public_subnets_cidrs" {
default = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
}
variable "private_subnets_cidrs" {
default = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.60.0"
create_vpc = true
name = "the-external-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
public_subnets = "${var.public_subnets_cidrs}"
private_subnets = "${var.private_subnets_cidrs}"
}
module "fargate" {
source = "../../"
name = "external-vpc-example"
vpc_create = false # This variable must be set to false, otherwise the module will create its own VPC
vpc_external_id = "${module.vpc.vpc_id}"
vpc_public_subnets = "${var.public_subnets_cidrs}"
vpc_private_subnets = "${var.private_subnets_cidrs}"
vpc_external_public_subnets_ids = "${module.vpc.public_subnets}"
vpc_external_private_subnets_ids = "${module.vpc.private_subnets}"
services = {
api = {
task_definition = "api.json"
container_port = 3000
cpu = "256"
memory = "512"
replicas = 2
}
}
}