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 #17365

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: #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 (hashicorp#10011)

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

[upstream:1470d00e90e813f69d09aa9f55589884cbc27900]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit b9fa0c0 into hashicorp:main Feb 23, 2024
4 checks passed
SarahFrench pushed a commit that referenced this pull request Mar 1, 2024
…Proxy resource (#10011) (#17365)

[upstream:1470d00e90e813f69d09aa9f55589884cbc27900]

Signed-off-by: Modular Magician <magic-modules@google.com>
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ceritificateManagerCertificates field to ComputeRegionTargetHttpsProxy resource
1 participant