Comments (5)
Thanks! Looks scary :) I normally (for 99.9% of cases) use auto-scaling groups and set EC2 tags from instance itself if necessary.
from terraform-aws-ec2-instance.
Yes, you need to modify this module, because you need to access count.index
which is available only inside resource block.
from terraform-aws-ec2-instance.
Thank you, Anton.
FYI, my modification looks like this, in case you or anyone else might have a thought about how to generalize this.
# modifications
# tags = "${merge(var.tags, map("Name", format("%s-%d", var.name, count.index+1)))}" # original tag code
tags = "${merge(var.tags,
map("Name", "${var.number_of_instances > 1 ? "${var.host_name}${format("%02d", count.index + 1)}.${var.instance_name}" : "${var.instance_name}" }"),
map("Desc", "Instance for: ${var.number_of_instances > 1 ? "${var.host_name}${format("%02d", count.index + 1)}.${var.instance_name}" : "${var.instance_name}" }")
)}"
volume_tags = "${merge(var.volume_tags,
map("Name", "${var.number_of_instances > 1 ? "${var.host_name}${format("%02d", count.index + 1)}.${var.instance_name}" : "${var.instance_name}" }"),
map("Desc", "Volume for: ${var.number_of_instances > 1 ? "${var.host_name}${format("%02d", count.index + 1)}.${var.instance_name}" : "${var.instance_name}" }")
)}"
from terraform-aws-ec2-instance.
Haha. Sorry. I'm a nubie so perhaps it's overkill. I get tired of looking at so many things in AWS and trying to figure our which system they're associated. So I'm a bit obsessive trying to apply, for example, the actual fqdn of the instance in the Name field.
I am also using the iterative count mechanism to build multiple variants of the same instances. So not every instance is using it's own unique resource definition.
While I'm developing for AWS now, I'm also trying to keep from going too deep into AWS, because we'll also need t support the same infrastructure on private cloud openstack. If I can't create it in AWS and Openstack, I need to be careful what I use in AWS so I don't paint us into a corner.
Thanks so much for your help and advice.
from terraform-aws-ec2-instance.
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.
from terraform-aws-ec2-instance.
Related Issues (20)
- EC2 module new variable "kms_create" HOT 1
- updating associate_public_ip_address should not cause ec2_instance to be replaced HOT 2
- Provision EC2 with FSXN filesystem HOT 3
- How can we create multiple ec2 instances with seperate network intefaces ? HOT 2
- Complement PR #239 with the ability to create spot instances which ignore AMI changes HOT 2
- Question: Change size of volumes getting attached when launching EC2 using an AMI that has multiple volumes HOT 3
- override vpc autoassign public_ip_address for created instance HOT 2
- add ignore associate_public_ip_address changes HOT 3
- main.tf line 12, in data "aws_ssm_parameter" "this": 12: count = local.create && var.ami == null ? 1 : 0 HOT 5
- disable_api_termination error HOT 1
- Add feature to specify custom lifecycle rules HOT 2
- ebs_block_device - # forces replacement HOT 2
- Add public static ip support for ec2 HOT 4
- v5.3.1 does not fix "ami variable when using without ssm" for fresh apply HOT 3
- Additional recreate triggers HOT 2
- Add support for network_card_index argument for network interfaces HOT 2
- Add support for launching into EC2 Capacity Blocks reservation HOT 2
- Access to metadata service returns 401 unauthorized HOT 4
- Allow creation of no-delete EC2 instances HOT 1
- Support for Automatic Recovery Configuration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-aws-ec2-instance.