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

feat: Add direct support for volume attachments #290

Closed tiagomlalves closed 1 year ago

tiagomlalves commented 2 years ago

Description

Add ebs_volume_attachments input variable and logic to automatically attach previously created volumes when starting instances.

Motivation and Context

This change simplifies the creation of immutable servers when using Terragrunt with this module enabling the following configuration:

dependency "testdata_storage" {
    config_path = "../../storage/testdata"
}

inputs = {
    ami           = "ami-xxx"
    instance_type = "t3a.micro"

    ebs_volume_attachments = [
        {
            device_name ="/dev/xvdb"
            volume_id = dependency.testdata_storage.outputs.id
        }
    ]

    ...
}

Breaking Changes

no

How Has This Been Tested?

tiagomlalves commented 2 years ago

Hi, this is just a first attempt showing the changes I proposed in https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/issues/276 Looking forward for feedback about if this is the right approach or not for simplifying Terragrunt configurations.

github-actions[bot] commented 2 years ago

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

github-actions[bot] commented 1 year ago

This PR was automatically closed because of stale in 10 days

github-actions[bot] commented 1 year ago

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.