Support for internal load balancer and deletion protection, iam policy attachment processing, osquery perf fix, and cloudfront software installers (#105)
# Main terraform - Modified iam `resource "aws_iam_role_policy_attachment" "extras"` from `for_each` to `count`, which allows terraform to apply even if roles are not yet created. In cases where role is not yet created, a second terraform apply is required for the resource to attach the policy. - Modified iam `resource "aws_iam_role_policy_attachment" "execution_extras"`, which allows terraform to apply even if roles are not yet created. In cases where role is not yet created, a second terraform apply is required for the resource to attach the policy. - Added support for internal load balancers to be provisioned. - Added support for toggling deletion protection on and off on the load balancer resource. # Example Module - Updated example module with changes alb changes. # Module: Cloudfront Software Installers - Added a count & tertiary to cloudfront software installer kms key policy, as it's fed in as an input. In cases where the key had not yet been created, apply would fail. - Modified `variable "s3_kms_key_id"` to allow default value `null` # Module: Logging Destination Firehose - Added prefix variable to support use-cases where multiple environments are deployed in the same account # Module: Osquery Perf - Added dependency on `data.aws_secretsmanager_secret_version.enroll_secret` to fix race condition.
This commit is contained in:
1 parent
1d8bd3007d
commit
ae8863ce64
22 files changed
+167
-191
No files matched your search
+34
-56
@@ -1,62 +1,40 @@
|
||||
# Note: Everything is commented out here as mdm is not enabled by default.
|
||||
# Uncomment to use.
|
||||
|
||||
# This section expects all kms-encrypted secrets to live in the resources/
|
||||
# subdirectory. The list of expected filenames is as follows:
|
||||
|
||||
locals {
|
||||
mdm_resource_path = "${path.module}/resources"
|
||||
scep_cert = "${local.mdm_resource_path}/scep.crt.encrypted"
|
||||
scep_key = "${local.mdm_resource_path}/scep.key.encrypted"
|
||||
resource "tls_private_key" "scep_key" {
|
||||
algorithm = "RSA"
|
||||
rsa_bits = 4096
|
||||
}
|
||||
|
||||
# To ease the process of encrypting and decrypting secrets, see
|
||||
# scripts/encrypt.sh and scripts/decrypt.sh
|
||||
resource "tls_self_signed_cert" "scep_cert" {
|
||||
private_key_pem = tls_private_key.scep_key.private_key_pem
|
||||
|
||||
# Place your non-encrypted files in the resources folder and
|
||||
# run the following:
|
||||
#
|
||||
# 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
|
||||
subject {
|
||||
common_name = "Fleet Root CA"
|
||||
organization = "Fleet."
|
||||
country = "US"
|
||||
}
|
||||
|
||||
# The SCEP challenge will be randomly generated by terraform. We do not
|
||||
# need to know what it is. For troubleshooting, it can always be found
|
||||
# in the SCEP secret in AWS. The SCEP cert is primarily used as the
|
||||
# Windows WSTEP cert at this point as the MAC scep is generated
|
||||
# automatically in the applicaton. The other MAC MDM secrets can now be
|
||||
# manged via the Fleet UI
|
||||
is_ca_certificate = true
|
||||
validity_period_hours = 87648
|
||||
|
||||
# resource "random_password" "challenge" {
|
||||
# length = 12
|
||||
# special = false
|
||||
# }
|
||||
#
|
||||
# resource "aws_secretsmanager_secret_version" "scep" {
|
||||
# secret_id = module.mdm.scep.id
|
||||
# secret_string = jsonencode(
|
||||
# {
|
||||
# FLEET_MDM_APPLE_SCEP_CERT_BYTES = data.aws_kms_secrets.scep_cert.plaintext["FLEET_MDM_APPLE_SCEP_CERT_BYTES"]
|
||||
# FLEET_MDM_APPLE_SCEP_KEY_BYTES = data.aws_kms_secrets.scep_key.plaintext["FLEET_MDM_APPLE_SCEP_KEY_BYTES"]
|
||||
# FLEET_MDM_APPLE_SCEP_CHALLENGE = random_password.challenge.result
|
||||
# }
|
||||
# )
|
||||
# }
|
||||
#
|
||||
#
|
||||
# data "aws_kms_secrets" "scep_cert" {
|
||||
# secret {
|
||||
# name = "FLEET_MDM_APPLE_SCEP_CERT_BYTES"
|
||||
# key_id = aws_kms_key.fleet_data_key.id
|
||||
# payload = file(local.scep_cert)
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# data "aws_kms_secrets" "scep_key" {
|
||||
# secret {
|
||||
# name = "FLEET_MDM_APPLE_SCEP_KEY_BYTES"
|
||||
# key_id = aws_kms_key.fleet_data_key.id
|
||||
# payload = file(local.scep_key)
|
||||
# }
|
||||
# }
|
||||
allowed_uses = [
|
||||
"cert_signing",
|
||||
"crl_signing",
|
||||
"key_encipherment",
|
||||
"digital_signature",
|
||||
]
|
||||
}
|
||||
|
||||
resource "random_password" "challenge" {
|
||||
length = 12
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "aws_secretsmanager_secret_version" "scep" {
|
||||
secret_id = module.mdm.scep.id
|
||||
secret_string = jsonencode(
|
||||
{
|
||||
FLEET_MDM_APPLE_SCEP_CERT_BYTES = tls_self_signed_cert.scep_cert.cert_pem
|
||||
FLEET_MDM_APPLE_SCEP_KEY_BYTES = tls_private_key.scep_key.private_key_pem
|
||||
FLEET_MDM_APPLE_SCEP_CHALLENGE = random_password.challenge.result
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user