Skip to content

Commit 2193a3c

Browse files
feat!: Upgrade AWS provider and min required Terraform version to 6.8 and 1.11 respectively (#12)
Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
1 parent 2c2de09 commit 2193a3c

File tree

11 files changed

+119
-107
lines changed

11 files changed

+119
-107
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ module "parameter" {
167167

168168
| Name | Version |
169169
|------|---------|
170-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
171-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.37 |
170+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
171+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
172172

173173
## Providers
174174

175175
| Name | Version |
176176
|------|---------|
177-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.37 |
177+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
178178

179179
## Modules
180180

@@ -191,19 +191,21 @@ No modules.
191191

192192
| Name | Description | Type | Default | Required |
193193
|------|-------------|------|---------|:--------:|
194-
| <a name="input_allowed_pattern"></a> [allowed\_pattern](#input\_allowed\_pattern) | Regular expression used to validate the parameter value. | `string` | `null` | no |
194+
| <a name="input_allowed_pattern"></a> [allowed\_pattern](#input\_allowed\_pattern) | Regular expression used to validate the parameter value | `string` | `null` | no |
195195
| <a name="input_create"></a> [create](#input\_create) | Whether to create SSM Parameter | `bool` | `true` | no |
196-
| <a name="input_data_type"></a> [data\_type](#input\_data\_type) | Data type of the parameter. Valid values: text, aws:ssm:integration and aws:ec2:image for AMI format. | `string` | `null` | no |
196+
| <a name="input_data_type"></a> [data\_type](#input\_data\_type) | Data type of the parameter. Valid values: `text`, `aws:ssm:integration` and `aws:ec2:image` for AMI format, see the [Native parameter support for Amazon Machine Image IDs](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html) | `string` | `null` | no |
197197
| <a name="input_description"></a> [description](#input\_description) | Description of the parameter | `string` | `null` | no |
198198
| <a name="input_ignore_value_changes"></a> [ignore\_value\_changes](#input\_ignore\_value\_changes) | Whether to create SSM Parameter and ignore changes in value | `bool` | `false` | no |
199-
| <a name="input_key_id"></a> [key\_id](#input\_key\_id) | KMS key ID or ARN for encrypting a parameter (when type is SecureString) | `string` | `null` | no |
200-
| <a name="input_name"></a> [name](#input\_name) | Name of SSM parameter | `string` | `null` | no |
201-
| <a name="input_overwrite"></a> [overwrite](#input\_overwrite) | Overwrite an existing parameter. If not specified, defaults to false during create operations to avoid overwriting existing resources and then true for all subsequent operations once the resource is managed by Terraform. Only relevant if ignore\_value\_changes is false. | `bool` | `false` | no |
202-
| <a name="input_secure_type"></a> [secure\_type](#input\_secure\_type) | Whether the type of the value should be considered as secure or not? | `bool` | `false` | no |
203-
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to resources | `map(string)` | `{}` | no |
204-
| <a name="input_tier"></a> [tier](#input\_tier) | Parameter tier to assign to the parameter. If not specified, will use the default parameter tier for the region. Valid tiers are Standard, Advanced, and Intelligent-Tiering. Downgrading an Advanced tier parameter to Standard will recreate the resource. | `string` | `null` | no |
205-
| <a name="input_type"></a> [type](#input\_type) | Type of the parameter. Valid types are String, StringList and SecureString. | `string` | `null` | no |
199+
| <a name="input_key_id"></a> [key\_id](#input\_key\_id) | KMS key ID or ARN for encrypting a `SecureString` | `string` | `null` | no |
200+
| <a name="input_name"></a> [name](#input\_name) | Name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`) | `string` | `null` | no |
201+
| <a name="input_overwrite"></a> [overwrite](#input\_overwrite) | Overwrite an existing parameter. If not specified, defaults to `false` during create operations to avoid overwriting existing resources and then `true` for all subsequent operations once the resource is managed by Terraform | `bool` | `false` | no |
202+
| <a name="input_region"></a> [region](#input\_region) | Region where the resource(s) will be managed. Defaults to the Region set in the provider configuration | `string` | `null` | no |
203+
| <a name="input_secure_type"></a> [secure\_type](#input\_secure\_type) | Whether the type of the value should be considered as secure or not | `bool` | `false` | no |
204+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
205+
| <a name="input_tier"></a> [tier](#input\_tier) | Parameter tier to assign to the parameter. If not specified, will use the default parameter tier for the region. Valid tiers are Standard, Advanced, and Intelligent-Tiering. Downgrading an Advanced tier parameter to Standard will recreate the resource | `string` | `null` | no |
206+
| <a name="input_type"></a> [type](#input\_type) | Type of the parameter. Valid types are `String`, `StringList` and `SecureString` | `string` | `null` | no |
206207
| <a name="input_value"></a> [value](#input\_value) | Value of the parameter | `string` | `null` | no |
208+
| <a name="input_value_wo_version"></a> [value\_wo\_version](#input\_value\_wo\_version) | Value of the parameter. This value is always marked as sensitive in the Terraform plan output, regardless of type. Additionally, write-only values are never stored to state. `value_wo_version` can be used to trigger an update and is required with this argument | `number` | `null` | no |
207209
| <a name="input_values"></a> [values](#input\_values) | List of values of the parameter (will be jsonencoded to store as string natively in SSM) | `list(string)` | `[]` | no |
208210

209211
## Outputs
@@ -216,7 +218,6 @@ No modules.
216218
| <a name="output_secure_value"></a> [secure\_value](#output\_secure\_value) | Secure value of the parameter |
217219
| <a name="output_ssm_parameter_arn"></a> [ssm\_parameter\_arn](#output\_ssm\_parameter\_arn) | The ARN of the parameter |
218220
| <a name="output_ssm_parameter_name"></a> [ssm\_parameter\_name](#output\_ssm\_parameter\_name) | Name of the parameter |
219-
| <a name="output_ssm_parameter_tags_all"></a> [ssm\_parameter\_tags\_all](#output\_ssm\_parameter\_tags\_all) | All tags used for the parameter |
220221
| <a name="output_ssm_parameter_type"></a> [ssm\_parameter\_type](#output\_ssm\_parameter\_type) | Type of the parameter |
221222
| <a name="output_ssm_parameter_version"></a> [ssm\_parameter\_version](#output\_ssm\_parameter\_version) | Version of the parameter |
222223
| <a name="output_value"></a> [value](#output\_value) | Parameter value after jsondecode(). Probably this is what you are looking for |

examples/complete/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Note that this example may create resources which cost money. Run `terraform des
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.37 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.8 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.37 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.8 |
3030

3131
## Modules
3232

@@ -58,7 +58,6 @@ No inputs.
5858
| <a name="output_secure_value"></a> [secure\_value](#output\_secure\_value) | Secure value of the parameter |
5959
| <a name="output_ssm_parameter_arn"></a> [ssm\_parameter\_arn](#output\_ssm\_parameter\_arn) | The ARN of the parameter |
6060
| <a name="output_ssm_parameter_name"></a> [ssm\_parameter\_name](#output\_ssm\_parameter\_name) | Name of the parameter |
61-
| <a name="output_ssm_parameter_tags_all"></a> [ssm\_parameter\_tags\_all](#output\_ssm\_parameter\_tags\_all) | All tags used for the parameter |
6261
| <a name="output_ssm_parameter_type"></a> [ssm\_parameter\_type](#output\_ssm\_parameter\_type) | Type of the parameter |
6362
| <a name="output_ssm_parameter_version"></a> [ssm\_parameter\_version](#output\_ssm\_parameter\_version) | Version of the parameter |
6463
| <a name="output_value"></a> [value](#output\_value) | Parameter value after jsondecode(). Probably this is what you are looking for |

examples/complete/main.tf

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ locals {
1111
Example = "complete"
1212
Repository = "github.com/terraform-aws-modules/terraform-aws-ssm-parameter"
1313
}
14+
}
15+
16+
################################################################################
17+
# SSM Parameter
18+
################################################################################
1419

20+
locals {
1521
parameters = {
16-
#########
1722
# String
18-
#########
1923
"string_simple" = {
2024
value = "string_value123"
2125
}
@@ -30,9 +34,7 @@ locals {
3034
data_type = "aws:ec2:image"
3135
}
3236

33-
###############
3437
# SecureString
35-
###############
3638
"secure" = {
3739
type = "SecureString"
3840
value = "secret123123!!!"
@@ -66,9 +68,7 @@ locals {
6668
})
6769
}
6870

69-
#############
7071
# StringList
71-
#############
7272
"list_as_autoguess_type" = {
7373
# List values should be specified as "values" (not "value")
7474
values = ["item1", "item2"]
@@ -108,10 +108,6 @@ locals {
108108
}
109109
}
110110

111-
################################################################################
112-
# SSM Parameter Module
113-
################################################################################
114-
115111
module "multiple" {
116112
source = "../../"
117113

@@ -152,9 +148,9 @@ module "multiple_ignore_value_changes" {
152148
tags = local.tags
153149
}
154150

155-
##########
151+
################################################################################
156152
# Wrapper
157-
##########
153+
################################################################################
158154

159155
locals {
160156
parameters_for_wrapper = {
@@ -171,9 +167,9 @@ module "wrapper" {
171167
items = local.parameters_for_wrapper
172168
}
173169

174-
###########
170+
################################################################################
175171
# Disabled
176-
###########
172+
################################################################################
177173

178174
module "disabled" {
179175
source = "../../"
@@ -193,6 +189,6 @@ data "aws_ami" "amazon_linux" {
193189

194190
filter {
195191
name = "name"
196-
values = ["amzn-ami-hvm-*-x86_64-gp2"]
192+
values = ["amzn2-ami-*"]
197193
}
198194
}

examples/complete/outputs.tf

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#######################
1+
################################################################################
22
# SSM Parameter values
3-
#######################
3+
################################################################################
44

55
output "raw_value" {
66
description = "Raw value of the parameter (as it is stored in SSM). Use 'value' output to get jsondecode'd value"
@@ -31,9 +31,9 @@ output "secure_type" {
3131
sensitive = false
3232
}
3333

34-
################
34+
################################################################################
3535
# SSM Parameter
36-
################
36+
################################################################################
3737

3838
output "ssm_parameter_arn" {
3939
description = "The ARN of the parameter"
@@ -54,8 +54,3 @@ output "ssm_parameter_type" {
5454
description = "Type of the parameter"
5555
value = { for k, v in module.multiple : k => v.ssm_parameter_type }
5656
}
57-
58-
output "ssm_parameter_tags_all" {
59-
description = "All tags used for the parameter"
60-
value = { for k, v in module.multiple : k => v.ssm_parameter_tags_all }
61-
}

examples/complete/versions.tf

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

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.37"
7+
version = ">= 6.8"
88
}
99
}
1010
}

main.tf

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,59 @@ locals {
99
value = local.list_type ? (length(var.values) > 0 ? jsonencode(var.values) : var.value) : var.value
1010
}
1111

12+
################################################################################
13+
# SSM Parameter
14+
################################################################################
15+
1216
resource "aws_ssm_parameter" "this" {
1317
count = var.create && !var.ignore_value_changes ? 1 : 0
1418

15-
name = var.name
16-
type = local.type
17-
description = var.description
18-
19-
value = local.secure_type ? local.value : null
20-
insecure_value = local.list_type || local.string_type ? local.value : null
21-
22-
tier = var.tier
23-
key_id = local.secure_type ? var.key_id : null
24-
allowed_pattern = var.allowed_pattern
25-
data_type = var.data_type
19+
region = var.region
2620

27-
overwrite = var.overwrite
21+
allowed_pattern = var.allowed_pattern
22+
data_type = var.data_type
23+
description = var.description
24+
insecure_value = local.list_type || local.string_type ? local.value : null
25+
key_id = local.secure_type ? var.key_id : null
26+
name = var.name
27+
overwrite = var.overwrite
28+
tier = var.tier
29+
type = local.type
30+
value_wo = local.secure_type ? local.value : null
31+
value_wo_version = local.secure_type ? coalesce(var.value_wo_version, 1) : null
2832

2933
tags = var.tags
3034
}
3135

36+
################################################################################
37+
# SSM Parameter - Ignore Value Changes
38+
################################################################################
39+
3240
resource "aws_ssm_parameter" "ignore_value" {
3341
count = var.create && var.ignore_value_changes ? 1 : 0
3442

35-
name = var.name
36-
type = local.type
37-
description = var.description
38-
39-
value = local.secure_type ? local.value : null
40-
insecure_value = local.list_type || local.string_type ? local.value : null
43+
region = var.region
4144

42-
tier = var.tier
43-
key_id = local.secure_type ? var.key_id : null
44-
allowed_pattern = var.allowed_pattern
45-
data_type = var.data_type
45+
allowed_pattern = var.allowed_pattern
46+
data_type = var.data_type
47+
description = var.description
48+
insecure_value = local.list_type || local.string_type ? local.value : null
49+
key_id = local.secure_type ? var.key_id : null
50+
name = var.name
51+
overwrite = var.overwrite
52+
tier = var.tier
53+
type = local.type
54+
value_wo = local.secure_type ? local.value : null
55+
value_wo_version = local.secure_type ? coalesce(var.value_wo_version, 1) : null
4656

4757
tags = var.tags
4858

4959
lifecycle {
5060
ignore_changes = [
5161
insecure_value,
52-
value
62+
value,
63+
value_wo,
64+
value_wo_version,
5365
]
5466
}
5567
}

outputs.tf

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#######################
1+
################################################################################
22
# SSM Parameter values
3-
#######################
3+
################################################################################
44

55
locals {
66
# Making values nonsensitive, but keeping them in separate locals
@@ -44,9 +44,9 @@ output "secure_type" {
4444
value = local.secure_type
4545
}
4646

47-
################
47+
################################################################################
4848
# SSM Parameter
49-
################
49+
################################################################################
5050

5151
output "ssm_parameter_arn" {
5252
description = "The ARN of the parameter"
@@ -67,8 +67,3 @@ output "ssm_parameter_type" {
6767
description = "Type of the parameter"
6868
value = try(aws_ssm_parameter.this[0].type, aws_ssm_parameter.ignore_value[0].type, null)
6969
}
70-
71-
output "ssm_parameter_tags_all" {
72-
description = "All tags used for the parameter"
73-
value = try(aws_ssm_parameter.this[0].tags_all, aws_ssm_parameter.ignore_value[0].tags_all, null)
74-
}

0 commit comments

Comments
 (0)