-
Notifications
You must be signed in to change notification settings - Fork 1
/
provisioner.tf
61 lines (56 loc) · 2.08 KB
/
provisioner.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
module "provisioner" {
source = "odzhu/asg/aws"
version = "1.0.4"
subnet_ids = "${var.public_subnet_ids}"
environment = "${var.environment}"
name = "${var.provisioner_name}"
vpc_id = "${var.vpc_id}"
instance_type = "${var.provisioner_instance_type}"
instance_profile = "${aws_iam_instance_profile.provisioner.name}"
ami = "${var.provisioner_ami}"
admin_ssh_key = "${aws_key_pair.admin_key.key_name}"
load_balancers = ["${aws_elb.master.name}"]
user_data = "${data.template_file.provisioner.rendered}"
management_net = "${var.management_net}"
spot_price = "${var.provisioner_spot_price}"
}
data "template_file" "provisioner" {
template = "${file("${path.module}/${var.provisioner_user_data}")}"
vars {
master_asg_name = "${replace("${module.master.name}", "-", "_")}"
infra_asg_name = "${replace("${module.infra.name}", "-", "_")}"
app_asg_name = "${replace("${module.app.name}", "-", "_")}"
environment = "${var.environment}"
public_domain = "${var.public_domain}"
master_public_fqdn = "${aws_route53_record.master.fqdn}"
master_private_fqdn = "${aws_route53_record.internal_master.fqdn}"
region = "${data.aws_region.current.name}"
log_group = "${var.environment}"
sqs = "${aws_sqs_queue.scaling.id}"
ssm = "${aws_ssm_document.openshift.name}"
}
}
data "aws_region" "current" {
current = true
}
resource "aws_ssm_document" "openshift" {
name = "${var.environment}_openshift"
document_type = "Command"
content = <<DOC
{
"schemaVersion":"2.2",
"description":"cross-platform sample",
"mainSteps":[
{
"action":"aws:runShellScript",
"name":"Ansible",
"inputs":{
"runCommand":[
"provisioner.sh"
]
}
}
]
}
DOC
}