Giter Club home page Giter Club logo

terraform-digitalocean-docker-swarm-firewall's Introduction

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" {
}

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

resource "digitalocean_tag" "manager" {
    name = "manager"
}

resource "digitalocean_tag" "worker" {
    name = "worker"
}

module "swarm-mode-cluster" {
    source            = "github.com/thojkooi/terraform-digitalocean-docker-swarm-mode"
    total_managers    = 3
    total_workers     = 5
    domain            = "do.example.com"
    do_token          = "${var.do_token}"
    manager_ssh_keys  = "${var.ssh_keys}"
    worker_ssh_keys   = "${var.ssh_keys}"
    manager_tags      = ["${digitalocean_tag.cluster.id}", "${digitalocean_tag.manager.id}"]
    worker_tags       = ["${digitalocean_tag.cluster.id}", "${digitalocean_tag.worker.id}"]
}

module "swarm-mode-firewall" {
    source  = "thojkooi/docker-swarm-firewall/digitalocean"
    version = "1.0.0"

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

See examples for more.

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

terraform-digitalocean-docker-swarm-firewall's People

Contributors

thojkooi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

terraform-digitalocean-docker-swarm-firewall's Issues

Does not work with digitalocean provider version ~1.0.0

With digitalocean provider version 1.0.2 or 1.1.0, module shows following error. While bumping down to 0.1.3, it works as usual. When reviewing changelog of provider, i cannot see anything that can break the behaviour.

Error: Error applying plan:

4 error(s) occurred:

* module.default-firewall.digitalocean_firewall.outbound-http: 1 error(s) occurred:

* digitalocean_firewall.outbound-http: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.docker-swarm-firewall.digitalocean_firewall.swarm-mode-internal-fw: 1 error(s) occurred:

* digitalocean_firewall.swarm-mode-internal-fw: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.default-firewall.digitalocean_firewall.outbound-dns: 1 error(s) occurred:

* digitalocean_firewall.outbound-dns: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.default-firewall.digitalocean_firewall.outbound-ntp: 1 error(s) occurred:

* digitalocean_firewall.outbound-ntp: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.