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

google_certificate_manager_certificate_map should expose something like self_link #12869

Open
nevivurn opened this issue Oct 25, 2022 · 3 comments

Comments

@nevivurn
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

The recently added google_certificate_manager_certificate_map resource lacks a self_link attribute. This resource is usually used in google_compute_target_https_proxy.certificate_map which expects a URI as in the following error message:

│ Error: Error updating TargetHttpsProxy "projects/PROJECT/global/targetHttpsProxies/PROXY": googleapi: Error 400: Invalid value for field 'certificateMap': 'CERTMAP'. 'CERTMAP' is not a valid reference. It should have the format //certificatemanager.googleapis.com/projects/{project}/locations/{location}/certificateMaps/{resourceName}., invalid

but the google_certificate_manager_certificate_map resource does not provide any convenient attributes in the required format.

Potential Terraform Configuration

resource "google_compute_target_https_proxy" "proxy" {
  certificate_map = google_certificate_manager_certificate_map.map.self_link
}
resource "google_certificate_manager_certificate_map" "map" {
}
@melinath
Copy link
Collaborator

The best workaround here is to use string interpolation to combine the domain with the id field of the resource. (A self_link field would contain the same as id.) We should document this better.

@melinath melinath added this to the Goals milestone Oct 31, 2022
@betsy-lichtenberg
Copy link

This works.

data "google_project" "default" {
}

resource "google_compute_target_https_proxy" "default" {
  name             = "test-proxy"
  certificate_map  = "//certificatemanager.googleapis.com/projects/${data.google_project.default.project_id}/locations/global/certificateMaps/certmap1"
  url_map          = google_compute_url_map.default.id
  ssl_certificates = [
    google_compute_managed_ssl_certificate.default.name
  ]
  depends_on = [
    google_compute_managed_ssl_certificate.default
  ]
}

@Chupaka
Copy link
Contributor

Chupaka commented Mar 13, 2023

@betsy-lichtenberg, this is much clearer:

certificate_map = "//certificatemanager.googleapis.com/${google_certificate_manager_certificate_map.mymap.id}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants