Google Compute Engine Global Address

This page shows how to write Terraform for Compute Engine Global Address and write them securely.


Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.


Terraform Example (google_compute_global_address)

Represents a Global Address resource. Global addresses are used for HTTP(S) load balancing. To get more information about GlobalAddress, see:


  • address optionalcomputed - string
    • The IP address or beginning of the address range represented by this resource. This can be supplied as an input to reserve a specific address or omitted to allow GCP to choose a valid one for you.

  • address_type optional - string
    • The type of the address to reserve. EXTERNAL indicates public/external single IP address. INTERNAL indicates internal IP ranges belonging to some network. Default value: "EXTERNAL" Possible values: ["EXTERNAL", "INTERNAL"]

  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

  • description optional - string
    • An optional description of this resource.

  • id optionalcomputed - string
  • ip_version optional - string
    • The IP Version that will be used by this address. The default value is 'IPV4'. Possible values: ["IPV4", "IPV6"]

  • name required - string
    • Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression 'a-z?' which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

  • network optional - string
    • The URL of the network in which to reserve the IP range. The IP range must be in RFC1918 space. The network cannot be deleted if there are any reserved IP ranges referring to it. This should only be set when using an Internal address.

  • prefix_length optional - number
    • The prefix length of the IP range. If not present, it means the address field is a single IP address. This field is not applicable to addresses with addressType=EXTERNAL, or addressType=INTERNAL when purpose=PRIVATE_SERVICE_CONNECT

  • project optionalcomputed - string
  • purpose optional - string
    • The purpose of the resource. Possible values include: VPC_PEERING - for peer networks PRIVATE_SERVICE_CONNECT - for (Beta only) Private Service Connect networks

  • self_link requiredcomputed - string

Example Usage (from GitHub)

resource "google_compute_global_address" "development-ingress" {
  count       = var.ingress-ip-addresses == true ? 1 : 0
  name        = "dev-ingress-ip"
  description = "IP Address for development environment's k8s Ingress"

resource "google_compute_global_address" "k8s-ingress" {
  name = "k8s-ingress"

resource "google_compute_network" "default" {
  auto_create_subnetworks = true
resource "google_compute_global_address" "loadbalance-staging" {
  name         = "loadbalance-staging"
  address      = ""
  address_type = "EXTERNAL"

resource "google_compute_global_address" "master" {
  name         = var.master_publicip_name
  ip_version   = "IPV4"
  address_type = "EXTERNAL"

resource "google_compute_global_address" "tfg_uoc_app_devel_ip_address" {
  name        = "tfg-uoc-app-devel-ip"
  description = "Adreça IP reservada pel balancejador de l'entorn devel"

# Creem una reserva d'IP estàtica per l'entorn de producció

Frequently asked questions

What is Google Compute Engine Global Address?

Google Compute Engine Global Address is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Global Address?

For Terraform, the chris-ingrisani/terraform-google-securing-shift-left, ulamlabs/gcp-terraform-starter and epidemics/infra source code examples are useful. See the Terraform Example section for further details.