Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event_filters to event triggers in cloudfunctions2 resource #6278

Merged

Conversation

SarahFrench
Copy link
Contributor

@SarahFrench SarahFrench commented Jul 15, 2022

Description

Closes hashicorp/terraform-provider-google#12021

This PR adds the ability to set event filters within event triggers defined when creating a 2nd generation cloud function. Previously users could make 2nd gen functions be triggered by events sent from an 'event provider' (i.e. a Google API) within Eventarc, but now they can filter those events based on the event's attributes.

Valid attributes that can be used in filters differ by the event provider - here's the relevant part of the docs that describes a gcloud command to learn more about the events and attributes for a given event provider.

E.g. All events related to the storage.googleapis.com event provider have attributes type and bucket - and bucket wouldn't be an attribute on non-GCS events

$ gcloud eventarc providers describe storage.googleapis.com --location=us-central1

displayName: Cloud Storage
eventTypes:
- description: The live version of an object has become a noncurrent version.
  filteringAttributes:
  - attribute: bucket
    description: The bucket name being watched.
    required: true
  - attribute: type
    required: true
  type: google.cloud.storage.object.v1.archived

#...omitted other events in list...

name: projects/[PROJECT_ID]/locations/us-central1/providers/storage.googleapis.com

Things to note

  1. How should operator be used? I couldn't work it out for an acceptance test - addressed in fb04576 - docs are here and path patterns aren't appropriate for all attributes

  2. The type attribute cannot be used in the new event_filters block because it is already set by the event_type field inside the event_trigger block.

A configuration similar to the one below causes this error

The request was invalid: duplicated declaration of attribute \"type\" in trigger.event_filters
resource "google_cloudfunctions2_function" "terraform-test" {
 
  ...

  event_trigger {
    trigger_region                = "us-central1"
    event_type                    = "google.cloud.storage.object.v1.finalized"
    retry_policy                  = "RETRY_POLICY_RETRY"
    service_account_email = google_service_account.account.email
    event_filters {
      attribute                        = "bucket"
      value                            = google_storage_bucket.trigger-bucket.name
    }
    event_filters {
      attribute                        = "type" # This clashes with event_type and triggers an API error
      value                            = "google.cloud.storage.object.v1.finalized"
    }
  }
}

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

cloudfunctions2: added field `event_filters` to resource `google_cloudfunctions2_function` (beta)

@SarahFrench
Copy link
Contributor Author

The acceptance test for this PR requires access to organization and billing account info - it might require a bit of trial and error in GitHub as I can't do this locally at the moment

@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I've detected that you're a community contributor. @slevenick, a repository maintainer, has been assigned to assist you and help review your changes.

❓ First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


@SarahFrench SarahFrench marked this pull request as draft July 15, 2022 18:47
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 144 insertions(+))
Terraform Beta: Diff ( 4 files changed, 412 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 114 insertions(+))

@megan07 megan07 requested review from megan07 and removed request for slevenick July 15, 2022 19:10
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2107
Passed tests 1875
Skipped tests: 226
Failed tests: 6

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease|TestAccSqlUser_mysqlDisabled|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccSqlUser_mysqlDisabled[view]
TestAccFirebaserulesRelease_BasicRelease[view]

Tests failed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 143 insertions(+))
Terraform Beta: Diff ( 4 files changed, 410 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 113 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2108
Passed tests 1877
Skipped tests: 226
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample|TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]

Tests failed during RECORDING mode:
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@SarahFrench
Copy link
Contributor Author

SarahFrench commented Jul 16, 2022

Looks like APIs need to be activated in the new project made by the acc test - I recently got info needed to run acceptance tests that create new, transient projects so I'll try addressing this when running the acceptance test locally. Will pick up on Monday

