saltext.cloudflare_tunnel.states.cloudflare_tunnel_mod#

Cloudflare Tunnel State Module

This module is used to manage Cloudflare Zero Trust Tunnels

depends:
CloudFlare python module

This module requires the python wrapper for the CloudFlare API. https://github.com/cloudflare/python-cloudflare

Cloudflared Tunnel Client

This module requires that the cloudflared utility to be installed. https://github.com/cloudflare/cloudflared

configuration:

This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The module will use the ‘cloudflare’ key by default

For example:

cloudflare:
    api_token:
    account:
api_token:

API Token with permissions to create CloudFlare Tunnels

account:

CloudFlare Account ID, this can be found on the bottom right of the Overview page for your domain

saltext.cloudflare_tunnel.states.cloudflare_tunnel_mod.present(name, ingress)[source]#

Ensure the tunnel is present

The following parameters are required:

name

This is the name of the Cloudflare Tunnel to create

ingress

These are the rules to add, can specify multiple

It will also add a default catch-all rule

See docs for config details

CLI Example:

cloudflare_tunnel.present:
    - name: test_cf_tunnel
    - ingress:
        - hostname: name.domain.com
          service: https://127.0.0.1:8000
          path: test-past
          originRequest:
            httpHostheader: something
        - hostname: another.domain.com
          service: http://127.0.0.1:8080
saltext.cloudflare_tunnel.states.cloudflare_tunnel_mod.absent(name)[source]#

Ensure tunnel is absent

name

This is the name of the Cloudflare Tunnel to delete

CLI Example:

cloudflare_tunnel.absent:
    - name: test_cf_tunnel