Skip to content

pbs/terraform-aws-namespace-module

Repository files navigation

PBS TF Namespace Module

Installation

Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

github.com/pbs/terraform-aws-namespace-module?ref=0.1.24

Alternative Installation Methods

More information can be found on these install methods and more in the documentation here.

Usage

This module provisions a CloudMap namespace.

There are three types of namespaces that you might want to provision:

  • HTTP
  • Private
  • Public

This is where you can start learning about this service.

To put it simply, an HTTP namespace is a namespace that allows services to be discovered by AWS services that integrate with CloudMap (usually App Mesh).

e.g. app.example-http-namespace

A private namespace is effectively a private hosted zone that is managed by AWS. A service that is registered with a private namespace will receive a DNS record that is only resolvable within the VPC that the namespace is associated with.

e.g. app.example.private

A public namespace is effectively a public hosted zone that is managed by AWS. A service that is registered with a public namespace will receive a DNS record that is resolvable globally.

e.g. app.example.com

Integrate this module like so:

HTTP Namespace

module "namespace" {
  source = "github.com/pbs/terraform-aws-namespace-module?ref=0.1.24"

  # Tagging Parameters
  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo

  # Optional Parameters
}

Private Namespace

module "namespace" {
  source = "github.com/pbs/terraform-aws-namespace-module?ref=0.1.24"

  type = "private"
  name = "example.private"

  # Tagging Parameters
  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo

  # Optional Parameters
}

Public Namespace

module "namespace" {
  source = "github.com/pbs/terraform-aws-namespace-module?ref=0.1.24"

  type = "public"
  name = "example.org"

  # Tagging Parameters
  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo

  # Optional Parameters
}

Adding This Version of the Module

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

0.1.24

Note, however that subtrees can be altered as desired within repositories.

Further documentation on usage can be found here.

Below is automatically generated documentation on this Terraform module using terraform-docs


Requirements

Name Version
terraform >= 1.3.2
aws >= 4.5.0

Providers

Name Version
aws 5.24.0

Modules

No modules.

Resources

Name Type
aws_service_discovery_http_namespace.namespace resource
aws_service_discovery_private_dns_namespace.namespace resource
aws_service_discovery_public_dns_namespace.namespace resource
aws_default_tags.common_tags data source
aws_vpc.vpc data source

Inputs

Name Description Type Default Required
environment Environment (sharedtools, dev, staging, qa, prod) string n/a yes
organization Organization using this module. Used to prefix tags so that they are easily identified as being from your organization string n/a yes
product Tag used to group resources according to product string n/a yes
repo Tag used to point to the repo using this module string n/a yes
description Description of the namespace. If null, will default to {name} namespace. string null no
name Name of the namespace. If null, will default to product. string null no
tags Extra tags map(string) {} no
type Type of the namespace. string "http" no
vpc_id ID of the VPC for a private namespace. If null, will be looked up based on the environment parameter. string null no

Outputs

Name Description
arn ARN of the CloudMap Namespace
hosted_zone Hosted Zone of the CloudMap Namespace
id ID of the CloudMap Namespace
name Name of the CloudMap Namespace