Need to use trial and error via this PR to get the acceptance test working

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 162 insertions(+))
Terraform Beta: Diff ( 4 files changed, 448 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 132 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2109
Passed tests 1878
Skipped tests: 226
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[view]

Tests failed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 162 insertions(+))
Terraform Beta: Diff ( 4 files changed, 448 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 132 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2109
Passed tests 1879
Skipped tests: 226
Failed tests: 4

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 178 insertions(+))
Terraform Beta: Diff ( 4 files changed, 480 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 148 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2109
Passed tests 1877
Skipped tests: 226
Failed tests: 6

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample|TestAccSqlUser_mysqlDisabled|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccSqlUser_mysqlDisabled[view]
TestAccFirebaserulesRelease_BasicRelease[view]

Tests failed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@SarahFrench SarahFrench force-pushed the cloudfunction2-event-filter branch from 8e4841e to 5dbe61e Compare July 21, 2022 10:03
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 144 insertions(+))
Terraform Beta: Diff ( 4 files changed, 410 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 114 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2127
Passed tests 1893
Skipped tests: 226
Failed tests: 8

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2FullGcsExample|TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample|TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample|TestAccActiveDirectoryDomain_update|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccContainerCluster_withMeshCertificatesConfig

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccContainerCluster_withMeshCertificatesConfig[view]
TestAccCloudfunctions2function_cloudfunctions2FullGcsExample[view]

Tests failed during RECORDING mode:
TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]
TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample[view]
TestAccActiveDirectoryDomain_update[view]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Contributor

@megan07 megan07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Just a few minor things and then I think we're good to go! Thanks!

mmv1/products/cloudfunctions2/api.yaml Show resolved Hide resolved
Currently, only a subset of attributes are supported for filtering. Use the `gcloud eventarc providers describe` command to learn more about events and their attributes.
Do not filter for the 'type' attribute here, as this is already achieved by the resource's `event_type` attribute.
- !ruby/object:Api::Type::String
name: value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, required: true. we're also able to check if these were updatable? just curious if we want to add input: true here too? we could maybe add an update test if we wanted to test it - or just run a quick update test to see if it works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually tested changing the value (as there are not other possible values of attribute in the context of a GCS event) and it can change ok 👍

I could imagine an argument that a cloud function being triggered in a different way is a fundamentally 'different' cloud function than the old version, so a ForceNew and replacing the whole set of resources that make up the function + its trigger could makes sense. My gut feeling is to not do input:true because the 1 resource that needs changing can be updated, but I'm not strongly holding onto that belief

mmv1/products/cloudfunctions2/api.yaml Show resolved Hide resolved
@modular-magician modular-magician requested a review from megan07 July 29, 2022 19:49
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 266 insertions(+))
Terraform Beta: Diff ( 4 files changed, 682 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 2 files changed, 229 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2125
Passed tests 1892
Skipped tests: 226
Failed tests: 7

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccActiveDirectoryDomain_update|TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample|TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

@SarahFrench
Copy link
Contributor Author

SarahFrench commented Jul 29, 2022

@megan07 I'm glad you asked about operator cos I went an added another test that allows multiple multiple event_filter blocks to be defined, and found a permadiff due to event triggers returning event filters in different orders

Permadiff terminal output
  
    provider_test.go:309: Step 1/2 error: After applying this test step and performing a `terraform refresh`, the plan was not empty.
        stdout
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # google_cloudfunctions2_function.test will be updated in-place
          ~ resource "google_cloudfunctions2_function" "test" {
                id          = "projects/[PROJECT_ID]/locations/us-central1/functions/tf-test-function-2rtehdb4n7"
                name        = "tf-test-function-2rtehdb4n7"
                # (7 unchanged attributes hidden)
        
              ~ event_trigger {
                    # (6 unchanged attributes hidden)
        
                  ~ event_filters {
                      ~ attribute = "resourceName" -> "serviceName"
                      - operator  = "match-path-pattern" -> null
                      ~ value     = "/projects/_/buckets/tf-test-audit-bucket-2rtehdb4n7/objects/*.txt" -> "storage.googleapis.com"
                    }
                  ~ event_filters {
                      ~ attribute = "serviceName" -> "methodName"
                      ~ value     = "storage.googleapis.com" -> "storage.objects.create"
                    }
                  ~ event_filters {
                      ~ attribute = "methodName" -> "resourceName"
                      + operator  = "match-path-pattern"
                      ~ value     = "storage.objects.create" -> "/projects/_/buckets/tf-test-audit-bucket-2rtehdb4n7/objects/*.txt"
                    }
                }
        
                # (2 unchanged blocks hidden)
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.

I'll get on with this next week 😅

Edit on Monday: Addressed the permadiff and pushed the new test that surfaced it in fb04576

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view]

Tests failed during RECORDING mode:
TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]
TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample[view]
TestAccActiveDirectoryDomain_update[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 266 insertions(+))
Terraform Beta: Diff ( 5 files changed, 951 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 2 files changed, 229 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2125
Passed tests 1887
Skipped tests: 226
Failed tests: 12

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccFirebaserulesRelease_BasicRelease|TestAccSqlUser_mysqlDisabled|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample|TestAccActiveDirectoryDomain_update|TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view]
TestAccSqlUser_mysqlDisabled[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccFirebaserulesRelease_BasicRelease[view]
TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view]
TestAccCGCSnippet_eventarcWorkflowsExample[view]
TestAccCloudFunctions2Function_fullUpdate[view]

