Merge branch 'master' into master

This commit is contained in:
Samir F 2025-07-29 11:05:57 -04:00 committed by GitHub
commit 03480489ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
255 changed files with 3886 additions and 661 deletions

View file

@ -150,7 +150,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -311,7 +311,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery']

View file

@ -253,6 +253,7 @@ options:
data .
required: false
type: int
default: 0
source_format:
description:
- The data format.
@ -328,6 +329,7 @@ options:
when reading the data.
required: false
type: int
default: 0
csv_options:
description:
- Additional properties to set if sourceFormat is set to CSV.
@ -368,6 +370,7 @@ options:
when reading the data.
required: false
type: int
default: 0
bigtable_options:
description:
- Additional options if sourceFormat is set to BIGTABLE.

View file

@ -590,7 +590,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(dataset=dict(type='str')))
module = GcpModule(argument_spec=dict(dataset=dict(type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/bigquery']

View file

@ -188,7 +188,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -1536,7 +1536,7 @@ def main():
),
),
pubsub_config=dict(type='dict', options=dict(topic=dict(required=True, type='str'), service_account_email=dict(type='str'))),
webhook_config=dict(type='dict', options=dict(secret=dict(required=True, type='str'))),
webhook_config=dict(type='dict', options=dict(secret=dict(required=True, type='str', no_log=True))),
build=dict(
type='dict',
options=dict(
@ -1568,7 +1568,11 @@ def main():
queue_ttl=dict(type='str'),
logs_bucket=dict(type='str'),
timeout=dict(default='600s', type='str'),
secrets=dict(type='list', elements='dict', options=dict(kms_key_name=dict(required=True, type='str'), secret_env=dict(type='dict'))),
secrets=dict(
type='list',
elements='dict',
no_log=True,
options=dict(kms_key_name=dict(required=True, type='str'), secret_env=dict(type='dict', no_log=True))),
steps=dict(
required=True,
type='list',
@ -1580,7 +1584,7 @@ def main():
id=dict(type='str'),
entrypoint=dict(type='str'),
dir=dict(type='str'),
secret_env=dict(type='list', elements='str'),
secret_env=dict(type='list', elements='str', no_log=True),
timeout=dict(type='str'),
timing=dict(type='str'),
volumes=dict(
@ -1609,7 +1613,7 @@ def main():
worker_pool=dict(type='str'),
logging=dict(type='str'),
env=dict(type='list', elements='str'),
secret_env=dict(type='list', elements='str'),
secret_env=dict(type='list', elements='str', no_log=True),
volumes=dict(type='list', elements='dict', options=dict(name=dict(type='str'), path=dict(type='str'))),
),
),

View file

@ -814,7 +814,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -273,7 +273,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -681,8 +681,8 @@ def main():
http_method=dict(type='str'),
body=dict(type='str'),
headers=dict(type='dict'),
oauth_token=dict(type='dict', options=dict(service_account_email=dict(required=True, type='str'), scope=dict(type='str'))),
oidc_token=dict(type='dict', options=dict(service_account_email=dict(required=True, type='str'), audience=dict(type='str'))),
oauth_token=dict(type='dict', no_log=True, options=dict(service_account_email=dict(required=True, type='str'), scope=dict(type='str'))),
oidc_token=dict(type='dict', no_log=True, options=dict(service_account_email=dict(required=True, type='str'), audience=dict(type='str'))),
),
),
region=dict(required=True, type='str'),

View file

@ -379,7 +379,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -279,7 +279,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -235,7 +235,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -320,7 +320,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -252,7 +252,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -88,7 +88,7 @@ options:
completely drained, offering 0% of its available Capacity. Valid range is
[0.0,1.0].
required: false
default: '1.0'
default: '1'
type: str
description:
description:
@ -422,6 +422,11 @@ options:
elements: str
required: false
type: list
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
type: str
description:
description:
- An optional description of this resource.
@ -478,7 +483,7 @@ options:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which each
healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts
and picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a host
@ -566,6 +571,7 @@ options:
be used to disable ejection or to ramp it up slowly. Defaults to 0.
required: false
type: int
default: 0
enforcing_success_rate:
description:
- The percentage chance that a host will be actually ejected when an outlier
@ -1210,7 +1216,7 @@ localityLbPolicy:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which each
healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts and
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts and
picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a host
@ -1490,6 +1496,7 @@ def main():
options=dict(
cache_key_policy=dict(
type="dict",
no_log=False,
options=dict(
include_host=dict(type="bool"),
include_protocol=dict(type="bool"),

View file

@ -549,7 +549,7 @@ resources:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which
each healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts
and picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a
@ -762,7 +762,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -570,14 +570,20 @@ def main():
provisioned_iops=dict(type='int'),
zone=dict(required=True, type='str'),
source_image_encryption_key=dict(
type='dict', no_log=True, options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
),
disk_encryption_key=dict(
type='dict', no_log=True, options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
),
source_snapshot=dict(type='dict', no_log=True),
source_snapshot_encryption_key=dict(
type='dict', no_log=True, options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
),
)
)

View file

@ -375,7 +375,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -175,7 +175,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -322,7 +322,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -314,7 +314,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -205,7 +205,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -289,7 +289,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -457,7 +457,6 @@ options:
- Indicates whether or not to export logs. This is false by default, which
means no health check logging will be done.
required: false
default: 'false'
type: bool
project:
description:

View file

@ -527,7 +527,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -204,7 +204,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -204,7 +204,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -545,13 +545,13 @@ def main():
disk_size_gb=dict(type='int'),
family=dict(type='str'),
guest_os_features=dict(type='list', elements='dict', options=dict(type=dict(required=True, type='str'))),
image_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'))),
image_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
labels=dict(type='dict'),
licenses=dict(type='list', elements='str'),
name=dict(required=True, type='str'),
raw_disk=dict(type='dict', options=dict(container_type=dict(type='str'), sha1_checksum=dict(type='str'), source=dict(required=True, type='str'))),
source_disk=dict(type='dict'),
source_disk_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'))),
source_disk_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
source_disk_id=dict(type='str'),
source_image=dict(type='dict'),
source_snapshot=dict(type='dict'),

View file

@ -351,7 +351,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -61,6 +61,13 @@ options:
- Whether the resource should be protected against deletion.
required: false
type: bool
discard_local_ssd:
description:
- Discards the contents of any attached Local SSD disks when changing status
to TERMINATED.
default: True
required: false
type: bool
disks:
description:
- An array of disks that are associated with the instances that are created from
@ -388,6 +395,19 @@ options:
field to "{{ name-of-resource }}"'
required: false
type: dict
nic_type:
description:
- Type of network interface card attached to instance.
- If unspecified it will use the default provided by GCP.
- As the next generation network interface which succeeds VirtIO, gVNIC
replaces VirtIO-Net as the only supported network interface in Compute
Engine for all new machine types (Generation 3 and onwards).
- Newer machine series and networking features require gVNIC instead of VirtIO.
required: false
type: str
choices:
- VIRTIO_NET
- GVNIC
scheduling:
description:
- Sets the scheduling options for this instance.
@ -1117,6 +1137,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'),
can_ip_forward=dict(type='bool', aliases=['ip_forward']),
deletion_protection=dict(type='bool'),
discard_local_ssd=dict(type='bool', required=False, default=True),
disks=dict(
type='list',
elements='dict',
@ -1124,7 +1145,9 @@ def main():
auto_delete=dict(type='bool'),
boot=dict(type='bool'),
device_name=dict(type='str'),
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))),
disk_encryption_key=dict(type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), rsa_encrypted_key=dict(type='str', no_log=True))),
index=dict(type='int'),
initialize_params=dict(
type='dict',
@ -1133,7 +1156,7 @@ def main():
disk_size_gb=dict(type='int'),
disk_type=dict(type='str'),
source_image=dict(type='str', aliases=['image', 'image_family']),
source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'))),
source_image_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
),
),
interface=dict(type='str'),
@ -1170,6 +1193,7 @@ def main():
network_ip=dict(type='str'),
subnetwork=dict(type='dict'),
stack_type=dict(type='str'),
nic_type=dict(type='str', choices=['VIRTIO_NET', 'GVNIC']),
),
),
scheduling=dict(
@ -1510,7 +1534,9 @@ class InstancePower(object):
return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}/start".format(**self.module.params)
def _stop_url(self):
return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}/stop".format(**self.module.params)
return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{name}/stop?discardLocalSsd={discard_local_ssd}".format(
**self.module.params
)
def deletion_protection_update(module, request, response):
@ -1710,6 +1736,7 @@ class InstanceNetworkinterfacesArray(object):
u'networkIP': item.get('network_ip'),
u'stackType': item.get('stack_type'),
u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'),
u'nicType': item.get('nic_type'),
}
)
@ -1722,6 +1749,7 @@ class InstanceNetworkinterfacesArray(object):
u'networkIP': item.get(u'networkIP'),
u'stackType': item.get('stackType'),
u'subnetwork': item.get(u'subnetwork'),
u'nicType': item.get(u'nicType'),
}
)

