Skip to content

This module provides a Cloud SQL proxy container instance on a COS vm

License

Notifications You must be signed in to change notification settings

appchoose/terraform-google-cloudsql-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Google Cloud SQL Proxy Module

This module launch in your GCP project a VM compute instance using the COS starting a Cloud SQL Proxy container.

It will :

  • Create a service account with cloudsql.instanceUser and cloudsql.client
  • Deploy a COS compute instance with the proxy started
  • Add an inbound rule in your firewall on the 5432 port to allow you to connect to the proxy

Usage

Take a loot at the example folder.

Requirements

Name Version
terraform ~> 1.1

Providers

Name Version
google n/a

Modules

Name Source Version
gce_container_sqlproxy terraform-google-modules/container-vm/google ~> 3.0

Resources

Name Type
google_compute_firewall.inbound resource
google_compute_instance.main resource
google_project_iam_member.cloudsql_instance_client_role_to_main_service_account resource
google_project_iam_member.cloudsql_instance_user_role_to_main_service_account resource
google_service_account.main resource

Inputs

Name Description Type Default Required
allow_public_ip Generate an ephemeral public if true bool false no
container_args Containers arguments. list(string) [] no
container_command Container command to start list(string)
[
"/cloud_sql_proxy"
]
no
container_image Source container image. Example : eu.gcr.io/cloudsql-docker/gce-proxy:1.32.0 string n/a yes
cos_image_family The COS image family to use (eg: stable, beta, or dev) string "stable" no
firewall_network The name or self_link of the network to attach this firewall to. string n/a yes
firewall_source_ranges The firewall will apply only to traffic that has source IP address in these ranges string n/a yes
instance_name Instance name string n/a yes
project Project id string n/a yes
vm_machine_type The machine type to create. string "e2-micro" no
vm_network The name or self_link of the network to attach this interface to. string null no
vm_subnetwork The name or self_link of the subnetwork to attach this interface to. string null no
vm_zone The zone that the machine should be created in string null no

Outputs

No outputs.