Skip to content

Commit

Permalink
Variable configuration updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sradzhabov committed Sep 24, 2024
1 parent 77865ca commit b7ffac3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion aws/terraform/compute/ec2/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
locals {
sshpub_key = var.ec2_sshpub_key
}

resource "aws_instance" "example_server" {
ami = "ami-04e914639d0cca79a"
instance_type = var.ec2_size
# root disk
root_block_device {
volume_size = tostring(var.ec2_storage_size)
volume_type = "gp2"
encrypted = false
delete_on_termination = true
}
user_data = <<EOF
#!/bin/bash
echo "Copying the SSH Key to the server"
SSHPUBKEY="${var.ec2_sshpub_key}"
SSHPUBKEY="${local.sshpub_key}"
echo -e $S{{SSHPUBKEY}} >> /home/ec2-user/.ssh/authorized_keys
EOF
}

0 comments on commit b7ffac3

Please sign in to comment.