Skip to content

Latest commit

 

History

History
367 lines (309 loc) · 7.58 KB

aws_appmesh_gateway_route.md

File metadata and controls

367 lines (309 loc) · 7.58 KB

aws_appmesh_gateway_route

back

Index

Terraform

terraform {
  required_providers {
    aws = ">= 3.35.0"
  }
}

top

Example Usage

module "aws_appmesh_gateway_route" {
  source = "./modules/aws/r/aws_appmesh_gateway_route"

  # mesh_name - (required) is a type of string
  mesh_name = null
  # mesh_owner - (optional) is a type of string
  mesh_owner = null
  # name - (required) is a type of string
  name = null
  # tags - (optional) is a type of map of string
  tags = {}
  # virtual_gateway_name - (required) is a type of string
  virtual_gateway_name = null

  spec = [{
    grpc_route = [{
      action = [{
        target = [{
          virtual_service = [{
            virtual_service_name = null
          }]
        }]
      }]
      match = [{
        service_name = null
      }]
    }]
    http2_route = [{
      action = [{
        target = [{
          virtual_service = [{
            virtual_service_name = null
          }]
        }]
      }]
      match = [{
        prefix = null
      }]
    }]
    http_route = [{
      action = [{
        target = [{
          virtual_service = [{
            virtual_service_name = null
          }]
        }]
      }]
      match = [{
        prefix = null
      }]
    }]
  }]
}

top

Variables

variable "mesh_name" {
  description = "(required)"
  type        = string
}

variable "mesh_owner" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "name" {
  description = "(required)"
  type        = string
}

variable "tags" {
  description = "(optional)"
  type        = map(string)
  default     = null
}

variable "virtual_gateway_name" {
  description = "(required)"
  type        = string
}

variable "spec" {
  description = "nested block: NestingList, min items: 1, max items: 1"
  type = set(object(
    {
      grpc_route = list(object(
        {
          action = list(object(
            {
              target = list(object(
                {
                  virtual_service = list(object(
                    {
                      virtual_service_name = string
                    }
                  ))
                }
              ))
            }
          ))
          match = list(object(
            {
              service_name = string
            }
          ))
        }
      ))
      http2_route = list(object(
        {
          action = list(object(
            {
              target = list(object(
                {
                  virtual_service = list(object(
                    {
                      virtual_service_name = string
                    }
                  ))
                }
              ))
            }
          ))
          match = list(object(
            {
              prefix = string
            }
          ))
        }
      ))
      http_route = list(object(
        {
          action = list(object(
            {
              target = list(object(
                {
                  virtual_service = list(object(
                    {
                      virtual_service_name = string
                    }
                  ))
                }
              ))
            }
          ))
          match = list(object(
            {
              prefix = string
            }
          ))
        }
      ))
    }
  ))
}

top

Resource

resource "aws_appmesh_gateway_route" "this" {
  # mesh_name - (required) is a type of string
  mesh_name = var.mesh_name
  # mesh_owner - (optional) is a type of string
  mesh_owner = var.mesh_owner
  # name - (required) is a type of string
  name = var.name
  # tags - (optional) is a type of map of string
  tags = var.tags
  # virtual_gateway_name - (required) is a type of string
  virtual_gateway_name = var.virtual_gateway_name

  dynamic "spec" {
    for_each = var.spec
    content {

      dynamic "grpc_route" {
        for_each = spec.value.grpc_route
        content {

          dynamic "action" {
            for_each = grpc_route.value.action
            content {

              dynamic "target" {
                for_each = action.value.target
                content {

                  dynamic "virtual_service" {
                    for_each = target.value.virtual_service
                    content {
                      # virtual_service_name - (required) is a type of string
                      virtual_service_name = virtual_service.value["virtual_service_name"]
                    }
                  }

                }
              }

            }
          }

          dynamic "match" {
            for_each = grpc_route.value.match
            content {
              # service_name - (required) is a type of string
              service_name = match.value["service_name"]
            }
          }

        }
      }

      dynamic "http2_route" {
        for_each = spec.value.http2_route
        content {

          dynamic "action" {
            for_each = http2_route.value.action
            content {

              dynamic "target" {
                for_each = action.value.target
                content {

                  dynamic "virtual_service" {
                    for_each = target.value.virtual_service
                    content {
                      # virtual_service_name - (required) is a type of string
                      virtual_service_name = virtual_service.value["virtual_service_name"]
                    }
                  }

                }
              }

            }
          }

          dynamic "match" {
            for_each = http2_route.value.match
            content {
              # prefix - (required) is a type of string
              prefix = match.value["prefix"]
            }
          }

        }
      }

      dynamic "http_route" {
        for_each = spec.value.http_route
        content {

          dynamic "action" {
            for_each = http_route.value.action
            content {

              dynamic "target" {
                for_each = action.value.target
                content {

                  dynamic "virtual_service" {
                    for_each = target.value.virtual_service
                    content {
                      # virtual_service_name - (required) is a type of string
                      virtual_service_name = virtual_service.value["virtual_service_name"]
                    }
                  }

                }
              }

            }
          }

          dynamic "match" {
            for_each = http_route.value.match
            content {
              # prefix - (required) is a type of string
              prefix = match.value["prefix"]
            }
          }

        }
      }

    }
  }

}

top

Outputs

output "arn" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.arn
}

output "created_date" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.created_date
}

output "id" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.id
}

output "last_updated_date" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.last_updated_date
}

output "mesh_owner" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.mesh_owner
}

output "resource_owner" {
  description = "returns a string"
  value       = aws_appmesh_gateway_route.this.resource_owner
}

output "this" {
  value = aws_appmesh_gateway_route.this
}

top