View file

@ -213,7 +213,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -288,7 +288,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -621,7 +621,8 @@ def main():
argument_spec=dict(
filters=dict(type="list", elements="str"),
zone=dict(required=True, type="str"),
)
),
supports_check_mode=True
)
if not module.params["scopes"]:

View file

@ -1019,7 +1019,9 @@ def main():
auto_delete=dict(type='bool'),
boot=dict(type='bool'),
device_name=dict(type='str'),
disk_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'), rsa_encrypted_key=dict(type='str'))),
disk_encryption_key=dict(type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), rsa_encrypted_key=dict(type='str', no_log=True))),
index=dict(type='int'),
initialize_params=dict(
type='dict',
@ -1028,7 +1030,7 @@ def main():
disk_size_gb=dict(type='int'),
disk_type=dict(type='str'),
source_image=dict(type='str'),
source_image_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'))),
source_image_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
),
),
interface=dict(type='str'),

View file

@ -560,7 +560,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -320,7 +320,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -192,7 +192,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -202,7 +202,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -219,7 +219,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -220,7 +220,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -320,7 +320,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -476,7 +476,7 @@ options:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which each
healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts
and picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a host
@ -566,6 +566,7 @@ options:
be used to disable ejection or to ramp it up slowly. Defaults to 0.
required: false
type: int
default: 0
enforcing_success_rate:
description:
- The percentage chance that a host will be actually ejected when an outlier
@ -1222,7 +1223,7 @@ localityLbPolicy:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which each
healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts and
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts and
picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a host
@ -1507,6 +1508,7 @@ def main():
options=dict(
cache_key_policy=dict(
type='dict',
no_log=False,
options=dict(
include_host=dict(type='bool'),
include_protocol=dict(type='bool'),

View file

@ -559,7 +559,7 @@ resources:
- The load balancing algorithm used within the scope of the locality.
- The possible values are - * ROUND_ROBIN - This is a simple policy in which
each healthy backend is selected in round robin order.
- "* LEAST_REQUEST - An O(1) algorithm which selects two random healthy hosts
- "* LEAST_REQUEST - An algorithm which selects two random healthy hosts
and picks the host which has fewer active requests."
- "* RING_HASH - The ring/modulo hash load balancer implements consistent hashing
to backends. The algorithm has the property that the addition/removal of a
@ -787,7 +787,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -430,9 +430,9 @@ def main():
replica_zones=dict(required=True, type='list', elements='str'),
type=dict(type='str'),
region=dict(required=True, type='str'),
disk_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'))),
disk_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
source_snapshot=dict(type='dict'),
source_snapshot_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str'))),
source_snapshot_encryption_key=dict(type='dict', no_log=True, options=dict(raw_key=dict(type='str', no_log=True))),
)
)

View file

@ -293,7 +293,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -452,7 +452,6 @@ options:
- Indicates whether or not to export logs. This is false by default, which
means no health check logging will be done.
required: false
default: 'false'
type: bool
region:
description:

View file

@ -538,7 +538,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -301,7 +301,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -176,7 +176,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -183,7 +183,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -302,7 +302,6 @@ options:
is considered a match if the match criteria above are NOT met.
Defaults to false.
required: false
default: 'false'
type: bool
prefix_match:
description:
@ -364,7 +363,6 @@ options:
- Specifies that prefixMatch and fullPathMatch matches are case sensitive.
- Defaults to false.
required: false
default: 'false'
type: bool
metadata_filters:
description:
@ -499,7 +497,6 @@ options:
to the Access- Control-Allow-Credentials header. Defaults to
false.
required: false
default: 'false'
type: bool
allow_headers:
description:
@ -535,7 +532,6 @@ options:
- which indicates that the CORS policy is in effect. Defaults
to false.
required: false
default: 'false'
type: bool
expose_headers:
description:
@ -882,7 +878,6 @@ options:
used in TargetHttpProxys. Setting this true for TargetHttpsProxy
is not permitted. The default is set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -926,7 +921,6 @@ options:
query portion of the original URL is retained. The default value
is false.
required: false
default: 'false'
type: bool
path_rules:
description:
@ -993,7 +987,6 @@ options:
to the Access- Control-Allow-Credentials header. Defaults to
false.
required: false
default: 'false'
type: bool
allow_headers:
description:
@ -1373,7 +1366,6 @@ options:
used in TargetHttpProxys. Setting this true for TargetHttpsProxy
is not permitted. The default is set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -1416,7 +1408,6 @@ options:
is removed prior to redirecting the request. If set to false, the
query portion of the original URL is retained.
required: false
default: 'false'
type: bool
default_url_redirect:
description:
@ -1441,7 +1432,6 @@ options:
in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted.
The default is set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -1483,7 +1473,6 @@ options:
removed prior to redirecting the request. If set to false, the query
portion of the original URL is retained.
required: false
default: 'false'
type: bool
tests:
description:
@ -1541,7 +1530,6 @@ options:
Setting this true for TargetHttpsProxy is not permitted. The default is
set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -1582,7 +1570,6 @@ options:
prior to redirecting the request. If set to false, the query portion of
the original URL is retained.
required: false
default: 'false'
type: bool
region:
description:

View file

@ -1604,7 +1604,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -73,7 +73,6 @@ options:
this reservation. Otherwise, it can be consumed by VMs with affinity for any
reservation. Defaults to false.
required: false
default: 'false'
type: bool
specific_reservation:
description:

View file

@ -258,7 +258,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -346,7 +346,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -217,7 +217,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -222,7 +222,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -388,10 +388,14 @@ def main():
source_disk=dict(required=True, type='dict'),
zone=dict(type='str'),
snapshot_encryption_key=dict(
type='dict', no_log=True, options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
),
source_disk_encryption_key=dict(
type='dict', no_log=True, options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
type='dict',
no_log=True,
options=dict(raw_key=dict(type='str', no_log=True), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
),
)
)

