-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Terraform module example update (#17466)
- Loading branch information
Showing
6 changed files
with
411 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,40 @@ | ||
# Fleet Terraform Module Example | ||
This code provides some example usage of the Fleet Terraform module, including how some addons can be used to extend functionality. | ||
This code provides some example usage of the Fleet Terraform module, including how some addons can be used to extend functionality. Prior to applying, edit the locals in `main.tf` to match the settings you want for your Fleet instance including: | ||
|
||
- domain name | ||
- route53 zone name (may match the domain name) | ||
- license key (if premium) | ||
- uncommenting the mdm module if mdm is desired | ||
- any extra settings to be passed to Fleet via ENV var. | ||
|
||
Due to Terraform issues, this code requires 3 applies "from scratch": | ||
1. `terraform apply -target module.fleet.module.vpc` | ||
2. `terraform apply -target module.fleet` | ||
3. `terraform apply` | ||
2. `terraform apply -target module.osquery-carve -target module.firehose-logging` | ||
3. If enabling mdm: `terraform apply -target module.mdm`. It will need to be uncommented as well as the KMS section below it. | ||
4. `terraform apply -target module.fleet` | ||
5. `terraform apply` | ||
6. If enabling mdm do the following: | ||
- Record the KMS key from step 5 output. | ||
- Use `fleetctl` to obtain all of the mdm certs. Use https://fleetdm.com/docs/using-fleet/mdm-macos-setup#apple-push-notification-service-apns and https://fleetdm.com/docs/using-fleet/mdm-macos-setup#apple-business-manager-abm for reference. | ||
- Place the certificates in the `resources` folder with the following names based upon their function: | ||
``` | ||
scep.crt | ||
scep.key | ||
apns.crt | ||
apns.key | ||
abm.crt | ||
abm.key | ||
abm_token.p7m | ||
``` | ||
- Using the `encrypt.sh` script, KMS encrypt all of these secrets as follows: | ||
``` | ||
cd resources | ||
for i in *; do ../scripts/encrypt.sh <kms-key-id-from-terraform-output> $i $i.encrypted; done | ||
for i in *.encrypted; do rm ${i/.encrypted/}; done | ||
``` | ||
This will encrypt all of the mdm secrets and add the .encrypted extension to them. It will also remove the non-encrypted version of the secrets so that they are encrypted at rest even locally. | ||
|
||
- Uncomment all of the resources and data sources in `mdm-secrets.tf`. | ||
- Re-run `terraform apply` to populate the Secrets Manager secrets. | ||
- Uncomment the sections in the `fleet_config` portion of `main.tf` for mdm and run a final `terraform apply`. Services will restart with mdm enabled. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.