Retrieving list of AWS parameter store values and searching them

Hey there,

We’re storing output values in the AWS SSM Parameter Store, and I’m having trouble figuring out how to take a list of parameters, and make it a little easier to reference them in other modules.

Here’s what I mean. Say I’ve got this code, to retrieve everything under /infrastructure/vpc in a certain AWS account:

data "aws_ssm_parameters_by_path" "vpc" {
  path = "/infrastructure/vpc"
  recursive = true

data.aws_ssm_parameters_by_path.vpc.names produces this list:


If we were importing a state file, we could just get these values by referencing the name of the output, however now I’ve got these strings to deal with.

Ideally, what I would like to do is retrieve the values of these parameters and build a map that would look something like this:

"vpc-id" = "parameterValue"
"app.publicA" = "parameterValue"

And they would be referenced like this:


I’ve been messing around with HCL to try to get what I want but haven’t really gotten anywhere, so I figure I’ll toss this out to the hivemind to see what you can come up with.