Skip to content

Commit

Permalink
fix: Marked AMI id as nonsensitive (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingunn-wk committed Apr 21, 2023
1 parent baf0059 commit 1ae1d5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ No modules.

| Name | Description |
|------|-------------|
| <a name="output_ami"></a> [ami](#output\_ami) | AMI ID that was used to create the instance. |
| <a name="output_arn"></a> [arn](#output\_arn) | The ARN of the instance |
| <a name="output_capacity_reservation_specification"></a> [capacity\_reservation\_specification](#output\_capacity\_reservation\_specification) | Capacity reservation specification of the instance |
| <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 |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data "aws_ssm_parameter" "this" {
resource "aws_instance" "this" {
count = local.create && !var.create_spot_instance ? 1 : 0

ami = try(coalesce(var.ami, data.aws_ssm_parameter.this[0].value), null)
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
instance_type = var.instance_type
cpu_core_count = var.cpu_core_count
cpu_threads_per_core = var.cpu_threads_per_core
Expand Down Expand Up @@ -167,7 +167,7 @@ resource "aws_instance" "this" {
resource "aws_spot_instance_request" "this" {
count = local.create && var.create_spot_instance ? 1 : 0

ami = try(coalesce(var.ami, data.aws_ssm_parameter.this[0].value), null)
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
instance_type = var.instance_type
cpu_core_count = var.cpu_core_count
cpu_threads_per_core = var.cpu_threads_per_core
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ output "spot_instance_id" {
value = try(aws_spot_instance_request.this[0].spot_instance_id, "")
}

output "ami" {
description = "AMI ID that was used to create the instance."
value = try(aws_instance.this[0].ami, aws_spot_instance_request.this[0].ami, "")
}

################################################################################
# IAM Role / Instance Profile
################################################################################
Expand Down

0 comments on commit 1ae1d5c

Please sign in to comment.