Skip to content

Commit ebdf3dd

Browse files
author
Abdul Wahid
authored
Add new feature - 'bypass_policy_lockout_safety_check' (#4)
* Set provider limit (#5) * Add new parameter 'bypass_policy_lockout_safety_check'
1 parent 567d2b9 commit ebdf3dd

File tree

7 files changed

+80
-37
lines changed

7 files changed

+80
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ override.tf.json
2727

2828
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2929
# example: *tfplan*
30+
*.vscode

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.3.0
3+
rev: v4.0.1
44
hooks:
55
- id: check-added-large-files
66
args: ['--maxkb=500']
@@ -18,7 +18,7 @@ repos:
1818
args: ['--allow-missing-credentials']
1919
- id: trailing-whitespace
2020
- repo: git://github.com/antonbabenko/pre-commit-terraform
21-
rev: v1.44.0
21+
rev: v1.50.0
2222
hooks:
2323
- id: terraform_fmt
2424
- id: terraform_docs

CHANGELOG.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,26 @@ All notable changes to this project will be documented in this file.
55
<a name="unreleased"></a>
66
## [Unreleased]
77

8-
- Update module versions to support v3 provider
8+
- Add new parameter 'bypass_policy_lockout_safety_check'
9+
10+
11+
<a name="1.0.3"></a>
12+
## [1.0.3] - 2021-08-17
13+
14+
- Set provider limit ([#5](https://github.com/umotif-public/terraform-aws-kms/issues/5))
15+
- Update README.md
16+
17+
18+
<a name="1.0.2"></a>
19+
## [1.0.2] - 2020-11-09
20+
21+
- Update module to remove terraform 0.14 limit ([#3](https://github.com/umotif-public/terraform-aws-kms/issues/3))
22+
23+
24+
<a name="1.0.1"></a>
25+
## [1.0.1] - 2020-08-05
26+
27+
- Feature/v3 provider support ([#2](https://github.com/umotif-public/terraform-aws-kms/issues/2))
928
- Feature/updates ([#1](https://github.com/umotif-public/terraform-aws-kms/issues/1))
1029

1130

@@ -18,4 +37,7 @@ All notable changes to this project will be documented in this file.
1837
- Initial commit
1938

2039

21-
[Unreleased]: https://github.com/umotif-public/terraform-aws-kms/compare/1.0.0...HEAD
40+
[Unreleased]: https://github.com/umotif-public/terraform-aws-kms/compare/1.0.3...HEAD
41+
[1.0.3]: https://github.com/umotif-public/terraform-aws-kms/compare/1.0.2...1.0.3
42+
[1.0.2]: https://github.com/umotif-public/terraform-aws-kms/compare/1.0.1...1.0.2
43+
[1.0.1]: https://github.com/umotif-public/terraform-aws-kms/compare/1.0.0...1.0.1

README.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/umotif-public/terraform-aws-kms?style=social)
1+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/umotif-public/terraform-aws-kms)](https://github.com/umotif-public/terraform-aws-kms/releases/latest)
22

33
# terraform-aws-kms
44

55
Terraform module to configure a KMS Customer Master Key (CMK) and its alias.
66

77
## Terraform versions
88

9-
Terraform 0.12. Pin module version to `~> v1.0`. Submit pull-requests to `master` branch.
9+
Terraform 0.12 and provider version < 3.53.0. Pin module version to `~> v1.0`.
10+
For Terraform 0.12 with provider version >= 3.53.0. Pin module version to `~> v2.0`. Submit pull-requests to `main` branch.
1011

1112
## Usage
1213

1314
```hcl
1415
module "kms" {
1516
source = "umotif-public/kms/aws"
16-
version = "~> 1.0.0"
17+
version = "~> 2.0.0"
1718
1819
enabled = true
1920
description = "KMS test description"
@@ -33,50 +34,63 @@ Module is to be used with Terraform > 0.12.
3334

3435
## Examples
3536

36-
* [KMS](https://github.com/umotif-public/terraform-aws-kms/tree/master/examples/core)
37+
* [KMS](https://github.com/umotif-public/terraform-aws-kms/tree/main/examples/core)
3738

3839
## Authors
3940

40-
Module managed by [Marcin Cuber](https://github.com/marcincuber) [LinkedIn](https://www.linkedin.com/in/marcincuber/).
41+
Module managed by [Marcin Cuber](https://github.com/marcincuber) ([LinkedIn](https://www.linkedin.com/in/marcincuber/)).\
42+
Module managed by [Abdul Wahid](https://github.com/Ohid25) ([LinkedIn](https://www.linkedin.com/in/abdul-wahid/)).\
43+
Module managed by [Sean Pascual](https://github.com/seanpascual) ([LinkedIn](https://www.linkedin.com/in/sean-edward-pascual/)).
4144

4245
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4346
## Requirements
4447

4548
| Name | Version |
4649
|------|---------|
47-
| terraform | >= 0.12.6 |
48-
| aws | >= 2.41 |
50+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.31 |
51+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.53.0 |
4952

5053
## Providers
5154

5255
| Name | Version |
5356
|------|---------|
54-
| aws | >= 2.41 |
57+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.53.0 |
58+
59+
## Modules
60+
61+
No modules.
62+
63+
## Resources
64+
65+
| Name | Type |
66+
|------|------|
67+
| [aws_kms_alias.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource |
68+
| [aws_kms_key.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
5569

5670
## Inputs
5771

5872
| Name | Description | Type | Default | Required |
5973
|------|-------------|------|---------|:--------:|
60-
| alias\_name | The display name of the alias. | `string` | n/a | yes |
61-
| customer\_master\_key\_spec | Specifies whether the key contains a symmetric key or an asymmetric key pair and the encryption algorithms or signing algorithms that the key supports. Valid values: SYMMETRIC\_DEFAULT, RSA\_2048, RSA\_3072, RSA\_4096, ECC\_NIST\_P256, ECC\_NIST\_P384, ECC\_NIST\_P521, or ECC\_SECG\_P256K1. Defaults to SYMMETRIC\_DEFAULT. | `string` | `"SYMMETRIC_DEFAULT"` | no |
62-
| deletion\_window\_in\_days | Duration in days after which the key is deleted after destruction of the resource. | `number` | `10` | no |
63-
| description | The description of the key as viewed in AWS console. | `string` | `"Parameter Store KMS master key"` | no |
64-
| enable\_key\_rotation | Specifies whether key rotation is enabled. | `bool` | `true` | no |
65-
| enabled | Specifies whether to create resources within this module. | `bool` | `true` | no |
66-
| is\_enabled | Specifies whether the key is enabled. | `bool` | `true` | no |
67-
| key\_usage | Specifies the intended use of the key. Defaults to ENCRYPT\_DECRYPT, and only symmetric encryption and decryption are supported. | `string` | `"ENCRYPT_DECRYPT"` | no |
68-
| policy | A valid policy JSON document. For more information about building AWS IAM policy documents with Terraform. | `string` | `""` | no |
69-
| tags | Mapping of additional tags. | `map(string)` | `{}` | no |
74+
| <a name="input_alias_name"></a> [alias\_name](#input\_alias\_name) | The display name of the alias. | `string` | n/a | yes |
75+
| <a name="input_bypass_policy_lockout_safety_check"></a> [bypass\_policy\_lockout\_safety\_check](#input\_bypass\_policy\_lockout\_safety\_check) | Specifies whether to disable the policy lockout check performed when creating or updating the key's policy. | `bool` | `false` | no |
76+
| <a name="input_customer_master_key_spec"></a> [customer\_master\_key\_spec](#input\_customer\_master\_key\_spec) | Specifies whether the key contains a symmetric key or an asymmetric key pair and the encryption algorithms or signing algorithms that the key supports. Valid values: SYMMETRIC\_DEFAULT, RSA\_2048, RSA\_3072, RSA\_4096, ECC\_NIST\_P256, ECC\_NIST\_P384, ECC\_NIST\_P521, or ECC\_SECG\_P256K1. Defaults to SYMMETRIC\_DEFAULT. | `string` | `"SYMMETRIC_DEFAULT"` | no |
77+
| <a name="input_deletion_window_in_days"></a> [deletion\_window\_in\_days](#input\_deletion\_window\_in\_days) | Duration in days after which the key is deleted after destruction of the resource. | `number` | `10` | no |
78+
| <a name="input_description"></a> [description](#input\_description) | The description of the key as viewed in AWS console. | `string` | `"Parameter Store KMS master key"` | no |
79+
| <a name="input_enable_key_rotation"></a> [enable\_key\_rotation](#input\_enable\_key\_rotation) | Specifies whether key rotation is enabled. | `bool` | `true` | no |
80+
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Specifies whether to create resources within this module. | `bool` | `true` | no |
81+
| <a name="input_is_enabled"></a> [is\_enabled](#input\_is\_enabled) | Specifies whether the key is enabled. | `bool` | `true` | no |
82+
| <a name="input_key_usage"></a> [key\_usage](#input\_key\_usage) | Specifies the intended use of the key. Defaults to ENCRYPT\_DECRYPT, and only symmetric encryption and decryption are supported. | `string` | `"ENCRYPT_DECRYPT"` | no |
83+
| <a name="input_policy"></a> [policy](#input\_policy) | A valid policy JSON document. For more information about building AWS IAM policy documents with Terraform. | `string` | `""` | no |
84+
| <a name="input_tags"></a> [tags](#input\_tags) | Mapping of additional tags. | `map(string)` | `{}` | no |
7085

7186
## Outputs
7287

7388
| Name | Description |
7489
|------|-------------|
75-
| alias\_arn | KMS Key Alias ARN. |
76-
| alias\_name | KMS Key Alias name. |
77-
| key\_arn | KMS Key ARN. |
78-
| key\_id | KMS Key ID. |
79-
90+
| <a name="output_alias_arn"></a> [alias\_arn](#output\_alias\_arn) | KMS Key Alias ARN. |
91+
| <a name="output_alias_name"></a> [alias\_name](#output\_alias\_name) | KMS Key Alias name. |
92+
| <a name="output_key_arn"></a> [key\_arn](#output\_key\_arn) | KMS Key ARN. |
93+
| <a name="output_key_id"></a> [key\_id](#output\_key\_id) | KMS Key ID. |
8094
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8195

8296
## License

main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
resource "aws_kms_key" "main" {
22
count = var.enabled ? 1 : 0
33

4-
description = var.description
5-
key_usage = var.key_usage
6-
customer_master_key_spec = var.customer_master_key_spec
7-
deletion_window_in_days = var.deletion_window_in_days
8-
is_enabled = var.is_enabled
9-
enable_key_rotation = var.enable_key_rotation
10-
policy = var.policy != "" ? var.policy : null
11-
tags = var.tags
4+
description = var.description
5+
key_usage = var.key_usage
6+
customer_master_key_spec = var.customer_master_key_spec
7+
deletion_window_in_days = var.deletion_window_in_days
8+
bypass_policy_lockout_safety_check = var.bypass_policy_lockout_safety_check
9+
is_enabled = var.is_enabled
10+
enable_key_rotation = var.enable_key_rotation
11+
policy = var.policy != "" ? var.policy : null
12+
tags = var.tags
1213
}
1314

1415
resource "aws_kms_alias" "main" {

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ variable "alias_name" {
5757
description = "The display name of the alias."
5858
}
5959

60+
variable "bypass_policy_lockout_safety_check" {
61+
type = bool
62+
default = false
63+
description = "Specifies whether to disable the policy lockout check performed when creating or updating the key's policy."
64+
}

versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
2-
required_version = ">= 0.12.6"
2+
required_version = ">= 0.12.31"
33

44
required_providers {
5-
aws = ">= 2.41"
5+
aws = ">= 3.53.0"
66
}
77
}

0 commit comments

Comments
 (0)