Skip to content

googleComputeAddresses

List IP addresses in a project. For more information see the official API list and aggregated lsit documentation.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleDnsManagedZoneProd = new google.dnsManagedZone.DnsManagedZone(
  this,
  "prod",
  {
    dns_name: "prod.mydomain.com.",
    name: "prod-zone",
  }
);
const dataGoogleComputeAddressesMyAddresses =
  new google.dataGoogleComputeAddresses.DataGoogleComputeAddresses(
    this,
    "my_addresses",
    {
      filter: "name:test-*",
    }
  );
new google.dnsRecordSet.DnsRecordSet(this, "frontend", {
  managed_zone: googleDnsManagedZoneProd.name,
  name: `frontend.\${${googleDnsManagedZoneProd.dnsName}}`,
  rrdatas: `\${${dataGoogleComputeAddressesMyAddresses.fqn}[*].address}`,
  ttl: 300,
  type: "A",
});

Argument Reference

The following arguments are supported:

  • project - (Optional) The google project in which addresses are listed. Defaults to provider's configuration if missing.

  • region - (Optional) Region that should be considered to search addresses. All regions are considered if missing.

  • filter - (Optional) A filter expression that filters resources listed in the response. The expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either "=", "!=", ">", "<", "<=", ">=" or ":". For example, if you are filtering Compute Engine instances, you can exclude instances named "example-instance" by specifying "name != example-instance". The ":" operator can be used with string fields to match substrings. For non-string fields it is equivalent to the "=" operator. The ":" comparison can be used to test whether a key has been defined. For example, to find all objects with "owner" label use: """ labels.owner: """ You can also filter nested fields. For example, you could specify "scheduling.automaticRestart = false" to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: """ (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") """ By default, each expression is an "AND" expression. However, you can include "AND" and "OR" expressions explicitly. For example: """ (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true)

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • addresses - A list of addresses matching the filter. Structure is defined below.

The addresses block supports:

  • name - The IP address name.
  • address - The IP address (for example 1234).
  • addressType - The IP address type, can be external or internal.
  • description - The IP address description.
  • status - Indicates if the address is used. Possible values are: RESERVED or IN_USE.
  • labels - (Beta only) A map containing IP labels.
  • region - The region in which the address resides.
  • selfLink - The URI of the created resource.