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: Adding EBS devices without overriding existing EBS mappings #266

Closed kennedy closed 2 years ago

kennedy commented 2 years ago

Description

Motivation and Context

By design, if ebs_block_device is defined in the aws_instance, Terraform will assume management over the full set of non-root EBS block devices for the instance, treating additional block devices as drift. With this PR, setting the variable override_ebs_mapping to false will allowing the user to create the ebs_block_device resources externally, leaving the pre-assigned/existing EBS device mapped in the AMI.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#argument-reference

If you use ebs_block_device on an aws_instance, Terraform will assume management over the full set of non-root EBS block devices for the instance, and treats additional block devices as drift. For this reason, ebs_block_device cannot be mixed with external aws_ebs_volume + aws_ebs_volume_attachment resources for a given instance.

Resolves:

Relates to:

Breaking Changes

No breaking changes, the default value of override_ebs_mapping allows the module to behave as before.

There is an additional outputs, outputs.external_ebs_block_device

How Has This Been Tested?

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 2 years 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.