Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright IBM Corp. 2022, 2023
Copyright IBM Corp. 2022, 2026

Mozilla Public License Version 2.0
==================================
Expand Down
2 changes: 2 additions & 0 deletions accesskey-with-pgp/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

resource "aws_iam_access_key" "roger" {
user = "roger"
pgp_key = "keybase:roger"
Expand Down
2 changes: 2 additions & 0 deletions accesskey-without-pgp/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

resource "aws_iam_access_key" "roger" {
user = "roger"
}
2 changes: 2 additions & 0 deletions acm-certs/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

variable "domain_1" {
description = "domain of first Amazon Certificate Manager certificate"
}
Expand Down
2 changes: 2 additions & 0 deletions azure-modules-test/azure.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Copyright IBM Corp. 2022, 2026

windows_dns_prefix = "rogerberlind-win"
2 changes: 2 additions & 0 deletions azure-modules-test/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform {
required_version = ">= 0.11.11"
}
Expand Down
2 changes: 2 additions & 0 deletions fake-modules-sentinel/check-module-versions.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "tfconfig"

# Require all modules directly under root module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
2 changes: 2 additions & 0 deletions gcp-instance/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

variable "gcp_project" {
description = "GCP project name"
}
Expand Down
2 changes: 2 additions & 0 deletions lists-and-maps/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

# This is used to illustrate referencing lists and maps in Sentinel

# ttl variable
Expand Down
2 changes: 2 additions & 0 deletions mocks/mock-tfplan-require-access-keys-use-pgp.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
2 changes: 2 additions & 0 deletions mocks/mock-tfplan-restrict-gcp-instance-image.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
2 changes: 2 additions & 0 deletions mocks/mock-tfplan-restrict-vault-auth-methods.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
2 changes: 2 additions & 0 deletions mocks/mock-tfstate-restrict-acm-certificate-domains.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
2 changes: 2 additions & 0 deletions require-modules-from-pmr/require-modules-from-pmr.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "tfconfig"
import "strings"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Functions that use the tfconfig import to restrict modules

# Copyright IBM Corp. 2022, 2026

##### Imports #####
import "tfconfig/v2" as tfconfig
import "strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Common functions that use the tfplan/v2 import

# Copyright IBM Corp. 2022, 2026

# The filter functions all accept a collection of resource changes, an attribute,
# a value or a list of values, and a boolean, prtmsg, which can be true or false
# and indicates whether the filter function should print violation messages.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Common functions that use the tfstate/v2 import

# Copyright IBM Corp. 2022, 2026

# The filter functions all accept a collection of resources, an attribute,
# a value or a list of values, and a boolean, prtmsg, which can be true or false
# and indicates whether the filter function should print violation messages.
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/original-policies.sentinel.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

## Exercise 1

# restrict-vault-auth-methods.sentinel
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/prevent-auto-apply-in-production.sentinel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This policy uses the Sentinel tfrun import to prevent the use of auto-apply
# in workspaces with names matching "^prod-(.*)" or "(.*)-prod$"

# Copyright IBM Corp. 2022, 2026

##### Imports #####

import "tfrun"
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/require-access-keys-use-pgp-a.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This policy requires AWS IAM access keys to use PGP keys

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/require-access-keys-use-pgp-b.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This policy requires AWS IAM access keys to use PGP keys

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/require-even-number.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# A policy that requires an integer to be even

# Copyright IBM Corp. 2022, 2026

# A parameter that must be set to an integer.
param the_number default 1

Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/require-modules-from-pmr-a.sentinel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# root module are in the Private Module Registry (PMR) of a TFC
# organization.

# Copyright IBM Corp. 2022, 2026

# Import the v2 tfplan import, but use the alias "tfplan"
import "tfconfig/v2" as tfconfig

Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/require-modules-from-pmr-b.sentinel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# root module are in the Private Module Registry (PMR) of a TFC
# organization.

# Copyright IBM Corp. 2022, 2026

# Import common-functions/module-functions/module-functions.sentinel
# as "modules"
import "module-functions" as modules
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/restrict-acm-certificate-domains-a.sentinel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This policy uses the tfstate import to restrict ACM certificates
# to have domains that are sub-domains of hashidemos.io

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfstate-functions/tfstate-functions.sentinel
# with alias "state"
import "tfstate-functions" as state
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/restrict-acm-certificate-domains-b.sentinel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This policy uses the tfstate import to restrict ACM certificates
# to have domains that are sub-domains of hashidemos.io

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfstate-functions/tfstate-functions.sentinel
# with alias "state"
import "tfstate-functions" as state
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/restrict-gcp-instance-image-a.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This policy restricts the public images that GCP compute instances use

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/restrict-gcp-instance-image-b.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This policy restricts the public images that GCP compute instances use

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/restrict-vault-auth-methods.sentinel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This policy restricts which Vault auth methods can be created

# Copyright IBM Corp. 2022, 2026

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/sentinel.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "./common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

mock "tfrun" {
module {
source = "mock-tfrun-fail-prefix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

mock "tfrun" {
module {
source = "mock-tfrun-fail-suffix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

mock "tfrun" {
module {
source = "mock-tfrun-pass-prefix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

mock "tfrun" {
module {
source = "mock-tfrun-pass-suffix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.24"

planned_values = {
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/test/require-access-keys-use-pgp-a/pass.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

terraform_version = "0.12.24"

planned_values = {
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/test/require-access-keys-use-pgp-b/pass.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
2 changes: 2 additions & 0 deletions sentinel-policies/test/require-even-number/fail.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright IBM Corp. 2022, 2026

param "the_number" {
value = 5
}
Expand Down
Loading