Skip to content

Latest commit

 

History

History

managed_instance_group

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Managed Instance Group

This example illustrates how to deploy a container to a managed instance group in GCP. Also includes SSH key configuration, so a user can be provisioned on the fly for future logins.

Requirements

This example requires that some python libraries be installed, as outlined in requirements.txt. Depending on your environment, you should be able to run pip install -r requirements.txt to satisfy these requirements.

Inputs

Name Description Type Default Required
additional_metadata Additional metadata to attach to the instance map(any) {} no
image The Docker image to deploy to GCE instances string "gcr.io/google-samples/hello-app:1.0" no
image_port The port the image exposes for HTTP requests number 8080 no
mig_instance_count The number of instances to place in the managed instance group string "2" no
mig_name The desired name to assign to the deployed managed instance group string "mig-test" no
network The GCP network string "mig-net" no
project_id The project ID to deploy resource into string n/a yes
region The GCP region to deploy instances into string n/a yes
service_account n/a
object({
email = string,
scopes = list(string)
})
{
"email": "",
"scopes": [
"cloud-platform"
]
}
no
subnetwork The name of the subnetwork to deploy instances into string "mig-subnet" no

Outputs

Name Description
container The container metadata provided to the module
http_address The IP address on which the HTTP service is exposed
http_port The port on which the HTTP service is exposed
vm_container_label The instance label containing container configuration
volumes The volume metadata provided to the module

Running

To provision this example, run the following from within this directory:

  • terraform init to get plugins
  • terraform plan to dry-run the infrastructure changes
  • terraform apply to apply the infrastructure changes
  • terraform destroy to tear down the created infrastructure