-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.tf
66 lines (57 loc) · 1.68 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
63
64
65
66
data "aws_caller_identity" "current" {}
data "aws_ami" "this" {
most_recent = true
owners = [try(var.account_ids_lookup[var.ami_owner], var.ami_owner)]
tags = {
is-production = false # based on environment
}
filter {
name = "name"
values = [var.ami_name]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
data "aws_route53_zone" "internal" {
provider = aws.core-vpc
name = "${var.business_unit}-${var.environment}.modernisation-platform.internal."
private_zone = true
}
data "aws_route53_zone" "external" {
provider = aws.core-vpc
name = "${var.business_unit}-${var.environment}.modernisation-platform.service.justice.gov.uk."
private_zone = false
}
data "aws_ec2_instance_type" "this" {
instance_type = var.instance.instance_type
}
data "cloudinit_config" "this" {
count = sum(local.user_data_part_count) > 0 ? 1 : 0
dynamic "part" {
for_each = try(var.user_data_cloud_init.scripts, {})
content {
content_type = "text/x-shellscript"
content = templatefile("templates/${part.value}", local.user_data_args)
}
}
dynamic "part" {
for_each = try(var.user_data_cloud_init.write_files, {})
content {
content_type = "text/cloud-config"
merge_type = "list(append)+dict(recurse_list)+str(append)"
content = yamlencode({
write_files = [
{
encoding = "b64"
content = base64encode(templatefile("templates/${part.key}", local.user_data_args))
path = part.value.path
owner = part.value.owner
permissions = part.value.permissions
}
]
})
}
}
}