fleet/tools/terraform/tf/main.tf
Mike Yoder c7ea0125d6
Support for Terraforming Fleet Teams (#18750)
This project adds support for terraforming teams in Fleet. If you have
100+ teams, managing them is is prone to error, mistakes, lost
configuration, and general pain. An industry standard tool like
terraform can unify this configuration as code.

In order to do this, I wrote a terraform provider that on one end talks
to the Fleet api, and on the other end implements an interface for
terraform. More information is in the README.

A small sample `main.tf` file is supplied.

---------

Co-authored-by: Brock Walters <153771548+nonpunctual@users.noreply.github.com>
2024-06-20 12:47:35 -07:00

46 lines
1.1 KiB
HCL

terraform {
required_providers {
fleetdm = {
source = "fleetdm.com/tf/fleetdm"
}
}
}
provider "fleetdm" {
url = "https://something.cloud.fleetdm.com"
// apikey provided via FLEETDM_APIKEY
}
locals {
# Here are some default agent options.
default_agent_options = jsonencode(local.raw_agent_options)
raw_agent_options = {
"config" = {
"options" = {
pack_delimiter = "/"
logger_tls_period = 10
distributed_plugin = "tls"
disable_distributed = false
logger_tls_endpoint = "/api/osquery/log"
distributed_interval = 15
distributed_tls_max_attempts = 3
}
"decorators" = {
"load" = [
"SELECT uuid AS host_uuid FROM system_info;",
"SELECT hostname AS hostname FROM system_info;"
]
}
}
command_line_flags = {
disable_events = true
enable_bpf_events = false
}
}
}
resource "fleetdm_teams" "hello_world" {
name = "my_first_team"
description = "This is my first team"
agent_options = local.default_agent_options
}