-
Notifications
You must be signed in to change notification settings - Fork 14
/
data.tf
62 lines (50 loc) · 1.16 KB
/
data.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
data "aws_partition" "current" {}
data "aws_ami" "amazon_linux" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["al2023-ami-2023*"]
}
filter {
name = "architecture"
values = ["arm64"]
}
filter {
name = "owner-alias"
values = [
"amazon",
]
}
}
data "aws_iam_policy_document" "bastion_role_assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ec2.${data.aws_partition.current.dns_suffix}"]
}
}
}
data "aws_iam_policy_document" "bastion_role_policy" {
count = var.hosted_zone_id != "" ? 1 : 0
statement {
actions = [
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeAutoScalingGroups",
"ec2:DescribeAddresses",
"ec2:DescribeInstances",
"ec2:DescribeTags"
]
effect = "Allow"
resources = ["*"]
}
statement {
actions = [
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone"
]
effect = "Allow"
resources = ["arn:${data.aws_partition.current.partition}:route53:::hostedzone/${var.hosted_zone_id}"]
}
}