terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
754 stars 1.87k forks source link

Support for aws_volume_attachment #276

Closed tiagomlalves closed 2 years ago

tiagomlalves commented 2 years ago

Is your request related to a new offering from AWS?

Is this functionality available in the AWS provider for Terraform? See CHANGELOG.md, too.

Is your request related to a problem? Please describe.

I'm creating an immutable server that stores large volume of data. For that, I create an EC2 instance with ephemeral storage 8Gb, and a permanent storage 100Gb. I would like to define the EC2 instance to use aws_volume_attachment

Describe the solution you'd like.

When using Terragrunt, I would like to specify the following:

terraform {
    source = "tfr:///terraform-aws-modules/ec2-instance/aws//?version=4.0.0"
}

...

dependency "storage" {
    config_path = "PATH_TO_EBS_STORAGE"
}

inputs = {
    ami           = ...
    instance_type = ...

    ebs_volume_attachment = [
        {
            device_name ="/dev/xvdb"
            volume_id = dependency.storage.outputs.id
        }
    ]

    ...
}

...

Describe alternatives you've considered.

Currently I've copied and paste this repo code that defines an aws_instance resource to main.tf and and variables.tf files, with some modifications.

Additional context

I would be happy to contribute with this change if you think this could help others

schniber commented 2 years ago

Hello,

Did you have a look at this ? => https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/blob/master/examples/volume-attachment/main.tf

Hope this helps.

Bests.

tiagomlalves commented 2 years ago

@schniber Thanks for the reply. Yes, I had seen that. That example shows how to create an EC2 instance, volume, and volume_attachment. My proposal is that the definition of the volume_attachment resource could be done by the ec2 module directly. In Terraform, it's not a big deal to do as in the example. In Terragrunt, however, it would make the code simpler.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 2 years ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.