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 support for Cloud Deploy resources #5710

Merged
merged 5 commits into from
Apr 14, 2022

Conversation

upodroid
Copy link
Contributor

Fixes: hashicorp/terraform-provider-google#11063

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)

`google_cloud_deploy_delivery_pipeline`
`google_cloud_deploy_target`

@modular-magician
Copy link
Collaborator

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

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review.

Thanks for your contribution! A human will be with you soon.

@slevenick, please review this PR or find an appropriate assignee.

@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 ( 12 files changed, 2100 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 12 files changed, 2100 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 407 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 8 files changed, 241 insertions(+))

@upodroid
Copy link
Contributor Author

bump

mmv1/products/clouddeploy/api.yaml Outdated Show resolved Hide resolved
mmv1/products/clouddeploy/api.yaml Show resolved Hide resolved
description: |
The timestamp of when the Target was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'etag'
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed for any particular reason? We tend to avoid adding etag and some of these other output-only fields if they aren't needed for other resources that depend on this. Similarly, updateTime & createTime can be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

Were these needed?

mmv1/products/clouddeploy/api.yaml Show resolved Hide resolved
default_from_api: true
Target: !ruby/object:Overrides::Terraform::ResourceOverride
autogen_async: true
id_format: '{{name}}'
Copy link
Contributor

Choose a reason for hiding this comment

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

Is name the right format? This is the short-form, so won't be able to identify the full resource during import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@upodroid upodroid Apr 12, 2022

Choose a reason for hiding this comment

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

On a side note, I'm not a fan of something_Id as name is the consistent resource name in most resources. The API uses name as selflink but an identical value can be read with the id attribute.

Precedent: #4951

Copy link
Contributor

Choose a reason for hiding this comment

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

So, having this id_format ends up with the following code to set the ID of the resource:

	// Store the ID now
	id, err := replaceVars(d, config, "{{name}}")
	if err != nil {
		return fmt.Errorf("Error constructing id: %s", err)
	}
	d.SetId(id)

I don't believe this is right, because it doesn't represent the full resource. The ID format should be projects/{{project}}/locations/{{region}}/deliveryPipelines/{{name}} so that we can reference this value from other resources within a config (if needed)

mmv1/products/clouddeploy/terraform.yaml Outdated Show resolved Hide resolved
mmv1/templates/terraform/examples/deploy_target.tf.erb Outdated Show resolved Hide resolved
mmv1/products/clouddeploy/terraform.yaml Show resolved Hide resolved
@upodroid upodroid force-pushed the cloud-deploy-resources branch from 9968530 to c67424c Compare April 13, 2022 23:13
@upodroid
Copy link
Contributor Author

Ready for review. I'll take another pass at DeliveryPipeline in a separate PR. My assumptions around Target weren't true but docs are non-existant and the UI can't be used to patch the resource. The API docs also doesn't make it clear which fields are required,immutable, etc

