From d0b27de5fcf4f493d97d12ad195a29c6d07c9e30 Mon Sep 17 00:00:00 2001 From: nitrocode <7775707+nitrocode@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:03:46 -0500 Subject: [PATCH] chore: consolidate examples Signed-off-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- examples/complete/README.md | 1 + examples/complete/main.tf | 8 ++++ examples/complete/providers.tf | 9 +++++ examples/complete/variables.tf | 29 ++++++++++++++ examples/complete/versions.tf | 22 +++++++++++ examples/nonprod/README.md | 1 - examples/nonprod/main.tf | 3 -- examples/nonprod/terraform.tf | 38 ------------------ examples/organizations/README.md | 1 - examples/organizations/main.tf | 15 -------- examples/organizations/terraform.tf | 60 ----------------------------- examples/prod/README.md | 1 - examples/prod/main.tf | 9 ----- examples/prod/terraform.tf | 38 ------------------ 14 files changed, 69 insertions(+), 166 deletions(-) create mode 100644 examples/complete/README.md create mode 100644 examples/complete/main.tf create mode 100644 examples/complete/providers.tf create mode 100644 examples/complete/variables.tf create mode 100644 examples/complete/versions.tf delete mode 100644 examples/nonprod/README.md delete mode 100644 examples/nonprod/main.tf delete mode 100644 examples/nonprod/terraform.tf delete mode 100644 examples/organizations/README.md delete mode 100644 examples/organizations/main.tf delete mode 100644 examples/organizations/terraform.tf delete mode 100644 examples/prod/README.md delete mode 100644 examples/prod/main.tf delete mode 100644 examples/prod/terraform.tf diff --git a/examples/complete/README.md b/examples/complete/README.md new file mode 100644 index 00000000..c135ddf9 --- /dev/null +++ b/examples/complete/README.md @@ -0,0 +1 @@ +# Example deployment diff --git a/examples/complete/main.tf b/examples/complete/main.tf new file mode 100644 index 00000000..85186641 --- /dev/null +++ b/examples/complete/main.tf @@ -0,0 +1,8 @@ +module "domain_protect" { + source = "../../" + + scan_schedule = var.scan_schedule + update_schedule = var.update_schedule + ip_scan_schedule = var.ip_scan_schedule + takeover = var.takeover +} diff --git a/examples/complete/providers.tf b/examples/complete/providers.tf new file mode 100644 index 00000000..824d38fb --- /dev/null +++ b/examples/complete/providers.tf @@ -0,0 +1,9 @@ +provider "aws" { + default_tags { + tags = var.tags + } +} + +provider "archive" {} +provider "null" {} +provider "random" {} \ No newline at end of file diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf new file mode 100644 index 00000000..f016288d --- /dev/null +++ b/examples/complete/variables.tf @@ -0,0 +1,29 @@ +variable "scan_schedule" { + description = "schedule for running domain-protect scans, e.g. 24 hours" + default = "24 hours" + type = string +} + +variable "update_schedule" { + description = "schedule for running domain-protect update function, e.g. 24 hours" + default = "24 hours" + type = string +} + +variable "ip_scan_schedule" { + description = "schedule for IP address scanning used in A record checks" + default = "24 hours" + type = string +} + +variable "takeover" { + description = "Create supported resource types to prevent malicious subdomain takeover" + default = false + type = bool +} + +variable "tags" { + description = "Tags to apply to resources" + type = map(string) + default = {} +} \ No newline at end of file diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf new file mode 100644 index 00000000..a6a9d305 --- /dev/null +++ b/examples/complete/versions.tf @@ -0,0 +1,22 @@ +terraform { + required_version = "> 1" + + required_providers { + aws = { + source = "hashicorp/aws" + version = "> 5.12.0" + } + archive = { + source = "hashicorp/archive" + version = "> 2.2.0" + } + null = { + source = "hashicorp/null" + version = "> 3.1.0" + } + random = { + source = "hashicorp/random" + version = "> 3.1.0" + } + } +} diff --git a/examples/nonprod/README.md b/examples/nonprod/README.md deleted file mode 100644 index b66f04fa..00000000 --- a/examples/nonprod/README.md +++ /dev/null @@ -1 +0,0 @@ -# Example deployment to a nonprod environment diff --git a/examples/nonprod/main.tf b/examples/nonprod/main.tf deleted file mode 100644 index 2bfaa2f0..00000000 --- a/examples/nonprod/main.tf +++ /dev/null @@ -1,3 +0,0 @@ -module "domain_protect" { - source = "../../" -} diff --git a/examples/nonprod/terraform.tf b/examples/nonprod/terraform.tf deleted file mode 100644 index aa40eb43..00000000 --- a/examples/nonprod/terraform.tf +++ /dev/null @@ -1,38 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.12.0" - } - - archive = { - source = "hashicorp/archive" - version = "~> 2.2.0" - } - - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - - random = { - source = "hashicorp/random" - version = "~> 3.1.0" - } - } -} - -provider "aws" { - default_tags { - tags = { - "service" = "domain-protect" - "owner" = "security" - "environment" = "nonprod" - "managed_by" = "terraform" - } - } -} - -provider "archive" {} -provider "null" {} -provider "random" {} diff --git a/examples/organizations/README.md b/examples/organizations/README.md deleted file mode 100644 index 3bcfd73d..00000000 --- a/examples/organizations/README.md +++ /dev/null @@ -1 +0,0 @@ -# Example deployment to a prod environment using AWS Organizations diff --git a/examples/organizations/main.tf b/examples/organizations/main.tf deleted file mode 100644 index e41e9130..00000000 --- a/examples/organizations/main.tf +++ /dev/null @@ -1,15 +0,0 @@ -module "domain_protect" { - source = "../../" - - scan_schedule = "60 minutes" - update_schedule = "3 hours" - ip_scan_schedule = "24 hours" - - takeover = true -} - -resource "aws_iam_role" "domain_protect_org_role" { - provider = aws.org - - assume_role_policy = "UPDATE FROM DOCS" -} diff --git a/examples/organizations/terraform.tf b/examples/organizations/terraform.tf deleted file mode 100644 index 9eb38163..00000000 --- a/examples/organizations/terraform.tf +++ /dev/null @@ -1,60 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.12.0" - } - - archive = { - source = "hashicorp/archive" - version = "~> 2.2.0" - } - - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - - random = { - source = "hashicorp/random" - version = "~> 3.1.0" - } - } -} - -provider "aws" { - - assume_role { - role_arn = "arn:aws:iam::1234567890:role/OrgRole" - } - - default_tags { - tags = { - "service" = "domain-protect" - "owner" = "security" - "environment" = "nonprod" - "managed_by" = "terraform" - } - } -} - -provider "aws" { - alias = "org" - - assume_role { - role_arn = "arn:aws:iam::1234567890:role/OrgRole" - } - - default_tags { - tags = { - "service" = "domain-protect" - "owner" = "security" - "environment" = "prod" - "managed_by" = "terraform" - } - } -} - -provider "archive" {} -provider "null" {} -provider "random" {} diff --git a/examples/prod/README.md b/examples/prod/README.md deleted file mode 100644 index a18b4afb..00000000 --- a/examples/prod/README.md +++ /dev/null @@ -1 +0,0 @@ -# Example deployment to a prod environment diff --git a/examples/prod/main.tf b/examples/prod/main.tf deleted file mode 100644 index a98994c6..00000000 --- a/examples/prod/main.tf +++ /dev/null @@ -1,9 +0,0 @@ -module "domain_protect" { - source = "../../" - - scan_schedule = "60 minutes" - update_schedule = "3 hours" - ip_scan_schedule = "24 hours" - - takeover = true -} diff --git a/examples/prod/terraform.tf b/examples/prod/terraform.tf deleted file mode 100644 index 30170061..00000000 --- a/examples/prod/terraform.tf +++ /dev/null @@ -1,38 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.12.0" - } - - archive = { - source = "hashicorp/archive" - version = "~> 2.2.0" - } - - null = { - source = "hashicorp/null" - version = "~> 3.1.0" - } - - random = { - source = "hashicorp/random" - version = "~> 3.1.0" - } - } -} - -provider "aws" { - default_tags { - tags = { - "service" = "domain-protect" - "owner" = "security" - "environment" = "prod" - "managed_by" = "terraform" - } - } -} - -provider "archive" {} -provider "null" {} -provider "random" {}