Skip to content

bitflight-public/terraform-aws-app-mesh

Repository files navigation

README Header

Cloud Posse

terraform-aws-app-mesh Build Status Latest Release Slack Community

Terraform module to provision an AWS App Mesh.


This project is part of our comprehensive "SweetOps" approach towards DevOps.

It's 100% Open Source and licensed under the APACHE2.

Examples

module "app_mesh" {
  source              = "../"
  context             = "${module.label.context}"
  ecs_services_domain = "${aws_service_discovery_private_dns_namespace.default.name}"

  virtual_nodes_count = "4"

  virtual_nodes = [
    {
      service_discovery_hostname_prefix = "colorteller-blue"
      service_name                      = "colorteller-blue-vn"
      port                              = "${var.colorteller_port}"
      protocol                          = "http"
    },
    {
      service_discovery_hostname_prefix = "colorteller-red"
      service_name                      = "colorteller-red-vn"
      port                              = "${var.colorteller_port}"
      protocol                          = "http"
    },
    {
      service_discovery_hostname_prefix = "colorteller-white"
      service_name                      = "colorteller-white-vn"
      port                              = "${var.colorteller_port}"
      protocol                          = "http"
    },
    {
      service_discovery_hostname_prefix = "tcpecho"
      service_name                      = "tcpecho-vn"
      port                              = "${var.tcpecho_port}"
      protocol                          = "tcp"
    },
  ]

  virtual_router_config_count = "1"

  virtual_router_config = [
    {
      "virtual_router_name" = "colorteller-vr"
      "port"                = "${var.colorteller_port}"
      "protocol"            = "http"                    // The protocol used for the port mapping. Valid values are http and tcp
    },
  ]

  ## The virtual route http config is set up as a list of maps
  ## of lists because in tf 0.11 maps cant contain mixed types.
  virtual_route_http_virtual_router_name = "colorteller-vr"

  virtual_route_http_match_prefix = "/"

  virtual_route_http_weighted_targets = [
    {
      "virtual_node" = "colorteller-red-vn"
      "weight"       = "10"
    },
    {
      "virtual_node" = "colorteller-blue-vn"
      "weight"       = "10"
    },
    {
      "virtual_node" = "colorteller-white-vn"
      "weight"       = "10"
    },
  ]

  virtual_service_router_config_count = "1"

  virtual_service_router_config = [
    {
      "virtual_service_name_prefix"  = "colorteller"
      "provider_virtual_router_name" = "colorteller-vr"
    },
  ]

  virtual_service_node_config_count = "1"

  virtual_service_node_config = [
    {
      "virtual_service_name_prefix" = "tcpecho"
      "provider_virtual_node_name"  = "tcpecho-vn"
    },
  ]

  virtual_backend_nodes_count = "1"

  virtual_backend_nodes = [{
    backend_virtual_service_hostname_prefixes = "tcpecho,colorteller"
    service_discovery_hostname_prefix         = "colorgateway"
    service_name                              = "colorgateway-vn"
    port                                      = "${var.colorteller_port}"
    protocol                                  = "http"
  }]
}

Makefile Targets

Available targets:

  help                                Help screen
  help/all                            Display help for all targets
  help/short                          This help short screen
  lint                                Lint terraform code

Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to each tag map map <map> no
attributes Any extra attributes for naming these resources list <list> no
aws_appmesh_envoy_image After you create your service mesh, virtual nodes, virtual routers, routes, and virtual services, you add the following App Mesh Envoy container image to the ECS task or Kubernetes pod represented by your App Mesh virtual nodes string 111345817488.dkr.ecr.us-west-2.amazonaws.com/aws-appmesh-envoy:v1.9.1.0-prod no
context The context output from an external label module to pass to the label modules within this module map <map> no
delimiter Delimiter to be used between namespace, stage, name and attributes string - no
ecs_services_domain DNS namespace used by services e.g. default.svc.cluster.local string - yes
egress_filter_type The egress filter type. By default, the type is DROP_ALL. Valid values are ALLOW_ALL and DROP_ALL string DROP_ALL no
enable_envoy_xray_tracing - string true no
environment The environment name if not using stage string `` no
envoy_log_level This can be trace, debug, info, warning, error, critical, off string info no
existing_mesh_id To provide an existing app mesh id for the module to use, instead of creating a new one. string `` no
label_order The naming order of the id output and Name tag list <list> no
load_balancer_path A path on the public load balancer that this service should be connected to. Use * to send all load balancer traffic to this service. string * no
mesh_name_override To provide a custom name to the aws_appmesh_mesh resource, by default it is named by the label module. string `` no
name Solution name, e.g. 'app' or 'jenkins' string `` no
namespace Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' string `` no
regex_replace_chars Regex to replace chars with empty string in namespace, environment, stage and name. By default only hyphens, letters and digits are allowed, all other chars are removed string /[^a-zA-Z0-9-]/ no
stage Stage, e.g. 'prod', 'staging', 'dev', or 'test' string `` no
tags Additional tags to apply to all resources that use this label module map <map> no
virtual_backend_nodes A list of maps that specifies the virtual node details with a backend. Separate multiple backend virtual service hostname prefixes using a comma.i.e. "serviceA,serviceB" This can support up to 2 nodes.

