feat: changed ec2 module and updated readme
This commit is contained in:
@@ -8,23 +8,27 @@
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
module "TestInstance" {
|
module "TestInstance" {
|
||||||
source = "../../../modules/compute/ec2"
|
source = "terraform-aws-modules/ec2-instance/aws"
|
||||||
|
version = "6.2.0"
|
||||||
|
|
||||||
additional-tags = {}
|
ami = data.aws_ami.this.id
|
||||||
ami-id = data.aws_ami.this.id
|
associate_public_ip_address = false
|
||||||
asso-eip = false
|
create_eip = false
|
||||||
asso-public-ip = false
|
name = "TestInstance001"
|
||||||
data-volumes = {}
|
instance_type = "t4g.large"
|
||||||
instance-name = "TestInstance001"
|
subnet_id = data.terraform_remote_state.vpc.outputs.private_subnets[0]
|
||||||
instance-type = "t4g.large"
|
create_security_group = false
|
||||||
kms-key-id = module.KmsKeys.cmks["allpurpose"].arn
|
root_block_device = {
|
||||||
root-volume-size = 20
|
device_name = "/dev/xvda"
|
||||||
security-groups = []
|
type = "gp3"
|
||||||
subnet-id = data.terraform_remote_state.vpc.outputs.private_subnets[0]
|
size = 20
|
||||||
user-data = <<EOF
|
delete_on_termination = true
|
||||||
#!/bin/bash
|
kms_key_id = module.KmsKeys.cmks["allpurpose"].arn
|
||||||
dnf -y install git
|
}
|
||||||
EOF
|
metadata_options = {
|
||||||
|
http_put_response_hop_limit = 2
|
||||||
|
http_tokens = "required"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data "aws_ami" "this" {
|
data "aws_ami" "this" {
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
output "instance_info" {
|
output "instance_info" {
|
||||||
value = module.TestInstance.ec2-id-ip
|
value = {
|
||||||
|
id = module.TestInstance.id,
|
||||||
|
private_ip = module.TestInstance.private_ip
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -61,3 +61,7 @@ For example, vpc with ipv6 could not be created. It failed with the following er
|
|||||||
│ 293: resource "aws_subnet" "private" {
|
│ 293: resource "aws_subnet" "private" {
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also, ec2 instance's associate_public_ip_address attribute is always set to true, despite
|
||||||
|
it is set to false in my code. This caused the instance to be redeployed everytime terraform
|
||||||
|
apply is ran.
|
||||||
Reference in New Issue
Block a user