google.cloud.gcp_alloydb_instance_info module – List Alloydb.Instance resources

Note

This module is part of the google.cloud collection (version 1.15.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install google.cloud. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: google.cloud.gcp_alloydb_instance_info.

Synopsis

  • A managed alloydb cluster instance.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.8

  • requests >= 2.18.4

  • google-auth >= 2.25.1

Parameters

Parameter

Comments

access_token

string

The access token used to authenticate.

auth_kind

string / required

The type of credential used.

Choices:

  • "accesstoken"

  • "application"

  • "machineaccount"

  • "serviceaccount"

cluster

string / required

Identifies the alloydb cluster.

Must be in the format ‘projects/{project}/locations/{location}/clusters/{cluster_id}’.

env_type

string

Specifies which Ansible environment you’re running this module within.

This should not be set unless you know what you’re doing.

This only alters the User Agent string for any API requests.

filters

list / elements=string

A list of filter expression strings used to filter the resources returned by the API.

Each string is a filter expression (e.g. some_field = "SOME_VALUE").

Multiple expressions are combined with a logical AND.

Refer to the filter topic documentation https://cloud.google.com/sdk/gcloud/reference/topic/filters.

Refer to the AIP-160 filter syntax documentation https://google.aip.dev/160.

project

string

The Google Cloud Platform project to use.

scopes

list / elements=string

Array of scopes to be used.

service_account_contents

jsonarg

The contents of a Service Account JSON file,

either in a dictionary or as a JSON string that represents it.

service_account_email

string

An optional service account email address if machineaccount is

selected and the user does not wish to use the default email.

service_account_file

path

The path of a Service Account JSON file if serviceaccount

is selected as type.

Notes

Note

Examples

- name: List all gcp_alloydb_instance_info resources
  google.cloud.gcp_alloydb_instance_info:
    project: "{{ gcp_project }}"
    auth_kind: "{{ gcp_cred_kind }}"
    service_account_file: "{{ gcp_cred_file }}"
  register: result

- name: List gcp_alloydb_instance_info resources matching given filters
  google.cloud.gcp_alloydb_instance_info:
    filters:
      - display_name = "my-resource"
    project: "{{ gcp_project }}"
    auth_kind: "{{ gcp_cred_kind }}"
    service_account_file: "{{ gcp_cred_file }}"
  register: result

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Whether any changes were made (always false for info modules).

Returned: always

resources

list / elements=dictionary

List of Alloydb.Instance resources matching the supplied filters. May be empty, contain a single resource, or multiple resources.

Returned: always

activationPolicy

string

‘Specifies whether an instance needs to spin up.

Once the instance is active, the activation policy can be updated to the `NEVER` to stop the instance.

Likewise, the activation policy can be updated to `ALWAYS` to start the instance.

There are restrictions around when an instance can/cannot be activated (for example, a read pool instance should be stopped before stopping primary etc.).

Please refer to the API documentation for more details.

Possible values are: `ACTIVATION_POLICY_UNSPECIFIED`, `ALWAYS`, `NEVER`.’.

Returned: when set

annotations

dictionary

Annotations to allow client tools to store small amount of arbitrary data.

This is distinct from labels.

**Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.

Returned: when set

availabilityType

string

‘Availability type of an Instance.

Defaults to REGIONAL for both primary and read instances.

Note that primary and read instances can have different availability types.

Primary instances can be either ZONAL or REGIONAL.

Read Pool instances can also be either ZONAL or REGIONAL.

Read pools of size 1 can only have zonal availability.

Read pools with a node count of 2 or more can have regional availability (nodes are present in 2 or more zones in a region).

Possible values are: `AVAILABILITY_TYPE_UNSPECIFIED`, `ZONAL`, `REGIONAL`.’.

Returned: when set

clientConnectionConfig

dictionary

Client connection specific configurations.

Returned: when set

requireConnectors

boolean

Configuration to enforce connectors only (ex: AuthProxy) connections to the database.

Returned: when set

sslConfig

dictionary

SSL config option for this instance.

Returned: when set

sslMode

string

SSL mode.

Specifies client-server SSL/TLS connection behavior.

Returned: when set

connectionPoolConfig

dictionary

Configuration for Managed Connection Pool.

Returned: when set

enabled

boolean

Whether to enabled Managed Connection Pool.

Returned: always

flags

dictionary

Flags for configuring managed connection pooling when it is enabled.

These flags will only be set if `connection_pool_config.enabled` is true.

Please see https://cloud.google.com/alloydb/docs/configure-managed-connection-pooling#configuration-options for a comprehensive list of flags that can be set.

Returned: when set

poolerCount

integer

The number of running poolers per instance.

Returned: success

createTime

string

Time the Instance was created in UTC.

Returned: success

databaseFlags

dictionary

Database flags.

Set at instance level.

* They are copied from primary instance on read instance creation.

* Read instances can set new or override existing flags that are relevant for reads, e.g.

for enabling columnar cache on a read instance.

Flags set on read instance may or may not be present on primary.

Returned: when set

gceZone

string

The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances.

If present for a REGIONAL instance, an error will be thrown.

If this is absent for a ZONAL instance, instance is created in a random zone with available capacity.

Returned: when set

instanceType

string

The type of the instance.

If the instance type is SECONDARY, point to the cluster_type of the associated secondary cluster instead of mentioning SECONDARY.

Returned: always

ipAddress

string

The IP address for the Instance.

This is the connection endpoint for an end-user application.

Returned: success

labels

dictionary

User-defined labels for the alloydb instance.

**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.

Returned: when set

machineConfig

dictionary

Configurations for the machines that host the underlying database engine.

Returned: when set

cpuCount

integer

The number of CPU’s in the VM instance.

Returned: when set

machineType

string

Machine type of the VM instance.

E.g.

“n2-highmem-4”, “n2-highmem-8”, “c4a-highmem-4-lssd”.

`cpu_count` must match the number of vCPUs in the machine type.

Returned: when set

name

string

The name of the instance resource.

Returned: success

networkConfig

dictionary

Instance level network configuration.

Returned: when set

allocatedIpRangeOverride

string

Name of the allocated IP range for the private IP AlloyDB instance, for example: “google-managed-services-default”.

If set, the instance IPs will be created from this allocated range and will override the IP range used by the parent cluster.

The range name must comply with RFC 1035.

Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?.

Returned: when set

authorizedExternalNetworks

list / elements=dictionary

A list of external networks authorized to access this instance.

This field is only allowed to be set when `enable_public_ip` is set to true.

Returned: when set

cidrRange

string

CIDR range for one authorized network of the instance.

Returned: when set

enableOutboundPublicIp

boolean

Enabling outbound public ip for the instance.

Returned: when set

enablePublicIp

boolean

Enabling public ip for the instance.

If a user wishes to disable this, please also clear the list of the authorized external networks set on the same instance.

Returned: when set

observabilityConfig

dictionary

Configuration for enhanced query insights.

Returned: when set

assistiveExperiencesEnabled

boolean

Whether assistive experiences are enabled for this AlloyDB instance.

Returned: when set

enabled

boolean

Observability feature status for an instance.

Returned: when set

maxQueryStringLength

integer

Query string length.

The default value is 10240.

Any integer between 1024 and 100000 is considered valid.

Returned: when set

preserveComments

boolean

Preserve comments in the query string.

Returned: when set

queryPlansPerMinute

integer

Number of query execution plans captured by Insights per minute for all queries combined.

The default value is 5.

Any integer between 0 and 200 is considered valid.

Returned: when set

recordApplicationTags

boolean

Record application tags for an instance.

This flag is turned “on” by default.

Returned: when set

trackActiveQueries

boolean

Track actively running queries.

If not set, default value is “off”.

Returned: when set

trackClientAddress

boolean

Track client address for an instance.

If not set, default value is “off”.

Returned: when set

trackWaitEvents

boolean

Record wait events during query execution for an instance.

Returned: when set

trackWaitEventTypes

boolean

Record wait event types during query execution for an instance.

Returned: when set

outboundPublicIpAddresses

list / elements=string

The outbound public IP addresses for the instance.

This is available ONLY when networkConfig.enableOutboundPublicIp is set to true.

These IP addresses are used for outbound connections.

Returned: success

pscInstanceConfig

dictionary

Configuration for Private Service Connect (PSC) for the instance.

Returned: when set

allowedConsumerProjects

list / elements=string

List of consumer projects that are allowed to create PSC endpoints to service-attachments to this instance.

These should be specified as project numbers only.

Returned: when set

pscAutoConnections

list / elements=dictionary

Configurations for setting up PSC service automation.

Returned: when set

consumerNetwork

string

The consumer network for the PSC service automation, example: “projects/vpc-host-project/global/networks/default”.

The consumer network might be hosted a different project than the consumer project.

The API expects the consumer project specified to be the project ID (and not the project number).

Returned: when set

consumerNetworkStatus

string

The status of the service connection policy.

Returned: success

consumerProject

string

The consumer project to which the PSC service automation endpoint will be created.

The API expects the consumer project to be the project ID( and not the project number).

Returned: when set

ipAddress

string

The IP address of the PSC service automation endpoint.

Returned: success

status

string

The status of the PSC service automation connection.

Returned: success

pscDnsName

string

The DNS name of the instance for PSC connectivity.

Name convention: <uid>.<uid>.<region>.alloydb-psc.goog.

Returned: success

pscInterfaceConfigs

list / elements=dictionary

Configurations for setting up PSC interfaces attached to the instance which are used for outbound connectivity.

Currently, AlloyDB supports only 0 or 1 PSC interface.

Returned: when set

networkAttachmentResource

string

The network attachment resource created in the consumer project to which the PSC interface will be linked.

This is of the format: “projects/${CONSUMER_PROJECT}/regions/${REGION}/networkAttachments/${NETWORK_ATTACHMENT_NAME}”.

The network attachment must be in the same region as the instance.

Returned: when set

string

The service attachment created when Private Service Connect (PSC) is enabled for the instance.

The name of the resource will be in the format of `projects/<alloydb-tenant-project-number>/regions/<region-name>/serviceAttachments/<service-attachment-name>`.

Returned: success

publicIpAddress

string

The public IP addresses for the Instance.

This is available ONLY when networkConfig.enablePublicIp is set to true.

This is the connection endpoint for an end-user application.

Returned: success

queryInsightsConfig

dictionary

Configuration for query insights.

Returned: when set

queryPlansPerMinute

integer

Number of query execution plans captured by Insights per minute for all queries combined.

The default value is 5.

Any integer between 0 and 20 is considered valid.

Returned: when set

queryStringLength

integer

Query string length.

The default value is 1024.

Any integer between 256 and 4500 is considered valid.

Returned: when set

recordApplicationTags

boolean

Record application tags for an instance.

This flag is turned “on” by default.

Returned: when set

recordClientAddress

boolean

Record client address for an instance.

Client address is PII information.

This flag is turned “on” by default.

Returned: when set

readPoolConfig

dictionary

Read pool specific config.

If the instance type is READ_POOL, this configuration must be provided.

Returned: when set

nodeCount

integer

Read capacity, i.e.

number of nodes in a read pool instance.

Returned: when set

reconciling

boolean

Set to true if the current state of Instance does not match the user’s intended state, and the service is actively updating the resource to reconcile them.

This can happen due to user-triggered updates or system actions like failover or maintenance.

Returned: success

state

string

The current state of the alloydb instance.

Returned: success

uid

string

The system-generated UID of the resource.

Returned: success

updateTime

string

Time the Instance was updated in UTC.

Returned: success

Authors

  • Google Inc. (@googlecloudplatform)