Comments (8)
Looks like no as the subnet_id var is only a string? It'd need to be a list along with an element() switch in the module to pick the subnet based on count.index.
This would break backwards compatibility but should be easy enough to add - any thoughts @antonbabenko ?
from terraform-aws-ec2-instance.
There is no need to change anything in this module, because one EC2 instance can be created in a single subnet, so as @Dogers is saying you have to provide subnet_id
it as a string
(use element(..., count.index)
).
Going to close #30.
Please let me know if I am missing something completely obvious.
from terraform-aws-ec2-instance.
@Dogers @antonbabenko Thank you first of all for the real fast response.
Secondly - my motivation was to create a cluster with dynamic number of nodes which is MZed.
Each node should have been created in a different zone dynamically so the code footprint was too long, calling the same module per zone. I gad to use Scaling group instead of this EC2 module.
from terraform-aws-ec2-instance.
@antonbabenko at the moment this module can only create X instances in subnet A per call of the module. The request here is to say create X instances over subnets A, B, C.
from terraform-aws-ec2-instance.
Yes, I understand that but I don't like this way because it hides the logic of creation of instances internally.
As a maintainer, I constantly have to think about what will happen when a user wants to create instances with different arguments (eg, security groups) depending on which subnet it is running.
Also, as a good practice and in most of the cases, you should be able to replace this module with terraform-aws-autoscaling module when you need to deploy across several subnets.
from terraform-aws-ec2-instance.
Can understand the first point and fair enough if that's the way you want it to go. Happy to keep a custom copy in this case :)
But for the second, SGs don't depend on subnets, as they're contained in the VPC rather than the subnet..?
We've got a need for this currently as we have some things that unfortunately can't be just brought up by an ASG.
from terraform-aws-ec2-instance.
Right, example with security group was far-fetched :)
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.