Skip to content

cpxPratik/terraform-digitalocean-docker-swarm-firewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform - Digital Ocean Swarm mode firewall rules

Terraform module to configure Docker Swarm mode firewall rules on DigitalOcean. Based on the Docker documentation. This module provides a basic set of rules for cluster communications.

CircleCI


Requirements

Usage

provider "digitalocean" {
    token = var.do_token
    version = "~> 1.4"
}

resource "digitalocean_tag" "cluster" {
    name = "swarm-mode-cluster"
}

module "swarm-mode-firewall" {
    source  = "github.com/cpxPratik/terraform-digitalocean-docker-swarm-firewall?ref=master"
    do_token = var.do_token

    prefix                     = "my-project"
    cluster_tags               = [digitalocean_tag.cluster.id]
}

Firewall rules

The following rules will be created:

Cluster communications

The following inbound rules are applied to any droplet that matches the id in cluster_droplet_ids or has a tag listed in cluster_tags:

Port Description Source
2377/TCP cluster management communications cluster_droplet_ids, cluster_tags
7946/TCP Container network discovery cluster_droplet_ids, cluster_tags
7946/UDP Container network discovery cluster_droplet_ids, cluster_tags
4789/UDP Container overlay network cluster_droplet_ids, cluster_tags

Please note that previous versions of this module also added rules for SSH access and various outbound rules. These have been removed from this module. Simliar functionality is provided by the following modules:

License

MIT © Thomas Kooi