View file

@ -260,7 +260,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -171,7 +171,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -207,7 +207,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -226,7 +226,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -171,7 +171,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -193,7 +193,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -178,7 +178,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -224,7 +224,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -183,7 +183,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -175,7 +175,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -186,7 +186,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -70,6 +70,11 @@ options:
the resource.
required: false
type: str
fingerprint:
description:
- Fingerprint of this resource. A hash of the contents stored in this object. This
field is used in optimistic locking.
type: str
header_action:
description:
- Specifies changes to request and response headers that need to take effect for
@ -357,7 +362,6 @@ options:
to the Access- Control-Allow-Credentials header. Defaults to
false.
required: false
default: 'false'
type: bool
allow_headers:
description:
@ -737,7 +741,6 @@ options:
used in TargetHttpProxys. Setting this true for TargetHttpsProxy
is not permitted. The default is set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -780,7 +783,6 @@ options:
is removed prior to redirecting the request. If set to false, the
query portion of the original URL is retained.
required: false
default: 'false'
type: bool
route_rules:
description:
@ -948,7 +950,6 @@ options:
is considered a match if the match criteria above are NOT met.
Defaults to false.
required: false
default: 'false'
type: bool
prefix_match:
description:
@ -1010,7 +1011,6 @@ options:
- Specifies that prefixMatch and fullPathMatch matches are case sensitive.
- Defaults to false.
required: false
default: 'false'
type: bool
metadata_filters:
description:
@ -1145,7 +1145,6 @@ options:
to the Access- Control-Allow-Credentials header. Defaults to
false.
required: false
default: 'false'
type: bool
allow_headers:
description:
@ -1181,7 +1180,6 @@ options:
- which indicates that the CORS policy is in effect. Defaults
to false.
required: false
default: 'false'
type: bool
expose_headers:
description:
@ -1531,7 +1529,6 @@ options:
- Setting this true for TargetHttpsProxy is not permitted. Defaults
to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -1569,7 +1566,6 @@ options:
is removed prior to redirecting the request. If set to false, the
query portion of the original URL is retained. Defaults to false.
required: false
default: 'false'
type: bool
default_url_redirect:
description:
@ -1594,7 +1590,6 @@ options:
in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted.
The default is set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -1636,7 +1631,6 @@ options:
removed prior to redirecting the request. If set to false, the query
portion of the original URL is retained.
required: false
default: 'false'
type: bool
default_route_action:
description:
@ -1733,7 +1727,6 @@ options:
- If true, headerValue is set for the header, discarding any
values that were set for that header.
required: false
default: 'false'
type: bool
response_headers_to_remove:
description:
@ -1767,7 +1760,6 @@ options:
- If true, headerValue is set for the header, discarding any
values that were set for that header.
required: false
default: 'false'
type: bool
url_rewrite:
description:
@ -1960,14 +1952,12 @@ options:
that the actual request can include user credentials.
- This translates to the Access-Control-Allow-Credentials header.
required: false
default: 'false'
type: bool
disabled:
description:
- If true, specifies the CORS policy is disabled. The default value
is false, which indicates that the CORS policy is in effect.
required: false
default: 'false'
type: bool
fault_injection_policy:
description:
@ -2095,7 +2085,6 @@ options:
Setting this true for TargetHttpsProxy is not permitted. The default is
set to false.
required: false
default: 'false'
type: bool
path_redirect:
description:
@ -2136,7 +2125,6 @@ options:
prior to redirecting the request. If set to false, the query portion of
the original URL is retained. The default is set to false.
required: false
default: 'false'
type: bool
default_route_action:
description:
@ -2231,8 +2219,6 @@ options:
exist for the header.
- If true, headerValue is set for the header, discarding any values
that were set for that header.
required: false
default: 'false'
type: bool
response_headers_to_remove:
description:
@ -2266,7 +2252,6 @@ options:
- If true, headerValue is set for the header, discarding any values
that were set for that header.
required: false
default: 'false'
type: bool
url_rewrite:
description:
@ -2456,14 +2441,12 @@ options:
the actual request can include user credentials.
- This translates to the Access-Control-Allow-Credentials header.
required: false
default: 'false'
type: bool
disabled:
description:
- If true, specifies the CORS policy is disabled. The default value is
false, which indicates that the CORS policy is in effect.
required: false
default: 'false'
type: bool
fault_injection_policy:
description:

