I have an aws_api_gateway_domain_name
resource in terraform with this configuration:
resource "aws_api_gateway_domain_name" "apigw_domain_name" {
count = var.api_server_custom_domain_name != "" ? 1 : 0
domain_name = var.api_server_custom_domain_name
regional_certificate_arn = var.api_server_cert_arn
security_policy = "TLS_1_2"
endpoint_configuration {
types = [var.api_endpoint_configuration_type]
}
}
In case the count above is set to 1 (or >1, lets's say I want to have multiple domain names). For each of those resources, I want to have multiple aws_api_gateway_base_path_mapping
resources as follows: (I assume I have 4 aws_api_gateway_rest_api
and aws_api_gateway_stage
resources)
resource "aws_api_gateway_base_path_mapping" "api_gateway_base_path_mapping" {
count = 4
domain_name = aws_api_gateway_domain_name.apigw_domain_name[<Indexing the domain names>].domain_name
api_id = aws_api_gateway_rest_api.apigw[count.index].id
stage_name = aws_api_gateway_stage.stage[count.index].stage_name
}
So I imagine it would be like a 2D matrix, where for every domain name there is some fixed number of mappings. Is there a way to do it?