Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Example for GCP instance. #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nat-henderson
Copy link

In hashicorp/terraform-provider-google#1816, a user was asking how to do a cloud-init config for a GCP provider, and suggested we add this example here.

@tjanez
Copy link

tjanez commented May 9, 2019

This would really be helpful for people wondering how to do cloud-init with GCP.

Why is it taking so long to review?

@@ -52,6 +52,15 @@ resource "aws_instance" "web" {
instance_type = "t2.micro"
user_data = "${data.template_cloudinit_config.config.rendered}"
}

# Start a GCP instance with the cloudinit config as user data.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note that one has to disable gzipping and base64 encoding with:

  gzip          = false
  base64_encode = false

as otherwise, the supplied user-data will be just ignored.

name = "instance"
machine_type = "n1-standard-1"
metadata {
user-data = "${data.template_cloudinit_config.config.rendered}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing a simple two-line startup script, either here or in a second example, might help people who are also just getting started with cloud-init. Something like:

user-data = "#!/bin/bash\necho bing > /tmp/baz\n"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants