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

Adding Eventarc-Workflows example for cgc docs #6279

Merged
merged 7 commits into from
Jul 26, 2022

Conversation

minyu19
Copy link
Contributor

@minyu19 minyu19 commented Jul 15, 2022

Adding Eventarc-Workflows example for cgc docs that uses Terraform to invoke a workflow using Eventarc.

@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. @megan07, 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.


@modular-magician modular-magician requested a review from megan07 July 15, 2022 18:51
@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform Beta: Diff ( 1 file changed, 355 insertions(+), 228 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 107 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 0
Passed tests 0
Skipped tests: 0
Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR
View the build log

@megan07
Copy link
Contributor

megan07 commented Jul 19, 2022

/gcbrun

# Eventarc
### Eventarc Workflows quickstart
- !ruby/object:Provider::Terraform::Examples
name: "eventarc-workflows"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name: "eventarc-workflows"
name: "eventarc_workflows"

We will want to use an underscore instead of the dash here, and we'll need to update the associated filename as well. Thanks!

@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform Beta: Diff ( 1 file changed, 355 insertions(+), 228 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 107 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 0
Passed tests 0
Skipped tests: 0
Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR
View the build log

@modular-magician modular-magician requested a review from megan07 July 19, 2022 18:50
@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform Beta: Diff ( 1 file changed, 127 insertions(+))
TF Cloud Doc Samples: Diff ( 1 file changed, 107 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2112
Passed tests 1881
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|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[view]

Tests failed during RECORDING mode:
TestAccCGCSnippet_eventarcWorkflowsExample[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

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.

Looks good so far, just a couple change requests. Thanks!

project = data.google_project.project.id
role = "roles/logging.logWriter"

members = [
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: would you mind lining up all these members lists to line up with the other attributes and remove the extra whitespace? thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you, Megan!

description = "A sample workflow"
service_account = google_service_account.eventarc_workflows_service_account.id
# Imported main workflow YAML file
source_contents = templatefile("${path.module}/workflow.yaml",{})
Copy link
Contributor

Choose a reason for hiding this comment

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

This file will need to exist in order for the test to pass. Would you be able to add the contents in like this?

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 have added the contents as a workflow.yaml file into the same directory since it has been referenced as a yaml file within the eventarc_workflows.tf.erb file. Could you please let me know if I did that right? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

this is fine, I think you'll need to move the workflow.yaml file to third_party/terraform/utils/test-fixtures/workflow.yaml for it to work and then update the path here to be test-fixtures/workflow.yaml

Suggested change
source_contents = templatefile("${path.module}/workflow.yaml",{})
source_contents = templatefile("test-fixtures/workflow.yaml",{})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thank you! Please do let me know if this looks good.

@@ -0,0 +1,108 @@
# [START eventarc_terraform_enableapis]
Copy link
Contributor

Choose a reason for hiding this comment

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

this file can be removed in place of the new eventarc_workflows.tf.erb file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you Megan.

pubsub_workflow_tf: "pubsub-workflow-tf"
trigger_pubsub_workflow_tf: "trigger-pubsub-workflow-tf"
min_version: beta
# ignore_read_extra:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: these commented out lines can be removed i believe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you!

@modular-magician modular-magician requested a review from megan07 July 19, 2022 21:41
@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform Beta: Diff ( 1 file changed, 121 insertions(+))
TF Cloud Doc Samples: Diff ( 1 file changed, 101 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2112
Passed tests 1880
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|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccSqlUser_mysqlDisabled

@modular-magician
Copy link
Collaborator

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

Tests failed during RECORDING mode:
TestAccCGCSnippet_eventarcWorkflowsExample[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 ( 1 file changed, 17 insertions(+))
Terraform Beta: Diff ( 2 files changed, 138 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 101 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2115
Passed tests 1884
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|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease

@modular-magician
Copy link
Collaborator

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

Tests failed during RECORDING mode:
TestAccCGCSnippet_eventarcWorkflowsExample[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

description = "A sample workflow"
service_account = google_service_account.eventarc_workflows_service_account.id
# Imported main workflow YAML file
source_contents = templatefile("$text-fixtures/workflow.yaml",{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
source_contents = templatefile("$text-fixtures/workflow.yaml",{})
source_contents = templatefile("test-fixtures/workflow.yaml",{})

we can just use the hard-coded path where it will live :)

@modular-magician modular-magician requested a review from megan07 July 26, 2022 14:23
@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 ( 1 file changed, 17 insertions(+))
Terraform Beta: Diff ( 2 files changed, 138 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 101 insertions(+))

description = "A sample workflow"
service_account = google_service_account.eventarc_workflows_service_account.id
# Imported main workflow YAML file
source_contents = templatefile("text-fixtures/workflow.yaml",{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
source_contents = templatefile("text-fixtures/workflow.yaml",{})
source_contents = templatefile("test-fixtures/workflow.yaml",{})

sorry for the misunderstanding, I think you'll want test here, not text :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh gosh! I'm so sorry, I have corrected it now.

Copy link
Contributor

Choose a reason for hiding this comment

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

no worries :) thanks!

@modular-magician modular-magician requested a review from megan07 July 26, 2022 14:50
@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 ( 1 file changed, 17 insertions(+))
Terraform Beta: Diff ( 2 files changed, 138 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF Cloud Doc Samples: Diff ( 1 file changed, 101 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2120
Passed tests 1889
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 TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccSqlUser_mysqlDisabled

@modular-magician
Copy link
Collaborator

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

Tests failed during RECORDING mode:
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

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!!

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.

3 participants