Last active
February 11, 2021 22:05
-
-
Save madagra/532f7f51a096c85e8a7eeb4e3c29d850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_ssm_parameter" "ec2_ami" { | |
name = "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" | |
} | |
resource "aws_instance" "pypi" { | |
ami = data.aws_ssm_parameter.ec2_ami.value | |
instance_type = "t3.nano" | |
user_data = data.template_file.cloud-init.rendered | |
key_name = "my-keypair" | |
subnet_id = var.vpc_subnet | |
vpc_security_group_ids = [aws_security_group.ec2_instance_sg.id] | |
tags = { | |
Name = "pypi-ec2-instance" | |
Terraform = "true" | |
} | |
} | |
resource "aws_volume_attachment" "pypi_ebs_att" { | |
device_name = local.mount_point | |
volume_id = aws_ebs_volume.pypi_ebs.id | |
instance_id = aws_instance.pypi.id | |
} | |
resource "aws_ebs_volume" "pypi_ebs" { | |
availability_zone = data.aws_availability_zones.available.names[0] | |
type = "gp2" | |
size = var.ebs_size | |
tags = { | |
Name = "pypi-ebs-storage" | |
Terraform = "true" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment