Skip to content

Commit 1ae1d5c

Browse files
authored
fix: Marked AMI id as nonsensitive (#321)
1 parent baf0059 commit 1ae1d5c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ No modules.
265265

266266
| Name | Description |
267267
|------|-------------|
268+
| <a name="output_ami"></a> [ami](#output\_ami) | AMI ID that was used to create the instance. |
268269
| <a name="output_arn"></a> [arn](#output\_arn) | The ARN of the instance |
269270
| <a name="output_capacity_reservation_specification"></a> [capacity\_reservation\_specification](#output\_capacity\_reservation\_specification) | Capacity reservation specification of the instance |
270271
| <a name="output_iam_instance_profile_arn"></a> [iam\_instance\_profile\_arn](#output\_iam\_instance\_profile\_arn) | ARN assigned by AWS to the instance profile |

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data "aws_ssm_parameter" "this" {
1919
resource "aws_instance" "this" {
2020
count = local.create && !var.create_spot_instance ? 1 : 0
2121

22-
ami = try(coalesce(var.ami, data.aws_ssm_parameter.this[0].value), null)
22+
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
2323
instance_type = var.instance_type
2424
cpu_core_count = var.cpu_core_count
2525
cpu_threads_per_core = var.cpu_threads_per_core
@@ -167,7 +167,7 @@ resource "aws_instance" "this" {
167167
resource "aws_spot_instance_request" "this" {
168168
count = local.create && var.create_spot_instance ? 1 : 0
169169

170-
ami = try(coalesce(var.ami, data.aws_ssm_parameter.this[0].value), null)
170+
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
171171
instance_type = var.instance_type
172172
cpu_core_count = var.cpu_core_count
173173
cpu_threads_per_core = var.cpu_threads_per_core

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ output "spot_instance_id" {
7878
value = try(aws_spot_instance_request.this[0].spot_instance_id, "")
7979
}
8080

81+
output "ami" {
82+
description = "AMI ID that was used to create the instance."
83+
value = try(aws_instance.this[0].ami, aws_spot_instance_request.this[0].ami, "")
84+
}
85+
8186
################################################################################
8287
# IAM Role / Instance Profile
8388
################################################################################

0 commit comments

Comments
 (0)