Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Latest commit

 

History

History
31 lines (26 loc) · 992 Bytes

server_block.md

File metadata and controls

31 lines (26 loc) · 992 Bytes

Server Block Resource

This resource represents a Caddyfile in Caddy configuration directories.

Example Usage

# This will create file //etc/caddy/conf.d/test.conf
resource "caddy_server_block" "my-server" {
  filename = "test.conf"
  markers = {
    docker_port = docker_container.web.ports.external
    docker_ports = "${docker_container.web.ports.external},${docker_container.web2.ports.external}"
  }
  markers_split = {
    docker_ports = ","
  }
  content = <<EOF
# content of file here
# external docker port is: {# docker_port #}
# access web port in array: {# docker_ports[0] #}
# access web2 port in array: {# docker_ports[1] #}
EOF
}

Argument Reference

  • filename - (Required) Name of the configuration file
  • content - (Required) Content of the configuration file
  • markers- (Optional) Key-Value map. Keys specified as marker (e.g. {# key #}, {~ key ~}, {* key *}) will be replaced by the assigned value.