Git Product home page Git Product logo

Comments (10)

dkpat12 avatar dkpat12 commented on May 18, 2024 6

This feature would be extremely useful to me. I need to add a file (not a startup script, which I can use the metadata tag for) to all the instances in the managed group for their use during the startup script.

from terraform-provider-google.

meangrape avatar meangrape commented on May 18, 2024

Hi, there!
I'm interested in the same functionality...I can make templates just fine. But I need to provision the instantiations separately -- for instance, I pull my consul configuration from a remote state (generated by the consul servers instantiation).

Do I need to try and shoe-horn everything into the google_compute_instance_template startup scripts using terraform templates?

from terraform-provider-google.

danawillow avatar danawillow commented on May 18, 2024

This is a fairly old issue but I thought I'd take a look and see what I could come up with.

As mentioned in the comments of the originally-filed issue, the sample configuration in question is trying to remote-exec on an instance template. Instance templates themselves don't have any sort of ssh ability; it's the instances created from those templates that do. Hypothetically I could see an FR to add this type of support to instance_group_manager, since that creates instances. However, that doesn't sit great with me- you aren't really sshing into the manager, what you want is to ssh into the instances. Also, Terraform only allows setting one "connection info" in state per-resource, so it's unclear which instance of the provisioned would be the one that gets connected to.

Because of this, I'm going to go ahead and close this issue. However, if anyone feels strongly about it please speak up and I'm happy to reopen it.

cc @Jayed, @jwmarshall

from terraform-provider-google.

nmaludy avatar nmaludy commented on May 18, 2024

Ran across this too. Need to ssh in to perform some post-boot customizations to the image.

from terraform-provider-google.

southwel avatar southwel commented on May 18, 2024

+1 this would be lovely.

from terraform-provider-google.

nat-henderson avatar nat-henderson commented on May 18, 2024

I've been thinking about how to build this. I think the technique here would be to create an instance from the template, run the provisioner on that, then create an image from that instance, then create a second template from that image. Does that seem right? If so, I don't think there's work on the provider-side to enable that - anything we did on our end to reduce the complexity in configuration there would have to perform roughly those same startup steps behind the scenes, and it seems to me that explicit is better than implicit.

An alternative would be to construct a way to run the provisioners on every instance created by the template. You might be able to rig this up with wait_for_instances = true, and an array of null resources which depends_on each of a target pool's instances. I'm not sure that that would work, but I think it would.

from terraform-provider-google.

paddycarver avatar paddycarver commented on May 18, 2024

I'm pretty against adding this functionality. The docs are pretty clear that you should not be relying on the state of disks:

Because of the stateless nature of managed instance groups, you should design or retrofit your application so that it does not depend on specific instance properties that will not persist, such as an IP address or in-memory data. Likewise, the default behavior for boot persistent disks is to delete them when the corresponding VM instance is deleted so you should not rely on boot disks as persistent data in a managed instance group.

If you need to customize an image after boot, the appropriate place to do that is in the startup script. remote-exec is pretty much never appropriate with an instance group manager, because the instance group manager is managing the instances, not Terraform. That means instances may be autoscaled, deleted, added, or restarted without Terraform ever knowing about it, and remote-exec can't run in those situations.

from terraform-provider-google.

meangrape avatar meangrape commented on May 18, 2024

Thanks for your comments and see how it probably would end up being an ugly kludge.

from terraform-provider-google.

nat-henderson avatar nat-henderson commented on May 18, 2024

Thanks! I'll go ahead and close the issue.

from terraform-provider-google.

 avatar commented on May 18, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

from terraform-provider-google.

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.