diff --git a/tests/e2e/normalize.go b/tests/e2e/normalize.go index 5596caa923..8fc6fbcfd6 100644 --- a/tests/e2e/normalize.go +++ b/tests/e2e/normalize.go @@ -79,6 +79,10 @@ func normalizeKRMObject(t *testing.T, u *unstructured.Unstructured, project test visitor.replacePaths[".status.ipAddress"] = "10.1.2.3" visitor.replacePaths[".status.outboundPublicIpAddresses"] = []string{"6.6.6.6", "8.8.8.8"} + // Specific to CloudKMS + visitor.replacePaths[".primary.createTime"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".primary.generateTime"] = "2024-04-01T12:34:56.123456Z" + // Specific to BigQuery visitor.replacePaths[".spec.access[].userByEmail"] = "user@google.com" diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export5.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export5.yaml new file mode 100644 index 0000000000..1c7dca0cbd --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export5.yaml @@ -0,0 +1,26 @@ +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + annotations: + cnrm.cloud.google.com/delete-contents-on-destroy: "false" + labels: + managed-by-cnrm: "true" + name: bigquerydataset${uniqueId} +spec: + access: + - role: OWNER + specialGroup: projectOwners + defaultCollation: und:ci + defaultEncryptionConfiguration: + kmsKeyRef: + external: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} + defaultPartitionExpirationMs: 3600000 + defaultTableExpirationMs: 3600000 + description: Fully Configured BigQuery Dataset + friendlyName: bigquerydataset-fullyconfigured + isCaseInsensitive: true + location: US + maxTimeTravelHours: "72" + projectRef: + external: ${projectId} + resourceID: bigquerydataset${uniqueId} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export6.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export6.yaml new file mode 100644 index 0000000000..03f20852e6 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_export6.yaml @@ -0,0 +1,26 @@ +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + annotations: + cnrm.cloud.google.com/delete-contents-on-destroy: "false" + labels: + managed-by-cnrm: "true" + name: bigquerydataset${uniqueId} +spec: + access: + - role: OWNER + specialGroup: projectOwners + defaultCollation: und:ci + defaultEncryptionConfiguration: + kmsKeyRef: + external: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} + defaultPartitionExpirationMs: 3600000 + defaultTableExpirationMs: 3600000 + description: Fully Configured BigQuery Dataset updated + friendlyName: bigquerydataset-fullyconfigured + isCaseInsensitive: true + location: US + maxTimeTravelHours: "72" + projectRef: + external: ${projectId} + resourceID: bigquerydataset${uniqueId} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http00.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http00.log new file mode 100644 index 0000000000..81e981cb59 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http00.log @@ -0,0 +1,88 @@ +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "message": "KeyRing projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId} not found.", + "status": "NOT_FOUND" + } +} + +--- + +POST https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings?alt=json&keyRingId=kmskeyring-${uniqueId} +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}" +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http01.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http01.log new file mode 100644 index 0000000000..1c047f88d3 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http01.log @@ -0,0 +1,150 @@ +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "message": "CryptoKey projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} not found.", + "status": "NOT_FOUND" + } +} + +--- + +POST https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys?alt=json&cryptoKeyId=kmscryptokey-${uniqueId}&skipInitialVersionCreation=false +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labels": { + "key-one": "value-one", + "managed-by-cnrm": "true" + }, + "purpose": "ENCRYPT_DECRYPT" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "destroyScheduledDuration": "2592000s", + "labels": { + "key-one": "value-one", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", + "primary": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "createTime": "2024-04-01T12:34:56.123456Z", + "generateTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", + "protectionLevel": "SOFTWARE", + "state": "ENABLED" + }, + "purpose": "ENCRYPT_DECRYPT", + "versionTemplate": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "protectionLevel": "SOFTWARE" + } +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "destroyScheduledDuration": "2592000s", + "labels": { + "key-one": "value-one", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", + "primary": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "createTime": "2024-04-01T12:34:56.123456Z", + "generateTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", + "protectionLevel": "SOFTWARE", + "state": "ENABLED" + }, + "purpose": "ENCRYPT_DECRYPT", + "versionTemplate": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "protectionLevel": "SOFTWARE" + } +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "destroyScheduledDuration": "2592000s", + "labels": { + "key-one": "value-one", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}", + "primary": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "createTime": "2024-04-01T12:34:56.123456Z", + "generateTime": "2024-04-01T12:34:56.123456Z", + "name": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}/cryptoKeyVersions/1", + "protectionLevel": "SOFTWARE", + "state": "ENABLED" + }, + "purpose": "ENCRYPT_DECRYPT", + "versionTemplate": { + "algorithm": "GOOGLE_SYMMETRIC_ENCRYPTION", + "protectionLevel": "SOFTWARE" + } +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http02.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http02.log new file mode 100644 index 0000000000..0926d4a9fb --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http02.log @@ -0,0 +1,24 @@ +POST https://serviceusage.googleapis.com/v1beta1/projects/${projectId}/services/bigquery.googleapis.com:generateServiceIdentity?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "done": true, + "name": "operations/${operationID}", + "response": { + "@type": "type.googleapis.com/mockgcp.api.serviceusage.v1beta1.ServiceIdentity", + "email": "bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com", + "uniqueId": "12345678" + } +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http03.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http03.log new file mode 100644 index 0000000000..3c659d874c --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http03.log @@ -0,0 +1,110 @@ +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}:getIamPolicy?alt=json&options.requestedPolicyVersion=3&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "etag": "abcdef0123A=" +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}:getIamPolicy?alt=json&options.requestedPolicyVersion=3&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "etag": "abcdef0123A=" +} + +--- + +POST https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}:setIamPolicy?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "policy": { + "bindings": [ + { + "members": [ + "serviceAccount:bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com" + ], + "role": "roles/cloudkms.cryptoKeyEncrypterDecrypter" + } + ], + "version": 3 + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "bindings": [ + { + "members": [ + "serviceAccount:bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com" + ], + "role": "roles/cloudkms.cryptoKeyEncrypterDecrypter" + } + ], + "etag": "abcdef0123A=", + "version": 1 +} + +--- + +GET https://cloudkms.googleapis.com/v1/projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}:getIamPolicy?alt=json&options.requestedPolicyVersion=3&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "bindings": [ + { + "members": [ + "serviceAccount:bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com" + ], + "role": "roles/cloudkms.cryptoKeyEncrypterDecrypter" + } + ], + "etag": "abcdef0123A=", + "version": 1 +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http04.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http04.log new file mode 100644 index 0000000000..b12776ff2d --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http04.log @@ -0,0 +1,159 @@ +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "Unknown service account", + "reason": "notFound" + } + ], + "message": "Unknown service account", + "status": "NOT_FOUND" + } +} + +--- + +POST https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "accountId": "iamsa-${uniqueId}", + "serviceAccount": {} +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http05.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http05.log new file mode 100644 index 0000000000..30fd6eb04c --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http05.log @@ -0,0 +1,259 @@ +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "Not found: Dataset ${projectId}:bigquerydataset${uniqueId}", + "reason": "notFound" + } + ], + "message": "Not found: Dataset ${projectId}:bigquerydataset${uniqueId}", + "status": "NOT_FOUND" + } +} + +--- + +POST https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": 3600000, + "defaultTableExpirationMs": 3600000, + "description": "Fully Configured BigQuery Dataset", + "friendlyName": "bigquerydataset-fullyconfigured", + "isCaseInsensitive": true, + "labels": { + "managed-by-cnrm": "true" + }, + "location": "US", + "maxTimeTravelHours": "72" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http06.log b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http06.log new file mode 100644 index 0000000000..1fdf549fb8 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_http06.log @@ -0,0 +1,227 @@ +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +PUT https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": 3600000, + "defaultTableExpirationMs": 3600000, + "description": "Fully Configured BigQuery Dataset updated", + "friendlyName": "bigquerydataset-fullyconfigured", + "isCaseInsensitive": true, + "labels": { + "managed-by-cnrm": "true" + }, + "location": "US", + "maxTimeTravelHours": "72" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset updated", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset updated", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} + +--- + +GET https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/${datasetID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "access": [ + { + "role": "OWNER", + "specialGroup": "projectOwners" + } + ], + "creationTime": "123456789", + "datasetReference": { + "datasetId": "bigquerydataset${uniqueId}", + "projectId": "${projectId}" + }, + "defaultCollation": "und:ci", + "defaultEncryptionConfiguration": { + "kmsKeyName": "projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId}" + }, + "defaultPartitionExpirationMs": "3600000", + "defaultTableExpirationMs": "3600000", + "description": "Fully Configured BigQuery Dataset updated", + "etag": "abcdef0123A=", + "friendlyName": "bigquerydataset-fullyconfigured", + "id": "000000000000000000000", + "isCaseInsensitive": true, + "kind": "bigquery#dataset", + "labels": { + "managed-by-cnrm": "true" + }, + "lastModifiedTime": "123456789", + "location": "US", + "maxTimeTravelHours": "72", + "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId}", + "type": "DEFAULT" +} \ No newline at end of file diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object00.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object00.yaml new file mode 100644 index 0000000000..e92c4666ac --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object00.yaml @@ -0,0 +1,25 @@ +apiVersion: kms.cnrm.cloud.google.com/v1beta1 +kind: KMSKeyRing +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + name: kmskeyring-${uniqueId} + namespace: ${projectId} +spec: + location: us + resourceID: kmskeyring-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 + selfLink: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId} diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object01.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object01.yaml new file mode 100644 index 0000000000..7656e55580 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object01.yaml @@ -0,0 +1,28 @@ +apiVersion: kms.cnrm.cloud.google.com/v1beta1 +kind: KMSCryptoKey +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + key-one: value-one + name: kmscryptokey-${uniqueId} + namespace: ${projectId} +spec: + keyRingRef: + name: kmskeyring-${uniqueId} + resourceID: kmscryptokey-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 2 + selfLink: projects/${projectId}/locations/us/keyRings/kmskeyring-${uniqueId}/cryptoKeys/kmscryptokey-${uniqueId} diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object02.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object02.yaml new file mode 100644 index 0000000000..f1da818f63 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object02.yaml @@ -0,0 +1,27 @@ +apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 +kind: ServiceIdentity +metadata: + annotations: + cnrm.cloud.google.com/deletion-policy: abandon + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + name: serviceidentity-${uniqueId} + namespace: ${projectId} +spec: + projectRef: + external: ${projectId} + resourceID: bigquery.googleapis.com +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + email: bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com + observedGeneration: 1 diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object03.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object03.yaml new file mode 100644 index 0000000000..74beecaffe --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object03.yaml @@ -0,0 +1,29 @@ +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicy +metadata: + annotations: + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 1 + name: iampolicy-${uniqueId} + namespace: ${projectId} +spec: + bindings: + - members: + - serviceAccount:bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com + role: roles/cloudkms.cryptoKeyEncrypterDecrypter + resourceRef: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSCryptoKey + name: kmscryptokey-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + observedGeneration: 1 diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object04.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object04.yaml new file mode 100644 index 0000000000..daeb8240e0 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object04.yaml @@ -0,0 +1,27 @@ +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMServiceAccount +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + name: iamsa-${uniqueId} + namespace: ${projectId} +spec: + resourceID: iamsa-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + email: iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + member: serviceAccount:iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + name: projects/${projectId}/serviceAccounts/iamsa-${uniqueId}@${projectId}.iam.gserviceaccount.com + observedGeneration: 2 + uniqueId: "12345678" diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object05.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object05.yaml new file mode 100644 index 0000000000..4fe4a90f2a --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object05.yaml @@ -0,0 +1,43 @@ +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + name: bigquerydataset${uniqueId} + namespace: ${projectId} +spec: + access: + - role: OWNER + specialGroup: projectOwners + defaultCollation: und:ci + defaultEncryptionConfiguration: + kmsKeyRef: + name: kmscryptokey-${uniqueId} + defaultPartitionExpirationMs: 3600000 + defaultTableExpirationMs: 3600000 + description: Fully Configured BigQuery Dataset + friendlyName: bigquerydataset-fullyconfigured + isCaseInsensitive: true + location: US + maxTimeTravelHours: "72" + projectRef: + external: ${projectId} + resourceID: bigquerydataset${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTime: "1970-01-01T00:00:00Z" + etag: abcdef123456 + lastModifiedTime: "1970-01-01T00:00:00Z" + observedGeneration: 2 + selfLink: https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId} diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object06.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object06.yaml new file mode 100644 index 0000000000..3eb4d7b152 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/_object06.yaml @@ -0,0 +1,37 @@ +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: absent + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 3 + name: bigquerydataset${uniqueId} + namespace: ${projectId} +spec: + access: + - role: OWNER + specialGroup: projectOwners + defaultEncryptionConfiguration: + kmsKeyRef: + name: kmscryptokey-${uniqueId} + description: Fully Configured BigQuery Dataset updated + location: US + projectRef: + external: ${projectId} + resourceID: bigquerydataset${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTime: "1970-01-01T00:00:00Z" + etag: abcdef123456 + lastModifiedTime: "1970-01-01T00:00:00Z" + observedGeneration: 3 + selfLink: https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId} diff --git a/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/script.yaml b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/script.yaml new file mode 100644 index 0000000000..be723c6bd7 --- /dev/null +++ b/tests/e2e/testdata/scenarios/fields/management/bigquery/dataset/unset_optional_fields/script.yaml @@ -0,0 +1,108 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kms.cnrm.cloud.google.com/v1beta1 +kind: KMSKeyRing +metadata: + name: kmskeyring-${uniqueId} +spec: + location: us +--- +apiVersion: kms.cnrm.cloud.google.com/v1beta1 +kind: KMSCryptoKey +metadata: + labels: + key-one: value-one + name: kmscryptokey-${uniqueId} +spec: + keyRingRef: + name: kmskeyring-${uniqueId} +--- +apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1 +kind: ServiceIdentity +metadata: + name: serviceidentity-${uniqueId} + annotations: + cnrm.cloud.google.com/deletion-policy: "abandon" +spec: + projectRef: + external: ${projectId} + resourceID: bigquery.googleapis.com +--- +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMPolicy +metadata: + name: iampolicy-${uniqueId} +spec: + resourceRef: + apiVersion: kms.cnrm.cloud.google.com/v1beta1 + kind: KMSCryptoKey + name: kmscryptokey-${uniqueId} + bindings: + - role: roles/cloudkms.cryptoKeyEncrypterDecrypter + members: + - serviceAccount:bq-${projectNumber}@bigquery-encryption.iam.gserviceaccount.com +--- +apiVersion: iam.cnrm.cloud.google.com/v1beta1 +kind: IAMServiceAccount +metadata: + annotations: + cnrm.cloud.google.com/project-id: "${projectId}" + name: iamsa-${uniqueId} +--- +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + name: bigquerydataset${uniqueId} +spec: + description: "Fully Configured BigQuery Dataset" + friendlyName: bigquerydataset-fullyconfigured + defaultPartitionExpirationMs: 3600000 + defaultTableExpirationMs: 3600000 + defaultCollation: und:ci + defaultEncryptionConfiguration: + kmsKeyRef: + name: kmscryptokey-${uniqueId} + isCaseInsensitive: true + location: US + maxTimeTravelHours: "72" + projectRef: + external: ${projectId} + access: + - role: OWNER + specialGroup: projectOwners + +--- + +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + name: bigquerydataset${uniqueId} +spec: + description: "Fully Configured BigQuery Dataset updated" + # friendlyName: bigquerydataset-fullyconfigured + # defaultPartitionExpirationMs: 3600000 + # defaultTableExpirationMs: 3600000 + # defaultCollation: und:ci + defaultEncryptionConfiguration: + kmsKeyRef: + name: kmscryptokey-${uniqueId} + # isCaseInsensitive: true + location: US + # maxTimeTravelHours: "72" + projectRef: + external: ${projectId} + access: + - role: OWNER + specialGroup: projectOwners