Tests failed during RECORDING mode:
TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]
TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view]
TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample[view]
TestAccActiveDirectoryDomain_update[view]

Please fix these to complete your PR
View the build log or the debug log for each test

Make code homogenous between the two tests to faciliatate this
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 266 insertions(+))
Terraform Beta: Diff ( 5 files changed, 832 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 2 files changed, 229 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2125
Passed tests 1889
Skipped tests: 226
Failed tests: 10

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample|TestAccActiveDirectoryDomain_update|TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccCloudFunctions2Function_fullUpdate[view]
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]
TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view]
TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view]
TestAccCGCSnippet_eventarcWorkflowsExample[view]

Tests failed during RECORDING mode:
TestAccActiveDirectoryDomain_activeDirectoryDomainBasicExample[view]
TestAccComputeInstance_soleTenantNodeAffinities[view]
TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view]
TestAccActiveDirectoryPeering_activeDirectoryPeeringBasicExample[view]
TestAccActiveDirectoryDomain_update[view]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Contributor

@megan07 megan07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!!

@SarahFrench SarahFrench merged commit d6a18ba into GoogleCloudPlatform:main Aug 2, 2022
hao-nan-li pushed a commit to hao-nan-li/magic-modules that referenced this pull request Sep 6, 2022
…ogleCloudPlatform#6278)

* Add `eventFilters` in cloudfunctions2 API definition

* Remove trailing whitespace

* Start adding cloudfunctions2 eventarc acceptance test that uses GCS

* Add missing IAM bindings to prevent API errors during `FullGcsExample` acceptance test

* Make `eventTrigger.pubsubTopic` default from the API to handle topics made by Eventarc

* Update field description for `attribute` - info to learn more about possible values

* Remove unneeded attribute from `google_storage_bucket_object`

* Add API service enabling to new project in test, fix provider used to make project

* Fix inbuilt function call in acceptance test

* Add explicit dependencies to try make API calls happen after the API is turned on

* Remove generated acceptance test and add handwritten test with 2 stages

* Remove `depends_on` attributes from example config

* Fix bug in test's TF config, make project ID and name the same

* Replace use of `for_each` in acceptance test

There is an open issue about how for_each loops don't work : hashicorp/terraform-plugin-sdk#536

* Add `run.googleapis.com` to project

* Change `disable_dependent_services` to `false` for eventarc API in acceptance tests

Change example config to match, too

* Enable `artifactregistry.googleapis.com` in acceptance test & example

* Add missing IAM binding to cloud function service account - `roles/artifactregistry.reader`

Odd that this is needed, as it wasn't required when I created a similar cloud function in an existing GCP project (where APIs were already activated etc)

* Add explicit dependency between cloud function resource and IAM bindings for its service account

Address "Unable to retrieve the repository metadata" error that suggests service account doesn't have permissions in place

* Enable `cloudbuild.googleapis.com` API in acceptance test and example

* Enable `pubsub.googleapis.com` API in acceptance test and example

* Fix test so step 1 of test enables all the APIs

* Replace zipped cloud function code with zip made by `archive_file` Terraform resource

* Add repo-level IAM binding (in addition to project level) using inferred repo ID

* Fix missing quotation mark in test

:(

* Split project into 3 stages and remove repo-specific IAM binding

This is after running the test locally and it succeeding in 3 steps but not in 2 steps

* Fix problem where TF couldn't delete resources at end of test

Couldn't delete the cloud function because the API had been disabled

* Update test to get project ID from ENV instead of project created by the test

Update test and example block with needed variables

Remove handwritten test

* Fix API spec to make required fields required

* Update event_filter fields' descriptions for clarity

* Change GCS event_filter test to basic as it can't use all fields

* Add example test that shows the operator field in use

* Fix whitespace

* Add test for updating `event_filters` blocks

* Reuse generated cloudfunction2 test functions in handwritten test

Make code homogenous between the two tests to faciliatate this
@SarahFrench SarahFrench deleted the cloudfunction2-event-filter branch March 26, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

google_cloudfunctions2_function - support event_filters
3 participants