Skip to content

Commit 4c85841

Browse files
committed
Merge branch 'migrate_to_templatefile' into 'master'
migrate to templatefile function (to support MacOS) See merge request postgres-ai/terraform-postgres-ai-database-lab!38
2 parents 078108e + 7b52706 commit 4c85841

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

instance.tf

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ resource "random_string" "vcs_db_migration_checker_verification_token" {
2222
special = false
2323
}
2424

25-
data "template_file" "init" {
26-
template = "${file("dle-logical-init.sh.tpl")}"
27-
vars = {
25+
resource "aws_instance" "aws_ec2" {
26+
ami = "${data.aws_ami.ami.id}"
27+
availability_zone = "${var.aws_deploy_ebs_availability_zone}"
28+
instance_type = "${var.aws_deploy_ec2_instance_type}"
29+
security_groups = ["${aws_security_group.dle_instance_sg.name}"]
30+
key_name = "${var.aws_keypair}"
31+
tags = "${local.common_tags}"
32+
iam_instance_profile = "${var.source_type == "s3" ? "${aws_iam_instance_profile.instance_profile[0].name}" : null}"
33+
user_data = templatefile("${path.module}/dle-logical-init.sh.tpl",{
2834
dle_verification_token = "${random_string.dle_verification_token.result}"
2935
dle_debug_mode = "${var.dle_debug_mode}"
3036
dle_retrieval_refresh_timetable = "${var.dle_retrieval_refresh_timetable}"
@@ -51,19 +57,7 @@ data "template_file" "init" {
5157
source_pgdump_s3_bucket = "${var.source_pgdump_s3_bucket}"
5258
source_pgdump_s3_mount_point = "${var.source_pgdump_s3_mount_point}"
5359
source_pgdump_path_on_s3_bucket = "${var.source_pgdump_path_on_s3_bucket}"
54-
}
55-
}
56-
57-
resource "aws_instance" "aws_ec2" {
58-
ami = "${data.aws_ami.ami.id}"
59-
availability_zone = "${var.aws_deploy_ebs_availability_zone}"
60-
instance_type = "${var.aws_deploy_ec2_instance_type}"
61-
security_groups = ["${aws_security_group.dle_instance_sg.name}"]
62-
key_name = "${var.aws_keypair}"
63-
tags = "${local.common_tags}"
64-
iam_instance_profile = "${var.source_type == "s3" ? "${aws_iam_instance_profile.instance_profile[0].name}" : null}"
65-
user_data = "${data.template_file.init.rendered}"
66-
60+
})
6761
provisioner "file" {
6862
source = "postgresql_clones_custom.conf"
6963
destination = "/tmp/postgresql_clones_custom.conf"

0 commit comments

Comments
 (0)