@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 ( 13 files changed, 2232 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 2232 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 407 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 117 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1985
Passed tests 1741
Skipped tests: 240
Failed tests: 4

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccCloudDeployTarget_update|TestAccCloudDeployTarget_cloudDeployTargetExample|TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample|TestAccServiceNetworkingPeeredDNSDomain_basic

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccServiceNetworkingPeeredDNSDomain_basic[view]

Tests failed during RECORDING mode:
TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample[view]
TestAccCloudDeployTarget_update[view]
TestAccCloudDeployTarget_cloudDeployTargetExample[view]

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

- !ruby/object:Api::Type::String
name: 'targetId'
required: true
input: true
Copy link
Contributor

Choose a reason for hiding this comment

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

These are unnecessary as the whole resource is input: true

default_from_api: true
Target: !ruby/object:Overrides::Terraform::ResourceOverride
autogen_async: true
id_format: '{{name}}'
Copy link
Contributor

Choose a reason for hiding this comment

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

So, having this id_format ends up with the following code to set the ID of the resource:

	// Store the ID now
	id, err := replaceVars(d, config, "{{name}}")
	if err != nil {
		return fmt.Errorf("Error constructing id: %s", err)
	}
	d.SetId(id)

I don't believe this is right, because it doesn't represent the full resource. The ID format should be projects/{{project}}/locations/{{region}}/deliveryPipelines/{{name}} so that we can reference this value from other resources within a config (if needed)

mmv1/products/clouddeploy/api.yaml Show resolved Hide resolved
description: |
The timestamp of when the Target was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
- !ruby/object:Api::Type::String
name: 'etag'
Copy link
Contributor

Choose a reason for hiding this comment

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

Were these needed?

@slevenick
Copy link
Contributor

/gcbrun

I enabled the API so the tests should actually run

@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 ( 13 files changed, 2232 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 2232 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 407 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 117 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1985
Passed tests 1740
Skipped tests: 240
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccServiceNetworkingPeeredDNSDomain_basic|TestAccCloudDeployTarget_update|TestAccCloudDeployTarget_cloudDeployTargetExample|TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample|TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic[view]
TestAccServiceNetworkingPeeredDNSDomain_basic[view]

Tests failed during RECORDING mode:
TestAccCloudDeployTarget_update[view]
TestAccCloudDeployTarget_cloudDeployTargetExample[view]
TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample[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 ( 13 files changed, 2237 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 2237 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 407 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 117 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1986
Passed tests 1740
Skipped tests: 240
Failed tests: 6

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccFirebaserulesRelease_BasicRelease|TestAccComputeForwardingRule_update|TestAccCloudDeployTarget_update|TestAccCloudDeployTarget_cloudDeployTargetFullExample|TestAccCloudDeployTarget_cloudDeployTargetExample|TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample

@modular-magician
Copy link
Collaborator

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

Tests failed during RECORDING mode:
TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample[view]
TestAccCloudDeployTarget_cloudDeployTargetFullExample[view]
TestAccCloudDeployTarget_update[view]
TestAccCloudDeployTarget_cloudDeployTargetExample[view]

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

@slevenick
Copy link
Contributor

/gcbrun

API should be enabled this time!

@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 ( 13 files changed, 2237 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 13 files changed, 2237 insertions(+), 2 deletions(-))
TF Validator: Diff ( 5 files changed, 407 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 4 files changed, 117 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1986
Passed tests 1740
Skipped tests: 240
Failed tests: 6

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccServiceNetworkingPeeredDNSDomain_basic|TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic|TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample|TestAccCloudDeployTarget_update|TestAccCloudDeployTarget_cloudDeployTargetFullExample|TestAccCloudDeployTarget_cloudDeployTargetExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic[view]
TestAccCloudDeployTarget_update[view]
TestAccServiceNetworkingPeeredDNSDomain_basic[view]
TestAccCloudDeployTarget_cloudDeployTargetExample[view]
TestAccCloudDeployTarget_cloudDeployTargetFullExample[view]
TestAccCloudDeployDeliveryPipeline_cloudDeployDeliveryPipelineExample[view]

All tests passed
View the build log or the debug log for each test

Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

Thanks!

@upodroid
Copy link
Contributor Author

Thanks!

No problem, I like the new CI process. Did the team work out how to give "trusted" community contributors permissions to view that bucket?

@slevenick
Copy link
Contributor

Thanks!

No problem, I like the new CI process. Did the team work out how to give "trusted" community contributors permissions to view that bucket?

Unfortunately not yet, but the feedback process should be much faster now!

slevenick added a commit that referenced this pull request Apr 22, 2022
slevenick added a commit that referenced this pull request Apr 22, 2022
saqibkhanspeaks12 pushed a commit to saqibkhanspeaks12/magic-modules that referenced this pull request Apr 25, 2022
betsy-lichtenberg pushed a commit to betsy-lichtenberg/magic-modules that referenced this pull request Apr 25, 2022
* add cloud deploy resources

Co-authored-by: upodroid <cy@borg.dev>

* add new test

* apply suggestions from sam

* remove custom flattener

* fix import id, add new tests and fix bad rebase
betsy-lichtenberg pushed a commit to betsy-lichtenberg/magic-modules that referenced this pull request Apr 25, 2022
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.

Add support for Cloud Deploy resources
3 participants