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

Creating vtm_virtual_server with ssl_server_cert_host_mapping_json issue #31

Open
jeffmbarnes opened this issue May 23, 2023 · 1 comment

Comments

@jeffmbarnes
Copy link

Hi,
I am trying to create a vtm_virtual_server while using ssl_server_cert_host_mapping_json to get data from vtm_virtual_server_server_cert_host_mapping_table

# example
data "vtm_virtual_server_server_cert_host_mapping_table" "application_dmz" {
  count       = length(var.application_cert_mapping)
  host        = "hostname"
  certificate = "certificate"
}

resource "vtm_virtual_server" "application_dmz" {
  name                              = "Application-DMZ"
  enabled                           = true
  listen_on_any                     = false
  listen_on_traffic_ips             = [vtm_traffic_ip_group.application_dmz.name]
  pool                              = vtm_pool.ingress.name
  protocol                          = "http"
  port                              = 443
  ssl_decrypt                       = true
  ssl_server_cert_host_mapping_json = "[${join(",",data.vtm_virtual_server_server_cert_host_mapping_table.application_dmz.*.json)}]"
}

When doing a terraform apply I am getting the following error:

│ Error: Unsupported argument
│
│   on kubernetes.tf line 95, in resource "vtm_virtual_server" "application_dmz":
│   95:   ssl_server_cert_host_mapping_json = "[${join(",", data.vtm_virtual_server_server_cert_host_mapping_table.application_dmz.*.json)}]"
│
│ An argument named "ssl_server_cert_host_mapping_json" is not expected here.

I'm not sure if the argument ssl_server_cert_host_mapping_json is missing from the resource_virtual_server schema or
is there a problem with the way I am trying to use ssl_server_cert_host_mapping_json ?

Please let me know if you need anymore information

terraform-provider-vtm version: 8.3.1
Virtual Traffic Manager 22.2

@mikolajzajac
Copy link

It could be achieved with dynamic blocks easily, e.g:

  dynamic "ssl_server_cert_host_mapping" {
    for_each = var.ssl_server_cert_host_mapping != null ? var.ssl_server_cert_host_mapping : []
    content {
      alt_certificates = ssl_server_cert_host_mapping.value["alt_certificates"]
      certificate      = ssl_server_cert_host_mapping.value["certificate"]
      host             = ssl_server_cert_host_mapping.value["host"]
    }
  }

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

No branches or pull requests

2 participants