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
3 changes: 3 additions & 0 deletions accesskey-with-pgp/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resource "aws_iam_access_key" "roger" {
user = "roger"
pgp_key = "keybase:roger"
Expand Down
3 changes: 3 additions & 0 deletions accesskey-without-pgp/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resource "aws_iam_access_key" "roger" {
user = "roger"
}
3 changes: 3 additions & 0 deletions acm-certs/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "domain_1" {
description = "domain of first Amazon Certificate Manager certificate"
}
Expand Down
3 changes: 3 additions & 0 deletions azure-modules-test/azure.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

windows_dns_prefix = "rogerberlind-win"
3 changes: 3 additions & 0 deletions azure-modules-test/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform {
required_version = ">= 0.11.11"
}
Expand Down
3 changes: 3 additions & 0 deletions fake-modules-sentinel/check-module-versions.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "tfconfig"

# Require all modules directly under root module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

_root = {
"data": {},
"modules": {
Expand Down
3 changes: 3 additions & 0 deletions gcp-instance/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "gcp_project" {
description = "GCP project name"
}
Expand Down
3 changes: 3 additions & 0 deletions lists-and-maps/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# ttl variable
Expand Down
3 changes: 3 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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
3 changes: 3 additions & 0 deletions mocks/mock-tfplan-restrict-gcp-instance-image.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
3 changes: 3 additions & 0 deletions mocks/mock-tfplan-restrict-vault-auth-methods.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
3 changes: 3 additions & 0 deletions mocks/mock-tfstate-restrict-acm-certificate-domains.sentinel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

_root = {
"data": {},
"modules": {
Expand Down
3 changes: 3 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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "tfconfig"
import "strings"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

_root = {
"data": {},
"modules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# 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,8 @@
# Common functions that use the tfstate/v2 import

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# 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
3 changes: 3 additions & 0 deletions sentinel-policies/original-policies.sentinel.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

## Exercise 1

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

##### Imports #####

import "tfrun"
Expand Down
3 changes: 3 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,8 @@
# This policy requires AWS IAM access keys to use PGP keys

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
3 changes: 3 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,8 @@
# This policy requires AWS IAM access keys to use PGP keys

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

Expand Down
3 changes: 3 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,9 @@
# root module are in the Private Module Registry (PMR) of a TFC
# organization.

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

Expand Down
3 changes: 3 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,9 @@
# root module are in the Private Module Registry (PMR) of a TFC
# organization.

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Import common-functions/tfplan-functions/tfplan-functions.sentinel
# with alias "plan"
import "tfplan-functions" as plan
Expand Down
3 changes: 3 additions & 0 deletions sentinel-policies/sentinel.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

mock "tfrun" {
module {
source = "mock-tfrun-fail-prefix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

mock "tfrun" {
module {
source = "mock-tfrun-fail-suffix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

import "strings"
import "types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

mock "tfrun" {
module {
source = "mock-tfrun-pass-prefix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

mock "tfrun" {
module {
source = "mock-tfrun-pass-suffix.sentinel"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform_version = "0.12.3"

planned_values = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

terraform_version = "0.12.24"

planned_values = {
Expand Down
3 changes: 3 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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

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,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "tfplan-functions" {
source = "../../common-functions/tfplan-functions/tfplan-functions.sentinel"
}
Expand Down
Loading