example.tftest.hcl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # GENERATED from terraform.tfvars.example by scripts/gen_example_tests.py. Do not
  2. # edit by hand: change the example file and run
  3. # `python -I scripts/gen_example_tests.py`. CI fails when this file is stale.
  4. # It plans the stack with the example values, so the example stays valid.
  5. mock_provider "digitalocean" {
  6. mock_data "digitalocean_ssh_key" {
  7. defaults = {
  8. fingerprint = "aa:bb:cc:dd:ee:ff"
  9. }
  10. }
  11. }
  12. mock_provider "twingate" {}
  13. variables {
  14. # Example values for stacks/10-access. Copy this file to terraform.tfvars
  15. # (which git ignores) for a local plan. Never put a token, key or password in a
  16. # value file: those live in Doppler. Every value here is a placeholder, not a
  17. # real one. In the live stack the first five arrive as TF_VAR_* from the
  18. # foundation stack's outputs and the Spacelift environment, and the rest from
  19. # Doppler through the Spacelift hook.
  20. #
  21. # Droplet sizes are not set here. They live in cost.json, so the cost gate stays
  22. # the one place that prices them (see docs/cost.md).
  23. # DigitalOcean region slug, from the foundation stack's region output.
  24. region = "tor1"
  25. # Id of the VPC the connectors join, from the foundation stack's vpc_id output.
  26. vpc_id = "vpc-example-0000"
  27. # Id of the DigitalOcean project, from the foundation stack's project_id output.
  28. project_id = "project-example-0000"
  29. # Baseline firewall tag, from the foundation stack's baseline_tag output. It must
  30. # start with "cah-baseline-" so the baseline firewall covers the connectors.
  31. baseline_tag = "cah-baseline-tor1"
  32. # Bare Twingate network subdomain (only the part before the Twingate domain). Private: it
  33. # identifies your tenant, so the real one comes from Doppler.
  34. twingate_network = "example-tenant"
  35. # Public SSH key for the cah-admin user: "<algorithm> <key>" with an optional
  36. # one-word comment. The comment is dropped before the key reaches the droplet.
  37. # This placeholder is deliberately not a real key. The real one comes from Doppler.
  38. admin_ssh_public_key = "ssh-ed25519 AAAAEXAMPLEONLYNOTAREALKEY example-key"
  39. # Name of an SSH key already registered on the DigitalOcean account (it is looked
  40. # up, never registered). The real name comes from Doppler.
  41. admin_ssh_key_name = "example-admin-key"
  42. # Twingate user ids placed in the admin group (at least one). The real ids come
  43. # from Doppler.
  44. admin_user_ids = ["example-user-id"]
  45. # When each connector may reboot, HH:MM in America/New_York (the droplet's local
  46. # time). Keys a and b. The two times must be at least 60 minutes apart around the
  47. # clock (across midnight too), so the connectors never reboot together and the
  48. # weekly update, 30 minutes after each reboot, stays clear of the other reboot.
  49. # These are the times the live connectors use.
  50. reboot_times = { a = "04:00", b = "05:00" }
  51. # IANA time zone of the droplets (UTC or Area/Location). reboot_times above and
  52. # the weekly connector update are read in this zone. The default is the zone the
  53. # live connectors use. Changing it changes the rendered cloud-init (user_data),
  54. # which is force-new: both droplets are REPLACED, so read the plan first.
  55. timezone = "America/New_York"
  56. # Used in the NAMES and TAGS of cloud and Twingate objects (access-<key>,
  57. # cah-connector-<key>, droplet names). Empty means region, so every name is the
  58. # same as before this setting existed. IMMUTABLE for the life of a stack:
  59. # changing it changes names, causes widespread plan changes and may replace resources, including through tags or user_data including the connectors.
  60. # Set it only on a NEW stack, and use the same value as the foundation stack.
  61. resource_key = ""
  62. # Twingate connector telemetry (both connectors). The default, {}, changes nothing.
  63. # Setting any of log_level, connection_logs, metrics_port or labels adds lines to
  64. # /etc/twingate/connector.conf, which changes user_data: the plan then shows BOTH
  65. # droplets REPLACED. Roll out one connector at a time with
  66. # connector_telemetry_instances (["a"] first, then ["a", "b"]) and an
  67. # SSH-through-Twingate check between (docs/wiki/Trace-One-Change-End-to-End.md,
  68. # variant C). It opens no firewall port by itself (see metrics_source_tag). Uncomment to try it; the values are
  69. # placeholders.
  70. # connector_telemetry = {
  71. # status_updates_enabled = true # provider setting, not sent while unset, never replaces anything
  72. # log_level = 5 # 3, 4, 5 or 7 (Twingate's default is 3)
  73. # connection_logs = true # TWINGATE_LOG_ANALYTICS=v3 (user emails and client IPs in the journal)
  74. # metrics_port = 9999 # TWINGATE_METRICS_PORT, 1024 to 65535, not 9100
  75. # labels = { DEPLOYED_BY = "opentofu" } # shown in the Admin Console: no secrets
  76. # }
  77. connector_telemetry = {}
  78. # Which connectors get connector_telemetry (a, b or both). Default both.
  79. connector_telemetry_instances = ["a", "b"]
  80. # What the connectors NOT listed above keep (their current telemetry). {} for the
  81. # first activation. For a later change, put the old value here and list ["a"]
  82. # first, so b keeps its config while a changes.
  83. connector_telemetry_previous = {}
  84. # Lock the droplet metadata endpoint (the link-local cloud address, which serves each
  85. # connector's user-data and so its Twingate tokens) to root and to the do-agent
  86. # user that DigitalOcean's monitoring agent runs as. Default false changes
  87. # nothing. true REPLACES the droplet of every connector in
  88. # metadata_lock_instances (user_data changes). Roll out one at a time:
  89. # metadata_lock = true with ["a"], apply, check SSH through Twingate, then
  90. # ["a", "b"]. Not yet tested on a real droplet.
  91. metadata_lock = false
  92. # Which connectors get metadata_lock (a, b or both). Default both.
  93. metadata_lock_instances = ["a", "b"]
  94. # A default-drop host firewall (nftables) on each connector, a second layer
  95. # behind the cloud firewall. Only SSH from host_firewall_ssh_sources (and the
  96. # connector metrics port when connector_telemetry sets one) is let in. Default
  97. # false changes nothing. true REPLACES the droplet of every connector in
  98. # host_firewall_instances (user_data changes). A wrong ruleset can lock you
  99. # out of SSH: roll out one at a time, host_firewall = true with ["a"], apply,
  100. # check SSH through Twingate, then ["a", "b"]. Not yet tested on a real droplet.
  101. host_firewall = false
  102. # Which connectors get host_firewall (a, b or both). Default both.
  103. host_firewall_instances = ["a", "b"]
  104. # IPv4 CIDRs allowed to reach SSH through the host firewall. Default the three
  105. # private blocks; narrow to your VPC range if you know it.
  106. host_firewall_ssh_sources = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
  107. # Opt-in node exporter (prometheus-node-exporter from the distro archive), bound
  108. # to each connector's private address only. The default, {}, changes nothing.
  109. # enabled = true REPLACES the droplet of every connector in node_exporter_instances
  110. # (user_data changes): roll out one at a time, check SSH through Twingate and the
  111. # memory headroom of the 1 GB droplet between. It opens no firewall port by
  112. # itself: set metrics_source_tag as well. NOT applied and NOT tested on a real
  113. # machine yet. Uncomment to try it; the values are placeholders.
  114. # node_exporter = { enabled = true, port = 9100 }
  115. node_exporter = {}
  116. # Which connectors get node_exporter (a, b or both). Default both.
  117. node_exporter_instances = ["a", "b"]
  118. # The DigitalOcean tag of the droplets that may scrape the metrics ports (the node
  119. # exporter port and connector_telemetry.metrics_port). Empty, the default, adds no
  120. # firewall rule. When set, the connector firewall admits each enabled metrics port
  121. # from THIS TAG ONLY (never an address, never a public source). The tag must
  122. # already exist; this stack does not create it. Example: "cah-telemetry-tor1".
  123. metrics_source_tag = ""
  124. # Opt-in log shipping: the Wazuh agent (from Wazuh's apt repository) and auditd on
  125. # each connector, enrolled at first boot with a secret pulled from Doppler. The
  126. # default, {}, changes nothing. enabled = true REPLACES the droplet of every
  127. # connector in log_shipping_instances (user_data changes): roll out one at a time,
  128. # check SSH through Twingate and the memory headroom of the 1 GB droplet between
  129. # (UNMEASURED). manager_address is the Wazuh manager as reached through Twingate
  130. # (private: the real one comes from Doppler or the Spacelift environment, never
  131. # from a committed file). apt_key_fingerprint has no default on purpose: read the
  132. # 40 uppercase hex digits from Wazuh's documentation and compare them yourself.
  133. # agent_name_prefix names each agent <prefix>-connector-<a or b>; use the same
  134. # value as site_name. agent_group must already exist on the manager. The Twingate
  135. # headless client the agent needs to reach the manager is NOT part of this
  136. # change. NOT applied and NOT tested on a real machine yet. Uncomment to try it;
  137. # the values are placeholders (replace the fingerprint placeholder with the real digits).
  138. # log_shipping = {
  139. # enabled = true
  140. # manager_address = "siem.example.com"
  141. # manager_port = 1514 # must match the wazuh-agent logging_servers port in stack 20
  142. # enroll_port = 1515 # must match the wazuh-enroll logging_servers port in stack 20
  143. # agent_name_prefix = "site-tor1"
  144. # agent_group = "site-tor1"
  145. # apt_key_fingerprint = "<40 uppercase hex characters>"
  146. # agent_version = "4.9.2-1" # match the manager; an agent newer than the manager is unsupported
  147. # }
  148. log_shipping = {}
  149. # Which connectors get log_shipping (a, b or both). Default both.
  150. log_shipping_instances = ["a", "b"]
  151. # The short-lived, read-only Doppler token for the config cah-<resource_key>-hostboot.
  152. # NEVER put the real token here: a value file is a plain file. Set it as the
  153. # sensitive Spacelift stack environment variable TF_VAR_log_shipping_bootstrap_token
  154. # when you enable log_shipping, and revoke it after the first boot. Empty, the
  155. # default, is the live state.
  156. log_shipping_bootstrap_token = ""
  157. # A label for telemetry only (empty means "site-<region>"). It appears in no
  158. # resource name, tag or output, and changing it replaces nothing.
  159. site_name = "site-tor1"
  160. }
  161. run "the_example_values_are_valid" {
  162. command = plan
  163. }