terraform-aws-ec2-instance icon indicating copy to clipboard operation
terraform-aws-ec2-instance copied to clipboard

Support for aws_volume_attachment

Open tiagomlalves opened this issue 2 years ago β€’ 2 comments

Is your request related to a new offering from AWS?

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

  • Yes βœ…: earliest reference was found in version 1.7.0

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

tiagomlalves avatar Jul 11 '22 22:07 tiagomlalves

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.

schniber avatar Jul 20 '22 17:07 schniber

@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.

tiagomlalves avatar Jul 25 '22 23:07 tiagomlalves

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] avatar Aug 25 '22 00:08 github-actions[bot]

This issue was automatically closed because of stale in 10 days

github-actions[bot] avatar Sep 05 '22 00:09 github-actions[bot]

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.

github-actions[bot] avatar Nov 08 '22 02:11 github-actions[bot]