GithubHelp home page GithubHelp logo

Comments (8)

Dogers avatar Dogers commented on May 24, 2024 1

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.

antonbabenko avatar antonbabenko commented on May 24, 2024

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.

levmichael3 avatar levmichael3 commented on May 24, 2024

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

Dogers avatar Dogers commented on May 24, 2024

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

antonbabenko avatar antonbabenko commented on May 24, 2024

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.

Dogers avatar Dogers commented on May 24, 2024

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.

antonbabenko avatar antonbabenko commented on May 24, 2024

Right, example with security group was far-fetched :)

from terraform-aws-ec2-instance.

github-actions avatar github-actions commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.