View file

@ -2487,7 +2487,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -247,7 +247,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/compute']

View file

@ -1528,7 +1528,9 @@ def main():
accelerators=dict(type='list', elements='dict', options=dict(accelerator_count=dict(type='str'), accelerator_type=dict(type='str'))),
disk_type=dict(type='str'),
min_cpu_platform=dict(type='str'),
taints=dict(type='list', elements='dict', options=dict(key=dict(type='str'), value=dict(type='str'), effect=dict(type='str'))),
taints=dict(type='list',
elements='dict',
options=dict(key=dict(type='str', no_log=False), value=dict(type='str'), effect=dict(type='str'))),
shielded_instance_config=dict(
type='dict', options=dict(enable_secure_boot=dict(type='bool'), enable_integrity_monitoring=dict(type='bool'))
),
@ -1538,7 +1540,7 @@ def main():
type='dict',
options=dict(
username=dict(type='str'),
password=dict(type='str'),
password=dict(type='str', no_log=True),
client_certificate_config=dict(type='dict', options=dict(issue_client_certificate=dict(type='bool'))),
),
),

View file

@ -859,7 +859,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone'])))
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone'])), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -764,7 +764,9 @@ def main():
accelerators=dict(type='list', elements='dict', options=dict(accelerator_count=dict(type='int'), accelerator_type=dict(type='str'))),
disk_type=dict(type='str'),
min_cpu_platform=dict(type='str'),
taints=dict(type='list', elements='dict', options=dict(key=dict(type='str'), value=dict(type='str'), effect=dict(type='str'))),
taints=dict(type='list',
elements='dict',
options=dict(key=dict(type='str', no_log=False), value=dict(type='str'), effect=dict(type='str'))),
shielded_instance_config=dict(
type='dict', options=dict(enable_secure_boot=dict(type='bool'), enable_integrity_monitoring=dict(type='bool'))
),

View file

@ -450,7 +450,8 @@ import json
def main():
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True, type='dict')))
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True, type='dict')),
supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -508,8 +508,12 @@ def main():
default_key_specs=dict(
type='list',
elements='dict',
no_log=False,
options=dict(
algorithm=dict(type='str'), key_length=dict(type='int'), key_type=dict(type='str'), kind=dict(default='dns#dnsKeySpec', type='str')
algorithm=dict(type='str'),
key_length=dict(type='int', no_log=False),
key_type=dict(type='str'),
kind=dict(default='dns#dnsKeySpec', type='str')
),
),
),

View file

