packer-plugin-amazon icon indicating copy to clipboard operation
packer-plugin-amazon copied to clipboard

Inappropriate value for attribute "Resource": list of string required.

Open hobti01 opened this issue 3 years ago • 0 comments

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

Documentation for https://www.packer.io/plugins/builders/amazon/ebs#temporary_iam_instance_profile_policy_document shows a string as the value for Resource but the accepted type is list(string)

Reproduction Steps

Create an Ami Builder configuration with the documented example:

temporary_iam_instance_profile_policy_document {
    Statement {
        Action   = ["logs:*"]
        Effect   = "Allow"
        Resource = "*"
    }
    Version = "2012-10-17"
}

Plugin and Packer version

Packer v1.8.0 plugin amazon-ebs v1.0.8

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Operating system and Environment details

linux, AWS

Log Fragments and crash.log files

Installed plugin github.com/hashicorp/amazon v1.0.8 in "/var/run/packer/.config/packer/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.0.8_x5.0_linux_amd64"
Installed plugin github.com/hashicorp/ansible v1.0.1 in "/var/run/packer/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.0.1_x5.0_linux_amd64"
Error: Incorrect attribute value type
  on ami.pkr.hcl line 57:
  (source code not available)
Inappropriate value for attribute "Resource": list of string required.

The solution is to specify Resource as a list(string), so this requires a small change to the documentation:

temporary_iam_instance_profile_policy_document {
    Statement {
        Action   = ["logs:*"]
        Effect   = "Allow"
        Resource = ["*"]
    }
    Version = "2012-10-17"
}

hobti01 avatar Apr 08 '22 08:04 hobti01