terraform-aws-iam-system-user icon indicating copy to clipboard operation
terraform-aws-iam-system-user copied to clipboard

Bug: Output error when access key creation disabled

Open cdobbyn opened this issue 3 years ago • 1 comments

Describe the Bug

When you configure:

create_iam_access_key = false

After PR #58 the code will fail with the error:

Expand me

╷
│ Error: Splat of null value
│ 
│   on .terraform/modules/aws_iam_user_ses/outputs.tf line 17, in output "access_key_id":
│   17:   value       = join("", local.access_key.*.id)
│     ├────────────────
│     │ local.access_key is null
│ 
│ Splat expressions (with the * symbol) cannot be applied to null sequences.
╵
╷
│ Error: Splat of null value
│ 
│   on .terraform/modules/aws_iam_user_ses/outputs.tf line 23, in output "secret_access_key":
│   23:   value       = join("", local.access_key.*.secret)
│     ├────────────────
│     │ local.access_key is null
│ 
│ Splat expressions (with the * symbol) cannot be applied to null sequences.
╵
╷
│ Error: Splat of null value
│ 
│   on .terraform/modules/aws_iam_user_ses/outputs.tf line 29, in output "ses_smtp_password_v4":
│   29:   value       = join("", compact(local.access_key.*.ses_smtp_password_v4))
│     ├────────────────
│     │ local.access_key is null
│ 
│ Splat expressions (with the * symbol) cannot be applied to null sequences.
╵

Expected Behavior

This code runs without this error

Steps to Reproduce

  1. Use this module with create_iam_access_key = false.
  2. Try to do a plan.
  3. See error

Screenshots

If applicable, add screenshots or logs to help explain your problem.

Environment (please complete the following information):

Terraform v1.1.5
on linux_amd64
+ provider registry.terraform.io/cloudposse/awsutils v0.11.0
+ provider registry.terraform.io/hashicorp/aws v3.74.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0

cdobbyn avatar Feb 10 '22 00:02 cdobbyn

I think this is still happening.

joshuabalduff avatar Jul 29 '22 04:07 joshuabalduff