hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.1k stars 3.33k forks source link

Add an ability to set `region_kms_key_ids` as variable. #9424

Closed goloobev closed 4 years ago

goloobev commented 4 years ago

Feature Description

Add an ability to set region_kms_key_ids (or other "map of strings" objects) as variable. Probably something like a dynamic block for Tag/Tags

Use Case(s)

I have several packer files for different OS and one variable file for them I want to define list of regions and KMS keys for them in var file.

But I haven't found an ability to do so.

azr commented 4 years ago

Hey @goloobev, thanks for opening and trying HCL2 ! There was a breaking change in Packer that allows to do this. If you use the latest version, it allows to do the following:

region_kms_key_ids = { # see the equal sign
  eu-central-1 = "alias/eu-central-1-kms"
}

#this also allows to set 
region_kms_key_ids = var.my_region_kms_key_ids

# from a variable like:
variable "my_region_kms_key_ids" {
    type = map(string)
    default = {
      eu-central-1 = "alias/eu-central-1-kms"
    }
}

I hope that helps ! I'm closing this issue for now, don't hesitate asking more questions. 🙂

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.