fleet/infrastructure/loadtesting/terraform/osquery_perf
Jorge Falcon e952ef06c0
Loadtesting IAC updates (#32629)
# Github Actions (New)
- New workflow to deploy/destroy loadtest infrastructure with one-click
(Needs to be tested)
- Common inputs drive configuration and deployment of loadtest
infrastructure
    - tag
    - fleet_task_count
    - fleet_task_memory
    - fleet_task_cpu
    - fleet_database_instance_size
    - fleet_database_instance_count
    - fleet_redis_instance_size
    - fleet_redis_instance_count
    - terraform_workspace
    - terraform_action
- New workflow to deploy/destroy osquery-perf to loadtest infrastructure
with one-click (Needs to be tested)
- Common inputs drive configuration and deployment of osquery-perf
resources
    - tag
    - git_branch
    - loadtest_containers
    - extra_flags
    - terraform_workspace
    - terraform_action
- New workflow to deploy shared loadtest resources with one-click (Needs
to be tested)

# Loadtest Infrastructure (New)
- New directory (`infrastructure/loadtesting/terraform/infra`) for
one-click deployment
- Loadtest environment updated to use [fleet-terraform
modules](https://github.com/fleetdm/fleet-terraform)
- [Deployment documentation
updated](0c254bca40/infrastructure/loadtesting/terraform/infra/README.md)
to reflect new steps

# Osquery-perf deployment (New)
- New directory (`infrastructure/loadtesting/terraform/osquery-perf`)
for the deployment of osquery-perf
- osquery-perf updated to use [fleet-terraform
modules](https://github.com/fleetdm/fleet-terraform)
- [Deployment documentation
updated](0c254bca40/infrastructure/loadtesting/terraform/osquery_perf)
to reflect new steps
2025-10-08 15:31:37 -04:00
..
.header.md Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
.terraform-docs.yml Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
docker.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
locals.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
main.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
outputs.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
providers.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
README.md Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00
variables.tf Loadtesting IAC updates (#32629) 2025-10-08 15:31:37 -04:00

Deploy osquery perf to a Loadtest environment

Before we begin

Although deployments through the github action should be prioritized, for manual deployments you will need.

Deploy with Github Actions (Coming Soon)

  1. Navigate to the github action

  2. On the top right corner, select the Run Workflow dropdown.

  3. Fill out the details for the deployment.

  4. After all details have been filled out, you will hit the green Run Workflow button, directly under the inputs. For terraform_action select Plan, Apply, or Destroy.

    • Plan will show you the results of a dry-run
    • Apply will deploy changes to the environment
    • Destroy will destroy your environment

Deploy osquery perf manually

  1. Clone the repository

  2. Initialize terraform

    terraform init
    
  3. Create a new the terraform workspace or select an existing workspace for your environment. The terraform workspace will be used in different area's of Terraform to drive uniqueness and access to the environment.

    Note: The workspace from the infrastructure deployment will not be carried over to this deployment. A new or existing workspace, specifically for osquery perf must be used.

    Your workspace name must match the workspace name that was used for the infrastructure deployment. Failure to use a matching workspace name can lead to deployments in another environment.

    terraform workspace new <workspace_name>
    

    or, if your workspace already exists

    terraform workspace list
    terraform workspace select <workspace_name>
    
  4. Ensure that your new or existing workspace is in use.

    terraform workspace show
    
  5. Deploy the environment (will also trigger migrations automatically)

    Note: Terraform will prompt you for confirmation to trigger the deployment. If everything looks ok, submitting yes will trigger the deployment.

    terraform apply -var=tag=v4.73.0 -var=git_branch=fleet-v4.73.0
    

    or, you can add the additional supported terraform variables, to overwrite the default values. You can choose which ones are included/overwritten. If a variable is not defined, the default value configured in ./variables.tf is used.

    Below is an example with all available variables.

    terraform apply -var=tag=v4.73.0 -var=git_branch=fleet-v4.73.0 -var=loadtest_containers=20 -var=extra_flags=["--orbit_prob", "0.0"]
    

Destroy osquery perf manually

  1. Clone the repository (if not already cloned)

  2. Initialize terraform

    terraform init
    
  3. Select your workspace

    terraform workspace list
    terraform workspace select <workspace_name>
    
  4. Destroy the environment

    terraform destroy
    

Delete the workspace

Once all resources have been removed from the terraform workspace, remove the terraform workspace.

terraform workspace delete <workspace_name>

Requirements

Name Version
aws >= 5.68.0
docker ~> 2.16.0
git ~> 0.1.0

Providers

Name Version
aws 6.13.0
docker 2.16.0
git 0.1.0
terraform n/a

Modules

Name Source Version
osquery_perf github.com/fleetdm/fleet-terraform//addons/osquery-perf tf-mod-addon-osquery-perf-v1.2.0

Resources

Name Type
docker_registry_image.loadtest resource
aws_caller_identity.current data source
aws_ecr_authorization_token.token data source
aws_ecr_repository.fleet data source
aws_region.current data source
docker_registry_image.dockerhub data source
git_repository.tf data source
terraform_remote_state.infra data source
terraform_remote_state.shared data source

Inputs

Name Description Type Default Required
extra_flags Comma delimited list (string) for passing extra flags to osquery-perf containers list(string)
[
"--orbit_prob",
"0.0"
]
no
git_branch The git branch to use to build loadtest containers. Only needed if docker tag doesn't match the git branch string null no
loadtest_containers Number of loadtest containers to deploy number 1 no
tag The tag to deploy. This would be the same as the branch name string "" no

Outputs

Name Description
osquery_perf n/a