-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
56 lines (49 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# default instance of provider
provider "aws" {
region = var.region
default_tags {
tags = {
Environment = var.env_tag
Terraform = "true"
Project = "bravo"
}
}
}
# us-east-1 provider instance when it is required to use this region
provider "aws" {
region = "us-east-1"
alias = "useast1"
default_tags {
tags = {
Environment = var.env_tag
Terraform = "true"
Project = "bravo"
}
}
}
data "aws_availability_zones" "available" {
state = "available"
}
data "aws_route53_zone" "app" {
name = var.api_cert_domain
}
data "aws_acm_certificate" "api" {
provider = aws.useast1
domain = var.api_cert_domain
key_types = ["RSA_2048", "EC_prime256v1"]
most_recent = true
}
resource "aws_route53_record" "api" {
zone_id = data.aws_route53_zone.app.zone_id
name = var.api_domain
type = "A"
alias {
name = aws_lb.app.dns_name
zone_id = aws_lb.app.zone_id
evaluate_target_health = true
}
}
resource "random_pet" "app" {
length = 2
separator = "-"
}