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 ceritificateManagerCertificates field to ComputeRegionTargetHttpsProxy resource #1983

Conversation

modular-magician
Copy link
Collaborator

Add a new field certificateManagerCertificates field to ComputeRegionTargetHttpsProxy resource.

This is exactly the same to what was done for ComputeTargetHttpsProxy GoogleCloudPlatform/magic-modules#9144

Context :
The resource ComputeRegionTargetHttpsProxy has a field called sslCertificates, this field used to reference only ssl certificates. Recently, certificates of type CertificateManagerCertificates has been allowed. However, either all the items of the sslCertificates array will be sslCertificates or certificate manager certificates.

Furthermore, the field in TF couldn't accept certificate manager certificates because of a custom_expand function that only validates compute certificates (sslcertificates). It was agreed to handle this situation by defining a new field that shall be used when the customer wants to reference certificate manager certificates instead of sslCertificates.

More discussion about this here

What has been done in this PR:

  1. Added a new field CertificateManagerCerticates in the resource
  2. Removedrequired=true from sslCertificates field
  3. stated that SslCertificates and CertificateManagerCertificates are conflicting fields
  4. Used the encoder to rename CertificateManagerCertificates to sslCertificates before sending it to the API
  5. Decoder is used to rename back sslCertificates to CertificateManagerCertificates in TF in case the user used certificate manager certs instead of sslCerts (note that we can't have both sslCertificates and CertificateManagerCertificates defined together)
  6. The API expects the format of the certificate to be //certificatemanager.googleapis.com/projects/{{project}}/... For a better and more convenient UX, an expander is defined so that the customer can use the id of the resource (i.e. projects/{{project}}/...) and the expander will take care of the conversion
  7. If the customer used the id, the API still responds back with //certificatemanager.googleapis.com/projects/{{project}}/.., that's why a diff_suppress_func is used.
  8. Added an example that demonstrates using CertificateManagerCertificates in ComputeRegionTargetHttpsProxy

Fixes: hashicorp/terraform-provider-google#16998
b/320650971

Release Note Template for Downstream PRs (will be copied)

compute: added `certificate_manager_certificates` field to `google_compute_region_target_https_proxy` resource

Derived from GoogleCloudPlatform/magic-modules#10011

…Proxy resource (#10011)

Co-authored-by: Hamza Hassan <hamzahassan@google.com>

[upstream:1470d00e90e813f69d09aa9f55589884cbc27900]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician requested a review from a team as a code owner February 23, 2024 16:43
@modular-magician modular-magician requested review from shuyama1 and removed request for a team February 23, 2024 16:43
@modular-magician modular-magician merged commit 6d937be into GoogleCloudPlatform:main Feb 23, 2024
5 checks passed
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

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 ceritificateManagerCertificates field to ComputeRegionTargetHttpsProxy resource
1 participant