UPD: added examples directory and updated several modules
This commit is contained in:
parent
0bd23ee8ba
commit
aaf99335bd
7
examples/baseline-resources/README.md
Normal file
7
examples/baseline-resources/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Root module for creating baseline resources including:
|
||||
- iam password policy
|
||||
- delete default VPCs in all region
|
||||
- create cloudtrail
|
||||
- enable aws config in all region
|
||||
- enable guardduty
|
||||
- enable securityhub
|
38
examples/baseline-resources/main.tf
Normal file
38
examples/baseline-resources/main.tf
Normal file
@ -0,0 +1,38 @@
|
||||
module "iam-baseline" {
|
||||
# iam password policy, baseline roles, access analyzer, cloudhealth role
|
||||
source = "../../modules/security_identity_compliance/roles_iam_resources"
|
||||
|
||||
customer-name = var.customer-name
|
||||
default-tags = local.default-tags
|
||||
create-cloudhealth-resources = false
|
||||
}
|
||||
|
||||
module "cloudtrail" {
|
||||
# Create cloudtrail
|
||||
source = "../../modules/security_identity_compliance/cloudtrail_cwlogs"
|
||||
resource-prefix = local.resource-prefix
|
||||
default-tags = local.default-tags
|
||||
}
|
||||
|
||||
module "delete-default-vpcs" {
|
||||
# delete default VPCs in all regions
|
||||
source = "../../modules/networking/delete-default-vpcs"
|
||||
}
|
||||
|
||||
module "enable-aws-config" {
|
||||
# enable aws config in all regions
|
||||
source = "../../modules/security_identity_compliance/aws_config"
|
||||
resource-prefix = local.resource-prefix
|
||||
default-tags = local.default-tags
|
||||
}
|
||||
|
||||
module "enable-guardduty" {
|
||||
# enable guardduty
|
||||
source = "../../modules/security_identity_compliance/guardduty"
|
||||
default-tags = local.default-tags
|
||||
}
|
||||
|
||||
module "enable-securityhub" {
|
||||
# enable security hub
|
||||
source = "../../modules/security_identity_compliance/security_hub"
|
||||
}
|
13
examples/baseline-resources/provider.tf
Normal file
13
examples/baseline-resources/provider.tf
Normal file
@ -0,0 +1,13 @@
|
||||
provider "aws" {
|
||||
region = var.aws-region
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_version = "~> 1.2.5"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 3.75.2"
|
||||
}
|
||||
}
|
||||
}
|
5
examples/baseline-resources/terraform.tfvars
Normal file
5
examples/baseline-resources/terraform.tfvars
Normal file
@ -0,0 +1,5 @@
|
||||
aws-region = "ap-southeast-1"
|
||||
customer-name = "ken2026"
|
||||
environment = "lab"
|
||||
project = "terraform-dev"
|
||||
application = "infra"
|
19
examples/baseline-resources/variables.tf
Normal file
19
examples/baseline-resources/variables.tf
Normal file
@ -0,0 +1,19 @@
|
||||
variable "aws-region" {}
|
||||
variable "customer-name" {}
|
||||
variable "environment" {}
|
||||
variable "project" {}
|
||||
variable "application" {}
|
||||
|
||||
locals {
|
||||
default-tags = {
|
||||
ServiceProvider = "RackspaceTechnology"
|
||||
Environment = var.environment
|
||||
Project = var.project
|
||||
Application = var.application
|
||||
TerraformMode = "managed"
|
||||
TerraformDir = trimprefix(path.cwd, "/my/work/xpk-git/")
|
||||
BuildDate = formatdate("YYYYMMDD", timestamp())
|
||||
}
|
||||
resource-prefix = "${var.environment}-substr(${var.aws-region},0,2)-${var.customer-name}-${var.project}"
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
variable region-name {}
|
13
modules/security_identity_compliance/security_hub/main.tf
Normal file
13
modules/security_identity_compliance/security_hub/main.tf
Normal file
@ -0,0 +1,13 @@
|
||||
data aws_region this-region {}
|
||||
|
||||
resource "aws_securityhub_account" "sh-account" {}
|
||||
|
||||
resource "aws_securityhub_standards_subscription" "cis" {
|
||||
depends_on = [aws_securityhub_account.sh-account]
|
||||
standards_arn = "arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0"
|
||||
}
|
||||
|
||||
resource "aws_securityhub_standards_subscription" "aws" {
|
||||
depends_on = [aws_securityhub_account.sh-account]
|
||||
standards_arn = "arn:aws:securityhub:${data.aws_region.this-region.name}::standards/aws-foundational-security-best-practices/v/1.0.0"
|
||||
}
|
Loading…
Reference in New Issue
Block a user