@ -308,7 +308,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(dns_name=dict(type='list', elements='str')))
module = GcpModule(argument_spec=dict(dns_name=dict(type='list', elements='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']

View file

@ -160,7 +160,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(managed_zone=dict(required=True, type='dict')))
module = GcpModule(argument_spec=dict(managed_zone=dict(required=True, type='dict')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']

View file

@ -213,7 +213,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -156,7 +156,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/iam']

View file

@ -155,7 +155,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/iam']

View file

@ -104,6 +104,7 @@ options:
- If set to true, the request will create a CryptoKey without any CryptoKeyVersions.
You must use the `google_kms_key_ring_import_job` resource to import the CryptoKeyVersion.
required: false
default: false
type: bool
project:
description:
@ -284,7 +285,7 @@ def main():
purpose=dict(default='ENCRYPT_DECRYPT', type='str'),
rotation_period=dict(type='str'),
version_template=dict(type='dict', options=dict(algorithm=dict(required=True, type='str'), protection_level=dict(type='str'))),
key_ring=dict(required=True, type='str'),
key_ring=dict(required=True, type='str', no_log=False),
skip_initial_version_creation=dict(type='bool', default=False),
)
)

View file

@ -198,7 +198,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(key_ring=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(key_ring=dict(required=True, type='str', no_log=False)), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloudkms']

View file

@ -151,7 +151,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloudkms']

View file

@ -528,7 +528,8 @@ def main():
labels=dict(
type='list',
elements='dict',
options=dict(key=dict(required=True, type='str'), description=dict(type='str'), value_type=dict(default='STRING', type='str')),
options=dict(key=dict(required=True, type='str', no_log=False),
description=dict(type='str'), value_type=dict(default='STRING', type='str')),
),
display_name=dict(type='str'),
),

View file

@ -302,7 +302,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -169,7 +169,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -260,7 +260,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(model=dict(required=True, type='dict')))
module = GcpModule(argument_spec=dict(model=dict(required=True, type='dict')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -0,0 +1,649 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt
# or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
################################################################################
# Documentation
################################################################################
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_parameter_manager
description:
- Access and Update Google Cloud Parameter Manager objects
- Create new parameters.
- Create new parameters with format.
- Create new parameters with labels.
- Create new parameters with format and labels.
- Add/Remove parameter version.
- Remove parameter.
short_description: Access and Update Google Cloud Parameter Manager objects
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 3.7
- requests >= 2.32.3
- google-auth >= 2.39.0
options:
project:
description:
- The Google Cloud Platform project to use. Defaults to OS env variable
GCP_PROJECT if not present
type: str
auth_kind:
description:
- The type of credential used.
type: str
required: true
choices:
- application
- machineaccount
- serviceaccount
- accesstoken
service_account_contents:
description:
- The contents of a Service Account JSON file, either in a dictionary or as a
JSON string that represents it.
type: jsonarg
service_account_file:
description:
- The path of a Service Account JSON file if serviceaccount is selected as type.
type: path
service_account_email:
description:
- An optional service account email address if machineaccount is selected and
the user does not wish to use the default email.
type: str
access_token:
description:
- An OAuth2 access token if credential type is accesstoken.
type: str
scopes:
description:
- Array of scopes to be used
type: list
elements: str
env_type:
description:
- 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.
type: str
name:
description:
- Name of the parameter to be used
type: str
required: true
aliases:
- key
- parameter
- parameter_id
format:
description:
- Format of the parameter to be used.
type: str
default: UNFORMATTED
choices:
- UNFORMATTED
- JSON
- YAML
location:
description:
- Location of the parameter to be used
type: str
default: global
version:
description:
- Name of the parameter to be used
type: str
required: false
aliases:
- version_id
- parameter_version_id
value:
description:
- The parameter value that the parameter should have
- this will be set upon create
- If the parameter value is not this, a new version will be added with this value
type: str
state:
description:
- whether the parameter should exist
default: present
choices:
- absent
- present
type: str
return_value:
description:
- if true, the value of the parameter will be returned unencrypted to Ansible
- if false, no value will be returned or decrypted
type: bool
default: true
labels:
description:
- A set of key-value pairs to assign as labels to a parameter
- only used in creation
- Note that the "value" piece of a label must contain only readable chars
type: dict
default: {}
'''
EXAMPLES = '''
- name: Create a new parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new parameter with version
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new structured parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Create a structured parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Ensure the parameter exists, fail otherwise and return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
- name: Ensure parameter exists but don't return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
return_value: false
- name: Add a new version of a parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: updated super parameter
state: present
- name: Delete version 1 of a parameter (but not the parameter itself)
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
state: absent
- name: Delete parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: absent
- name: Create a new regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new regional parameter with version
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new structured regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a regional parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Create a structured regional parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Ensure the regional parameter exists, fail otherwise and return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
- name: Ensure regional parameter exists but don't return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
return_value: false
- name: Add a new version of a regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: updated super parameter
state: present
- name: Delete version 1 of a regional parameter (but not the regional parameter itself)
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
state: absent
- name: Delete parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: absent
'''
RETURN = '''
resources:
description: List of resources
returned: always
type: complex
contains:
name:
description:
- The name of the parameter
returned: success
type: str
location:
description:
- The location of the regional parameter
returned: success
type: str
version:
description:
- the version of the parameter returned
returned: success
type: str
url:
description:
- the Google Cloud URL used to make the request
returned: success
type: str
status_code:
description:
- the HTTP status code of the response to Google Cloud
returned: success
type: str
msg:
description:
- A message indicating what was done (or not done)
returned: success, failure
type: str
value:
description:
- The decrypted parameter data value, please use care with this
returned: success
type: str
payload:
description:
- The base 64 parameter payload
returned: success
type: dict
'''
################################################################################
# Imports
################################################################################
from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import (
navigate_hash,
GcpSession,
GcpModule
)
# for decoding and validating parameters
import json
import base64
def get_auth(module):
return GcpSession(module, 'parameter-manager')
def make_url_prefix(module):
if module.params.get('location') is not None and module.params.get('location') != 'global':
return "https://parametermanager.{location}.rep.googleapis.com/v1/projects/{project}/locations/{location}/"
return "https://parametermanager.googleapis.com/v1/projects/{project}/locations/global/"
def self_parameter_link(module):
return (make_url_prefix(module) + "parameters/{name}").format(**module.params)
def self_parameter_version_link(module):
return (make_url_prefix(module) + "parameters/{name}/versions/{version}").format(**module.params)
def self_parameter_list_link(module):
return (make_url_prefix(module) + "parameters").format(**module.params)
def self_parameter_version_list_link(module):
return (make_url_prefix(module) + "parameters/{name}/versions").format(**module.params)
def check_parameter_exist(module, allow_not_found=True):
auth = get_auth(module)
param_list = list_parameters(module)
if param_list is None:
return None
link = self_parameter_link(module)
access_obj = return_if_object(module, auth.get(link), allow_not_found)
if access_obj is None:
return None
return access_obj
def check_parameter_version_exist(module, allow_not_found=True):
auth = get_auth(module)
version_list = list_parameter_versions(module)
if version_list is None:
return None
link = self_parameter_version_link(module)
access_obj = return_if_object(module, auth.get(link), allow_not_found)
if access_obj is None:
return None
return access_obj
def create_parameter(module):
# build the payload
payload = dict()
if module.params.get('format'):
payload['format'] = module.params.get('format')
if module.params.get('labels'):
payload['labels'] = module.params.get('labels')
url = (make_url_prefix(module) + "parameters?parameter_id={name}").format(**module.params)
auth = get_auth(module)
# validate create
return return_if_object(module, auth.post(url, payload), False)
def create_parameter_version(module):
# build the payload
b64_value = base64.b64encode(module.params.get('value').encode("utf-8")).decode("utf-8")
payload = {
u'payload': {
u'data': b64_value
}
}
auth = get_auth(module)
url = (make_url_prefix(module) + "parameters/{name}/versions?parameter_version_id={version}").format(**module.params)
# validate create
return return_if_object(module, auth.post(url, payload), False)
def list_parameters(module):
url = self_parameter_list_link(module)
auth = get_auth(module)
return return_if_object(module, auth.get(url), True)
def list_parameter_versions(module):
# filter by only enabled parameter version
url = self_parameter_version_list_link(module)
auth = get_auth(module)
return return_if_object(module, auth.get(url), True)
def delete_parameter(module):
auth = get_auth(module)
url = self_parameter_link(module)
return return_if_object(module, auth.delete(url), True)
def delete_parameter_version(module):
auth = get_auth(module)
url = self_parameter_version_link(module)
return return_if_object(module, auth.delete(url), True)
def return_if_object(module, response, allow_not_found=False):
# If not found, return nothing.
if allow_not_found and response.status_code == 404:
return None
if response.status_code == 409:
module.params['info'] = "exists already"
return None
# probably a code error
if response.status_code == 400:
module.fail_json(msg="unexpected REST failure: %s" % response.json()['error'])
# If no content, return nothing.
if response.status_code == 204:
return None
try:
module.raise_for_status(response)
result = response.json()
result['url'] = response.request.url
result['status_code'] = response.status_code
if "name" in result:
result['location'] = result['name'].split("/")[3]
result['name'] = result['name'].split("/")[5]
if len(result['name'].split("/")) == 8:
result['version'] = result['name'].split("/")[-1]
# base64 decode the value
if "payload" in result and "data" in result['payload']:
result['value'] = base64.b64decode(result['payload']['data']).decode("utf-8")
except getattr(json.decoder, 'JSONDecodeError', ValueError):
module.fail_json(msg="Invalid JSON response with error: %s" % response.text)
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
return result
def main():
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str', aliases=['key', 'parameter', 'parameter_id']),
version=dict(required=False, type='str', aliases=['version_id', 'parameter_version_id']),
location=dict(required=False, type='str', default='global'),
value=dict(required=False, type='str'),
format=dict(required=False, type='str', default='UNFORMATTED', choices=['UNFORMATTED', 'JSON', 'YAML']),
return_value=dict(required=False, type='bool', default=True),
labels=dict(required=False, type='dict', default=dict())
)
)
try :
if module.params.get('scopes') is None:
module.params['scopes'] = ["https://www.googleapis.com/auth/cloud-platform"]
if module.params.get('project') is None:
module.fail_json(msg="The project is required. Please specify the Google Cloud project to use.")
state = module.params.get('state')
changed = False
fetch = check_parameter_exist(module, allow_not_found=True)
fetch_version = None
if fetch:
fetch_version = check_parameter_version_exist(module, allow_not_found=True)
if state == 'present':
# if parameter not exist
if not fetch:
# doesn't exist, must create
if module.params.get('version') and module.params.get('value'):
# create a new parameter
fetch = create_parameter(module)
fetch = create_parameter_version(module)
changed = True
# specified present and verison is provided but value is not provided
elif module.params.get('version') and module.params.get('value') is None:
module.fail_json(
msg="parameter '{name}' not present in '{project}' and no value for the parameter version is provided".format(**module.params)
)
# specified present and verison is not provided
# that no parameter could be created without a version
elif module.params.get('value'):
module.fail_json(msg="parameter '{name}' not present in '{project}' and no version for the parameter is provided".format(**module.params))
# specified present but no value
# that no parameter version could be created without a value to encrypt
else:
fetch = create_parameter(module)
changed = True
elif not fetch_version:
# doesn't exist, must create
if module.params.get('version') and module.params.get('value'):
fetch = create_parameter_version(module)
changed = True
# specified present and verison is provided but value is not provided
elif module.params.get('version') and module.params.get('value') is None:
module.fail_json(msg="parameter '{name}' present in '{project}' and no value for the parameter version is provided".format(**module.params))
# specified present and verison is not provided
# that no parameter could be created without a version
elif module.params.get('value'):
module.fail_json(msg="parameter '{name}' present in '{project}' and no version for the parameter is provided".format(**module.params))
# specified present but no value
# that no parameter could be created without a value to encrypt
else:
module.fail_json(
msg="parameter '{name}' present in '{project}' and no value and version for the parameter is provided".format(**module.params)
)
else:
# parameter and parameter version both exist
# check if the value is the same
# if not, delete the version and create new one
# if the value is the same, do nothing
if "value" in fetch_version and module.params.get('value', '') is not None:
if fetch_version['value'] != module.params.get('value'):
fetch['msg'] = 'values not identical, but parameter version name is same'
# Delete existing version and create new one
fetch = delete_parameter_version(module)
fetch = create_parameter_version(module)
changed = True
else:
module.exit_json(msg="parameter '{name}' is already exist and value is the same".format(**module.params))
elif module.params.get('value', '') is None:
module.fail_json(msg="parameter '{name}' present in '{project}' and no value for the parameter version is provided".format(**module.params))
else:
if fetch is None:
fetch = {}
module.exit_json(msg="parameter {name} is not exist".format(**module.params))
if fetch_version is None and module.params.get('version'):
fetch = {}
module.exit_json(msg="parameter version {version} is not exist".format(**module.params))
if module.params.get('version'):
version = delete_parameter_version(module)
if version is not None:
fetch = version
changed = True
else:
module.exit_json(msg="parameter version {version} is already deleted".format(**module.params))
else:
versions = list_parameter_versions(module)
if versions is not None:
version = versions.get('parameterVersions', None)
if version is None:
param = delete_parameter(module)
if param is not None:
changed = True
fetch = param
else:
module.exit_json(msg="parameter {name} is already deleted".format(**module.params))
else:
module.fail_json(msg="parameter {name} has nested version resources".format(**module.params))
else:
module.exit_json(msg="parameter {name} is not exist".format(**module.params))
# # pop value data if return_value == false
if module.params.get('return_value') is False:
if "value" in fetch:
fetch.pop('value')
if "payload" in fetch:
fetch.pop('payload')
if "msg" in fetch:
fetch['msg'] = "{} | not returning parameter value since 'return_value' is set to false".format(fetch['msg'])
else:
fetch['msg'] = "not returning parameter value since 'return_value' is set to false"
fetch['changed'] = changed
fetch['name'] = module.params.get('name')
except Exception as e:
module.fail_json(msg=f"An unexpected error occurred: {str(e)}")
module.exit_json(**fetch)
if __name__ == "__main__":
main()

View file

@ -93,7 +93,7 @@ options:
max_duration:
description:
- Subscription writes a new output file if the specified value of max duration is exceeded. Min 60s, max 600s.
required: true
required: false
type: str
max_bytes:
description:
@ -108,7 +108,7 @@ options:
output_format:
description:
- Specify the format of the output files that are to be stored in a Cloud Storage bucket as text or avro.
required: true
required: false
type: str
write_metadata:
description:
@ -654,7 +654,9 @@ def main():
push_config=dict(
type='dict',
options=dict(
oidc_token=dict(type='dict', options=dict(service_account_email=dict(required=True, type='str'), audience=dict(type='str'))),
oidc_token=dict(type='dict',
no_log=False,
options=dict(service_account_email=dict(required=True, type='str'), audience=dict(type='str'))),
push_endpoint=dict(required=True, type='str'),
attributes=dict(type='dict'),
),

View file

@ -333,7 +333,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']

View file

@ -180,7 +180,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']

View file

@ -60,7 +60,6 @@ options:
to "true" AUTH is enabled on the instance.
- Default value is "false" meaning AUTH is disabled.
required: false
default: 'false'
type: bool
authorized_network:
description:

View file

@ -291,7 +291,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(region=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(region=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -86,7 +86,7 @@ options:
description:
- Indicates the number of projects that should be returned by the API
request
type: str
type: int
notes:
- for authentication, you can set service_account_file using the C(GCP_SERVICE_ACCOUNT_FILE)
env variable.
@ -190,7 +190,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(
page_size=dict(type='int')
))
), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']

View file

@ -135,7 +135,7 @@ import json
def main():
module = GcpModule(argument_spec=dict())
module = GcpModule(argument_spec=dict(), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloudruntimeconfig']

View file

@ -151,7 +151,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(config=dict(required=True, type='str')))
module = GcpModule(argument_spec=dict(config=dict(required=True, type='str')), supports_check_mode=True)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloudruntimeconfig']

View file

@ -1,4 +1,5 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt
# or https://www.gnu.org/licenses/gpl-3.0.txt)
@ -24,8 +25,9 @@ description:
- Create new secret values.
- Add/remove versions of secrets.
- Please note that other features like etags, replication, annontation expected to be managed outside of Ansible.
- Deals with regional secrets if location option is defined.
short_description: Access and Update Google Cloud Secrets Manager objects
author: Dave Costakos @RedHat
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
@ -44,6 +46,7 @@ options:
- application
- machineaccount
- serviceaccount
- accesstoken
service_account_contents:
description:
- The contents of a Service Account JSON file, either in a dictionary or as a
@ -58,11 +61,21 @@ options:
- An optional service account email address if machineaccount is selected and
the user does not wish to use the default email.
type: str
access_token:
description:
- An OAuth2 access token if credential type is accesstoken.
type: str
scopes:
description:
- Array of scopes to be used
type: list
elements: str
env_type:
description:
- 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.
type: str
name:
description:
- Name of the secret to be used
@ -72,6 +85,10 @@ options:
- key
- secret
- secret_id
location:
description:
- If provided, it defines the location of the regional secret.
type: str
value:
description:
- The secret value that the secret should have
@ -105,6 +122,7 @@ options:
- only used in creation
- Note that the "value" piece of a label must contain only readable chars
type: dict
default: {}
notes:
- 'API Reference: U(https://cloud.google.com/secret-manager/docs/reference/rests)'
- 'Official Documentation: U(https://cloud.google.com/secret-manager/docs/overview)'
@ -120,7 +138,7 @@ notes:
- The I(service_account_email) and I(service_account_file) options are mutually exclusive.
'''
EXAMPLES = r'''
EXAMPLES = '''
- name: Create a new secret
google.cloud.gcp_secret_manager:
name: secret_key
@ -164,48 +182,105 @@ EXAMPLES = r'''
value: super_secret
labels:
key_name: "ansible_rox"
- name: Create a new regional secret
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
value: super_secret
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Ensure the regional secret exists, fail otherwise and return the value
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
state: present
- name: Ensure regional secret exists but don't return the value
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
state: present
return_value: false
- name: Add a new version of a regional secret
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
value: updated super secret
state: present
- name: Delete version 1 of a regional secret (but not the secret itself)
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
version: 1
state: absent
- name: Delete all versions of a regional secret
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
version: all
state: absent
- name: Create a regional secret with labels
google.cloud.gcp_secret_manager:
name: secret_key
location: us-central1
value: super_secret
labels:
key_name: "ansible_rox"
'''
RETURN = r'''
RETURN = '''
resources:
description: List of resources
returned: always
type: complex
name:
description:
- The name of the secret
returned: success
type: str
version:
description:
- the version number of the secret returned
returned: success
type: str
url:
description:
- the Google Cloud URL used to make the request
returned: success
type: str
status_code:
description:
- the HTTP status code of the response to Google Cloud
returned: success
type: str
msg:
description:
- A message indicating what was done (or not done)
returned: success, failure
type: str
value:
description:
- The decrypted secret value, please use care with this
returned: success
type: str
payload:
description:
- The base 64 secret payload including CRC for validation
retunred: success
type: dict
contains:
name:
description:
- The name of the secret
returned: success
type: str
location:
description:
- The location of the regional secret.
returned: success
type: str
version:
description:
- The version number of the secret returned
returned: success
type: str
url:
description:
- The Google Cloud URL used to make the request
returned: success
type: str
status_code:
description:
- The HTTP status code of the response to Google Cloud
returned: success
type: str
msg:
description:
- A message indicating what was done (or not done)
returned: success, failure
type: str
value:
description:
- The decrypted secret value, please use care with this
returned: success
type: str
payload:
description:
- The base 64 secret payload including CRC for validation
returned: success
type: dict
'''
################################################################################
@ -228,24 +303,30 @@ def get_auth(module):
return GcpSession(module, 'secret-manager')
def make_url_prefix(module):
if module.params['location']:
return "https://secretmanager.{location}.rep.googleapis.com/v1/projects/{project}/locations/{location}/"
return "https://secretmanager.googleapis.com/v1/projects/{project}/"
def self_access_link(module):
return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}:access".format(**module.params)
return (make_url_prefix(module) + "secrets/{name}/versions/{calc_version}:access").format(**module.params)
def self_get_link(module):
return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}".format(**module.params)
return (make_url_prefix(module) + "secrets/{name}/versions/{calc_version}").format(**module.params)
def self_update_link(module):
return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version:version}".format(**module.params)
return (make_url_prefix(module) + "secrets/{name}/versions/{calc_version:version}").format(**module.params)
def self_list_link(module):
return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions?filter=state:ENABLED".format(**module.params)
return (make_url_prefix(module) + "secrets/{name}/versions?filter=state:ENABLED").format(**module.params)
def self_delete_link(module):
return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}".format(**module.params)
return (make_url_prefix(module) + "secrets/{name}").format(**module.params)
def fetch_resource(module, allow_not_found=True):
@ -294,10 +375,12 @@ def merge_dicts(x, y):
def create_secret(module):
# build the payload
payload = {"replication": {"automatic": {}}}
if module.params['location']:
payload = dict()
if module.params['labels']:
payload['labels'] = module.params['labels']
url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets".format(**module.params)
url = (make_url_prefix(module) + "secrets").format(**module.params)
auth = get_auth(module)
post_response = auth.post(url, body=payload, params={'secretId': module.params['name']})
# validate create
@ -314,7 +397,7 @@ def update_secret(module):
}
}
auth = get_auth(module)
url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}:addVersion".format(**module.params)
url = (make_url_prefix(module) + "secrets/{name}:addVersion").format(**module.params)
return return_if_object(module, auth.post(url, payload), False)
@ -363,7 +446,11 @@ def return_if_object(module, response, allow_not_found=False):
result['status_code'] = response.status_code
if "name" in result:
result['version'] = result['name'].split("/")[-1]
result['name'] = result['name'].split("/")[3]
if 'locations' in result['name'].split("/"):
result['location'] = result['name'].split("/")[3]
result['name'] = result['name'].split("/")[5]
else:
result['name'] = result['name'].split("/")[3]
# base64 decode the value
if "payload" in result and "data" in result['payload']:
@ -388,6 +475,7 @@ def main():
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str', aliases=['key', 'secret', 'secret_id']),
location=dict(required=False, type='str'),
value=dict(required=False, type='str'),
version=dict(required=False, type='str', default='latest'),
return_value=dict(required=False, type='bool', default=True),

View file

@ -103,6 +103,8 @@ options:
type: str
notes:
- 'Getting Started: U(https://cloud.google.com/service-usage/docs/getting-started)'
- For this module to work, the serviceusage.googleapis.com service must be enabled
U(https://cloud.google.com/service-usage/docs/enable-disable#gcloud) already.
- for authentication, you can set service_account_file using the C(GCP_SERVICE_ACCOUNT_FILE)
env variable.
- for authentication, you can set service_account_contents using the C(GCP_SERVICE_ACCOUNT_CONTENTS)

Some files were not shown because too many files have changed in this diff Show more