Skip to content

Commit

Permalink
use template file
Browse files Browse the repository at this point in the history
  • Loading branch information
tajewole-moj committed Oct 11, 2023
1 parent b4e2a0d commit dcbbc2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion terraform/environments/apex/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# EOF
# }

resource "template_file" "web-userdata" {
filename = "run.sh"
}


resource "aws_instance" "apex_db_instance" {
ami = local.application_data.accounts[local.environment].ec2amiid
associate_public_ip_address = false
Expand All @@ -22,7 +27,8 @@ resource "aws_instance" "apex_db_instance" {
monitoring = true
subnet_id = data.aws_subnet.private_subnets_a.id
iam_instance_profile = aws_iam_instance_profile.ec2_instance_profile.id
user_data = "${file("run.sh")}"
user_data = "${template_file.web-userdata.rendered}"


root_block_device {
delete_on_termination = false
Expand All @@ -47,6 +53,7 @@ data "local_file" "cloudwatch_agent" {
filename = "${path.module}/cloudwatch_agent_config.json"
}


resource "aws_security_group" "ec2" {
name = local.application_name
description = "APEX DB Server Security Group"
Expand Down

0 comments on commit dcbbc2a

Please sign in to comment.