virtual_backend_nodes = [{ backend_virtual_service_hostname_prefixes = "tcpecho,colorteller" service_discovery_hostname_prefix = "colorgateway" service_name = "colorgateway-vn" port = "9080" protocol = "http" }]
list <list> no
virtual_backend_nodes_count - string 0 no
virtual_nodes A list of maps that specifies the virtual node details

virtual_nodes = [{ service_discovery_hostname_prefix = "colorteller-red" service_name = "colorteller-red-vn" port = "8080" protocol = "http" }]
list <list> no
virtual_nodes_count - string 0 no
virtual_route_http_match_prefix - string / no
virtual_route_http_virtual_router_name - string `` no
virtual_route_http_weighted_targets - list <list> no
virtual_router_config A list of maps that specifies the virtual router details.

virtual_router_config = [{ "virtual_router_name" = "gateway-vr" "port" = "8080" // The port used for the port mapping "protocol" = "http" // The protocol used for the port mapping. Valid values are http and tcp }]
list <list> no
virtual_router_config_count # variables.tf string 0 no
virtual_service_node_config hcl virtual_service_node_config = [{ "virtual_service_name_prefix" = "colorteller" // .appmesh.local "provider_virtual_node_name" = "colorteller-red-vn" }] list <list> no
virtual_service_node_config_count - string 0 no
virtual_service_router_config hcl virtual_service_router_config = [{ "virtual_service_name_prefix" = "colorteller" // .appmesh.local "provider_virtual_router_name" = "colorteller-vr" }] list <list> no
virtual_service_router_config_count # variables.tf string 0 no
xray_daemon_port - string 2000 no

Outputs

Name Description
mesh_arn -
mesh_created_date -
mesh_id # outputs.tf
mesh_last_updated_date -
virtual_node_ids -
virtual_router_arn -
virtual_router_config # outputs.tf
virtual_router_created_date -
virtual_router_id -
virtual_router_last_updated_date -

Help

Got a question?

File a GitHub issue, send us an email or join our Slack Community.

README Commercial Support

Commercial Support

Work directly with our team of DevOps experts via email, slack, and video conferencing.

We provide commercial support for all of our Open Source projects. As a Dedicated Support customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer.

E-Mail

  • Questions. We'll use a Shared Slack channel between your team and ours.
  • Troubleshooting. We'll help you triage why things aren't working.
  • Code Reviews. We'll review your Pull Requests and provide constructive feedback.
  • Bug Fixes. We'll rapidly work to fix any bugs in our projects.
  • Build New Terraform Modules. We'll develop original modules to provision infrastructure.
  • Cloud Architecture. We'll assist with your cloud strategy and design.
  • Implementation. We'll provide hands-on support to implement our reference architectures.

Slack Community

Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.

Newsletter

Signup for our newsletter that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Developing

If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email.

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

Copyright

Copyright © 2017-2019 Cloud Posse, LLC

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Trademarks

All other trademarks referenced herein are the property of their respective owners.

About

This project is maintained and funded by Cloud Posse, LLC. Like it? Please let us know by leaving a testimonial!

Cloud Posse

We're a DevOps Professional Services company based in Los Angeles, CA. We ❤️ Open Source Software.

We offer paid support on all of our projects.

Check out our other projects, follow us on twitter, apply for a job, or hire us to help with your cloud strategy and implementation.

Contributors

Andriy Knysh
Andriy Knysh
Jamie Nelson
Jamie Nelson

README Footer Beacon

About

Terraform module for creating the app mesh resources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages