Post

IaC Security at Scale

IaC Security at Scale

Policy-as-Code Framework

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package terraform

deny[msg] {
input.resource_type == "aws_s3_bucket"
not input.config.acl
msg = "S3 buckets must have ACL explicitly set"
}

deny[msg] {
input.resource_type == "kubernetes_deployment"
input.config.spec.template.spec.containers[_].securityContext.privileged == true
msg = "Privileged containers are forbidden"
}

Secrets Management

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module "vault-integration" {
source = "hashicorp/vault/aws"

dynamic_secrets = {
database_creds = {
path = "database/creds/readonly"
ttl  = "1h"
}
}

terraform_provider_config = {
address = "https://vault.prod:8200"
token   = var.vault_token
}
}

This post is licensed under CC BY 4.0 by the author.