diff --git a/.gitignore b/.gitignore index 5afd7e2..797b713 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ terraform.tfstate.backup terraform.tfvars todos.md .DS_Store -files/user_data_compiled.sh \ No newline at end of file +files/user_data_compiled.sh +tmp/ \ No newline at end of file diff --git a/ec2-auto-scaling-group.tf b/ec2-auto-scaling-group.tf index e4af511..f81ac0a 100644 --- a/ec2-auto-scaling-group.tf +++ b/ec2-auto-scaling-group.tf @@ -8,6 +8,8 @@ resource "aws_autoscaling_group" "vault-asg" { version = aws_launch_template.vault_instance.latest_version } + target_group_arns = [aws_lb_target_group.alb_targets.arn] + # All the same to keep at a fixed size desired_capacity = var.vault_instance_count min_size = var.vault_instance_count diff --git a/files/userdata.sh b/files/userdata.sh index 34132e6..5c743ac 100644 --- a/files/userdata.sh +++ b/files/userdata.sh @@ -178,6 +178,9 @@ Content-Type: text/x-shellscript; charset="us-ascii" # - Delete the local file # - Erase bash history +# Workaround to make sure the vault service is fully initialized. +sleep 10 + export VAULT_ADDR="http://127.0.0.1:8200" export AWS_DEFAULT_REGION="${VAULT_CLUSTER_REGION}"