mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-23 03:11:22 -07:00
Add source snapshot to ansible (#300)
* Make `iap` field computed (#3814) (#272) Signed-off-by: Modular Magician <magic-modules@google.com> * add source_image and source_snapshot to google_compute_image (#3799) (#273) * add source_image to google_compute_image * add source_snapshot to google_compute_image * PR comment changes Signed-off-by: Modular Magician <magic-modules@google.com> * Collection fixes for release (#3831) (#274) Signed-off-by: Modular Magician <magic-modules@google.com> * Add new field filter to pubsub. (#3759) (#275) * Add new field filter to pubsub. Fixes: https://github.com/terraform-providers/terraform-provider-google/issues/6727 * Fixed filter name, it was improperly set. * add filter key to pubsub subscription unit test * spaces not tabs! * hardcode filter value in test * revert remove escaped quotes Co-authored-by: Tim O'Connell <hi@timoconnell.co.uk> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Tim O'Connell <hi@timoconnell.co.uk> * Add archive class to gcs (#3867) (#276) Signed-off-by: Modular Magician <magic-modules@google.com> * Add support for gRPC healthchecks (#3825) (#277) Signed-off-by: Modular Magician <magic-modules@google.com> * Add enableMessageOrdering to Pub/Sub Subscription (#3872) (#278) Add enableMessageOrdering to Pub/Sub Subscription Signed-off-by: Modular Magician <magic-modules@google.com> * use {product}.googleapis.com endpoints (#3755) (#279) * use {product}.googleapis.com endpoints * use actual correct urls * fix zone data source test * fix network peering tests * possibly fix deleting default network Signed-off-by: Modular Magician <magic-modules@google.com> * Removed instances where input and output are both true (#3890) (#280) * [provider-yaml] - Removed instances where input and output are both true * modified to only supply output. Following pattern from bigquerydatatransfer Co-authored-by: Scott Suarez <scottsuarez@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Scott Suarez <scottsuarez@google.com> * retrypolicy attribute added (#3843) (#281) * retrypolicy attribute added * test case updated Signed-off-by: Modular Magician <magic-modules@google.com> * Advanced logging config options in google_compute_subnetwork (#3603) (#282) Co-authored-by: Dana Hoffman <danahoffman@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Dana Hoffman <danahoffman@google.com> * Add Erase Windows VSS support to compute disk (#3898) (#283) Co-authored-by: Cameron Thornton <camthornton@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Cameron Thornton <camthornton@google.com> * Add Snapshot location to compute snapshot (#3896) (#286) * added storage locations * add storage locations to field * tweak cmek logic * fix the decoder logic and cleanup whitespaces * remove duplicate entry Signed-off-by: Modular Magician <magic-modules@google.com> * Added missing 'all' option for protocol firewall rule (#3962) (#287) Signed-off-by: Modular Magician <magic-modules@google.com> * Added support GRPC for google_compute_(region)_backend_service.protocol (#3973) (#289) Co-authored-by: Edward Sun <sunedward@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Edward Sun <sunedward@google.com> * Add schema update support to spanner db 2082 (#3947) (#291) * eoncders and customdiff added for spanner DB ddl update * config update test case added * customdiff modified to handle out-of-index issue * new lines added * indent fixed * indent fixed for tests * test added for ddl update condition * mock added Terraformresourcediff, unit tests added * test fixed * more unit tests added * tests fixed * PR comments implemented * unit tests converted to table driven tests * ImportStateVerifyIgnore flag added to tests * syntax corrected in test Signed-off-by: Modular Magician <magic-modules@google.com> * Added properties of options & artifacts on google_cloudbuild_trigger (#3944) (#292) * added options & artifacts to cloudbuild trigger * updated with minor changes and added more options in test * a test adding update behavior for multiple optional fields Co-authored-by: Edward Sun <sunedward@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Edward Sun <sunedward@google.com> * Enable TPUs to use Shared VPC (#3939) (#293) * add support for shared vpc * make cidr_block computable * add diffsuppression * tweak diffsupression to ignore when network has a change * rework diffsupress * add customizediff * switch the diff checks Signed-off-by: Modular Magician <magic-modules@google.com> * Add SEV_CAPABLE option to google_compute_image (#3994) (#294) Signed-off-by: Modular Magician <magic-modules@google.com> * Update docs for pubsub targets in cloud scheduler (#4008) (#295) Signed-off-by: Modular Magician <magic-modules@google.com> * Make RegionBackendService health checks optional (#4053) (#297) Signed-off-by: Modular Magician <magic-modules@google.com> * Update terminology for IAM roles (#4056) (#299) Roles like "Owner" and "Editor" are now called "basic roles": https://cloud.google.com/iam/docs/understand Signed-off-by: Modular Magician <magic-modules@google.com> * Add source snapshot to ansible (#4060) Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Tim O'Connell <hi@timoconnell.co.uk> Co-authored-by: Scott Suarez <scottsuarez@google.com> Co-authored-by: Dana Hoffman <danahoffman@google.com> Co-authored-by: Cameron Thornton <camthornton@google.com> Co-authored-by: Edward Sun <sunedward@google.com>
This commit is contained in:
parent
fb1485be7b
commit
7fa00db18c
169 changed files with 2105 additions and 764 deletions
|
@ -43,7 +43,6 @@ description:
|
|||
- Add a persistent disk to your instance when you need reliable and affordable storage
|
||||
with consistent performance characteristics.
|
||||
short_description: Creates a GCP Disk
|
||||
version_added: '2.6'
|
||||
author: Google Inc. (@googlecloudplatform)
|
||||
requirements:
|
||||
- python >= 2.6
|
||||
|
@ -69,7 +68,6 @@ options:
|
|||
- Labels to apply to this disk. A list of key->value pairs.
|
||||
required: false
|
||||
type: dict
|
||||
version_added: '2.7'
|
||||
licenses:
|
||||
description:
|
||||
- Any applicable publicly visible licenses.
|
||||
|
@ -105,22 +103,20 @@ options:
|
|||
values for the caller's project.
|
||||
required: false
|
||||
type: int
|
||||
version_added: '2.8'
|
||||
type:
|
||||
description:
|
||||
- URL of the disk type resource describing which disk type to use to create the
|
||||
disk. Provide this when creating the disk.
|
||||
required: false
|
||||
type: str
|
||||
version_added: '2.7'
|
||||
source_image:
|
||||
description:
|
||||
- The source image used to create this disk. If the source image is deleted, this
|
||||
field will not be set.
|
||||
- 'To create a disk with one of the public operating system images, specify the
|
||||
image by its family name. For example, specify family/debian-8 to use the latest
|
||||
Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively,
|
||||
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD
|
||||
image by its family name. For example, specify family/debian-9 to use the latest
|
||||
Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively,
|
||||
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-vYYYYMMDD
|
||||
To create a disk with a private image that you created, specify the image name
|
||||
in the following format: global/images/my-private-image You can also specify
|
||||
a private image by its image family, which returns the latest version of the
|
||||
|
@ -151,6 +147,12 @@ options:
|
|||
- The name of the encryption key that is stored in Google Cloud KMS.
|
||||
required: false
|
||||
type: str
|
||||
kms_key_service_account:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
- If absent, the Compute Engine Service Agent service account is used.
|
||||
required: false
|
||||
type: str
|
||||
disk_encryption_key:
|
||||
description:
|
||||
- Encrypts the disk using a customer-supplied encryption key.
|
||||
|
@ -177,6 +179,12 @@ options:
|
|||
must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
|
||||
required: false
|
||||
type: str
|
||||
kms_key_service_account:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
- If absent, the Compute Engine Service Agent service account is used.
|
||||
required: false
|
||||
type: str
|
||||
source_snapshot:
|
||||
description:
|
||||
- The source snapshot used to create this disk. You can provide this as a partial
|
||||
|
@ -206,6 +214,12 @@ options:
|
|||
- The name of the encryption key that is stored in Google Cloud KMS.
|
||||
required: false
|
||||
type: str
|
||||
kms_key_service_account:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
If absent, the Compute Engine Service Agent service account is used.
|
||||
required: false
|
||||
type: str
|
||||
project:
|
||||
description:
|
||||
- The Google Cloud Platform project to use.
|
||||
|
@ -237,6 +251,7 @@ options:
|
|||
description:
|
||||
- Array of scopes to be used
|
||||
type: list
|
||||
elements: str
|
||||
env_type:
|
||||
description:
|
||||
- Specifies which Ansible environment you're running this module within.
|
||||
|
@ -361,9 +376,9 @@ sourceImage:
|
|||
- The source image used to create this disk. If the source image is deleted, this
|
||||
field will not be set.
|
||||
- 'To create a disk with one of the public operating system images, specify the
|
||||
image by its family name. For example, specify family/debian-8 to use the latest
|
||||
Debian 8 image: projects/debian-cloud/global/images/family/debian-8 Alternatively,
|
||||
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-8-jessie-vYYYYMMDD
|
||||
image by its family name. For example, specify family/debian-9 to use the latest
|
||||
Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively,
|
||||
use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-vYYYYMMDD
|
||||
To create a disk with a private image that you created, specify the image name
|
||||
in the following format: global/images/my-private-image You can also specify a
|
||||
private image by its image family, which returns the latest version of the image
|
||||
|
@ -400,6 +415,12 @@ sourceImageEncryptionKey:
|
|||
- The name of the encryption key that is stored in Google Cloud KMS.
|
||||
returned: success
|
||||
type: str
|
||||
kmsKeyServiceAccount:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
- If absent, the Compute Engine Service Agent service account is used.
|
||||
returned: success
|
||||
type: str
|
||||
sourceImageId:
|
||||
description:
|
||||
- The ID value of the image used to create this disk. This value identifies the
|
||||
|
@ -441,6 +462,12 @@ diskEncryptionKey:
|
|||
must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
|
||||
returned: success
|
||||
type: str
|
||||
kmsKeyServiceAccount:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
- If absent, the Compute Engine Service Agent service account is used.
|
||||
returned: success
|
||||
type: str
|
||||
sourceSnapshot:
|
||||
description:
|
||||
- The source snapshot used to create this disk. You can provide this as a partial
|
||||
|
@ -471,6 +498,12 @@ sourceSnapshotEncryptionKey:
|
|||
key that protects this resource.
|
||||
returned: success
|
||||
type: str
|
||||
kmsKeyServiceAccount:
|
||||
description:
|
||||
- The service account used for the encryption request for the given KMS key.
|
||||
If absent, the Compute Engine Service Agent service account is used.
|
||||
returned: success
|
||||
type: str
|
||||
sourceSnapshotId:
|
||||
description:
|
||||
- The unique ID of the snapshot used to create this disk. This value identifies
|
||||
|
@ -518,10 +551,16 @@ def main():
|
|||
type=dict(type='str'),
|
||||
source_image=dict(type='str'),
|
||||
zone=dict(required=True, type='str'),
|
||||
source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
|
||||
disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
|
||||
source_image_encryption_key=dict(
|
||||
type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
|
||||
),
|
||||
disk_encryption_key=dict(
|
||||
type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
|
||||
),
|
||||
source_snapshot=dict(type='dict'),
|
||||
source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))),
|
||||
source_snapshot_encryption_key=dict(
|
||||
type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'), kms_key_service_account=dict(type='str'))
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -576,7 +615,7 @@ def update_fields(module, request, response):
|
|||
def label_fingerprint_update(module, request, response):
|
||||
auth = GcpSession(module, 'compute')
|
||||
auth.post(
|
||||
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/setLabels"]).format(**module.params),
|
||||
''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/setLabels"]).format(**module.params),
|
||||
{u'labelFingerprint': response.get('labelFingerprint'), u'labels': module.params.get('labels')},
|
||||
)
|
||||
|
||||
|
@ -584,7 +623,7 @@ def label_fingerprint_update(module, request, response):
|
|||
def size_gb_update(module, request, response):
|
||||
auth = GcpSession(module, 'compute')
|
||||
auth.post(
|
||||
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params),
|
||||
''.join(["https://compute.googleapis.com/compute/v1/", "projects/{project}/zones/{zone}/disks/{name}/resize"]).format(**module.params),
|
||||
{u'sizeGb': module.params.get('size_gb')},
|
||||
)
|
||||
|
||||
|
@ -599,6 +638,7 @@ def resource_to_request(module):
|
|||
u'kind': 'compute#disk',
|
||||
u'sourceImageEncryptionKey': DiskSourceimageencryptionkey(module.params.get('source_image_encryption_key', {}), module).to_request(),
|
||||
u'diskEncryptionKey': DiskDiskencryptionkey(module.params.get('disk_encryption_key', {}), module).to_request(),
|
||||
u'sourceSnapshot': replace_resource_dict(module.params.get(u'source_snapshot', {}), 'selfLink'),
|
||||
u'sourceSnapshotEncryptionKey': DiskSourcesnapshotencryptionkey(module.params.get('source_snapshot_encryption_key', {}), module).to_request(),
|
||||
u'description': module.params.get('description'),
|
||||
u'labels': module.params.get('labels'),
|
||||
|
@ -623,11 +663,11 @@ def fetch_resource(module, link, kind, allow_not_found=True):
|
|||
|
||||
|
||||
def self_link(module):
|
||||
return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{name}".format(**module.params)
|
||||
return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{name}".format(**module.params)
|
||||
|
||||
|
||||
def collection(module):
|
||||
return "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params)
|
||||
return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks".format(**module.params)
|
||||
|
||||
|
||||
def return_if_object(module, response, kind, allow_not_found=False):
|
||||
|
@ -693,16 +733,16 @@ def response_to_hash(module, response):
|
|||
def disk_type_selflink(name, params):
|
||||
if name is None:
|
||||
return
|
||||
url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*"
|
||||
url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/diskTypes/.*"
|
||||
if not re.match(url, name):
|
||||
name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name
|
||||
name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name
|
||||
return name
|
||||
|
||||
|
||||
def async_op_url(module, extra_data=None):
|
||||
if extra_data is None:
|
||||
extra_data = {}
|
||||
url = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}"
|
||||
url = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/operations/{op_id}"
|
||||
combined = extra_data.copy()
|
||||
combined.update(module.params)
|
||||
return url.format(**combined)
|
||||
|
@ -743,10 +783,22 @@ class DiskSourceimageencryptionkey(object):
|
|||
self.request = {}
|
||||
|
||||
def to_request(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get('raw_key'),
|
||||
u'kmsKeyName': self.request.get('kms_key_name'),
|
||||
u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'),
|
||||
}
|
||||
)
|
||||
|
||||
def from_response(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get(u'rawKey'),
|
||||
u'kmsKeyName': self.request.get(u'kmsKeyName'),
|
||||
u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class DiskDiskencryptionkey(object):
|
||||
|
@ -758,10 +810,22 @@ class DiskDiskencryptionkey(object):
|
|||
self.request = {}
|
||||
|
||||
def to_request(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get('raw_key'),
|
||||
u'kmsKeyName': self.request.get('kms_key_name'),
|
||||
u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'),
|
||||
}
|
||||
)
|
||||
|
||||
def from_response(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get(u'rawKey'),
|
||||
u'kmsKeyName': self.request.get(u'kmsKeyName'),
|
||||
u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class DiskSourcesnapshotencryptionkey(object):
|
||||
|
@ -773,10 +837,22 @@ class DiskSourcesnapshotencryptionkey(object):
|
|||
self.request = {}
|
||||
|
||||
def to_request(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get('raw_key'), u'kmsKeyName': self.request.get('kms_key_name')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get('raw_key'),
|
||||
u'kmsKeyName': self.request.get('kms_key_name'),
|
||||
u'kmsKeyServiceAccount': self.request.get('kms_key_service_account'),
|
||||
}
|
||||
)
|
||||
|
||||
def from_response(self):
|
||||
return remove_nones_from_dict({u'rawKey': self.request.get(u'rawKey'), u'kmsKeyName': self.request.get(u'kmsKeyName')})
|
||||
return remove_nones_from_dict(
|
||||
{
|
||||
u'rawKey': self.request.get(u'rawKey'),
|
||||
u'kmsKeyName': self.request.get(u'kmsKeyName'),
|
||||
u'kmsKeyServiceAccount': self.request.get(u'kmsKeyServiceAccount'),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue