-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from confusdcodr/kms_toggle
Add explicit create_kms_key toggle
- Loading branch information
Showing
12 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
[bumpversion] | ||
current_version = 2.2.3 | ||
current_version = 3.0.0 | ||
commit = True | ||
message = Bumps version to {new_version} | ||
tag = False | ||
tag_name = {new_version} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Premade KMS Key Test | ||
|
||
|
||
<!-- BEGIN TFDOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >= 0.12 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| aws | n/a | | ||
| template | n/a | | ||
| terraform | n/a | | ||
|
||
## Inputs | ||
|
||
No input. | ||
|
||
## Outputs | ||
|
||
No output. | ||
|
||
<!-- END TFDOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
data "terraform_remote_state" "prereq" { | ||
backend = "local" | ||
config = { | ||
path = "prereq/terraform.tfstate" | ||
} | ||
} | ||
|
||
resource "aws_kms_key" "this" { | ||
policy = join("", data.template_file.kms_policy.*.rendered) | ||
} | ||
|
||
data "template_file" "kms_policy" { | ||
template = file("${path.module}/../templates/cloudtrail-kms-key-policy.json") | ||
|
||
vars = { | ||
account_id = data.aws_caller_identity.current.account_id | ||
} | ||
} | ||
|
||
module "cocreate_kms_key" { | ||
source = "../../" | ||
|
||
providers = { | ||
aws = aws | ||
} | ||
|
||
create_cloudtrail = true | ||
create_kms_key = true | ||
cloudtrail_name = data.terraform_remote_state.prereq.outputs.random_name | ||
cloudtrail_bucket = data.terraform_remote_state.prereq.outputs.bucket_id | ||
kms_key_id = aws_kms_key.this.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
locals { | ||
partition = "aws" | ||
} | ||
|
||
data "aws_caller_identity" "current" {} | ||
|
||
resource "random_id" "name" { | ||
byte_length = 6 | ||
prefix = "tardigrade-cloudtrail-" | ||
} | ||
|
||
resource "aws_s3_bucket" "this" { | ||
bucket = random_id.name.hex | ||
policy = join("", data.template_file.this.*.rendered) | ||
force_destroy = true | ||
} | ||
|
||
data "template_file" "this" { | ||
template = file("${path.module}/../../templates/cloudtrail-bucket-policy.json") | ||
|
||
vars = { | ||
bucket = random_id.name.hex | ||
partition = local.partition | ||
} | ||
} | ||
|
||
output "random_name" { | ||
value = random_id.name.hex | ||
} | ||
|
||
output "bucket_id" { | ||
value = aws_s3_bucket.this.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
terraform { | ||
required_version = ">= 0.12" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ module "no_cloudtrail" { | |
} | ||
|
||
create_cloudtrail = false | ||
create_kms_key = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters