-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.tf
79 lines (63 loc) · 1.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
provider "aws" {
region = "us-east-1"
profile = "resource-owner"
}
module "share" {
source = "../.."
name = "tardigrade-ram-${random_string.this.result}"
allow_external_principals = true
resources = [
{
name = "resolver-rule"
resource_arn = aws_route53_resolver_rule.this.arn
}
]
tags = {
Environment = "testing"
}
}
module "vpc" {
source = "github.com/terraform-aws-modules/terraform-aws-vpc?ref=v3.14.4"
name = "tardigrade-ram-${random_string.this.result}"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
}
resource "aws_security_group" "this" {
name = "empty_sg"
description = "empty_sg for testing"
vpc_id = module.vpc.vpc_id
}
resource "aws_route53_resolver_endpoint" "this" {
name = "tardigrade-resolver-${random_string.this.result}"
direction = "OUTBOUND"
security_group_ids = [
aws_security_group.this.id,
]
ip_address {
subnet_id = module.vpc.private_subnets[0]
ip = "10.0.1.4"
}
ip_address {
subnet_id = module.vpc.private_subnets[1]
ip = "10.0.2.8"
}
}
resource "aws_route53_resolver_rule" "this" {
domain_name = "${random_string.this.result}.com"
name = "tardigrate-rr-${random_string.this.result}"
rule_type = "FORWARD"
resolver_endpoint_id = aws_route53_resolver_endpoint.this.id
target_ip {
ip = "123.45.67.89"
}
}
resource "random_string" "this" {
length = 6
upper = false
special = false
number = false
}
output "share" {
value = module.share
}