describing SSM parameter: ParameterNotFound used the data block to retrieve the value second time in a different component

63 views Asked by At

We are using Terraform scaffold with version 1.5.7

I have successfully created an AWS SSM parameter within one of our existing components subnets using the resource "aws_ssm_parameter" block.

components/subnets/subnet.tf

resource "aws_ssm_parameter" "ssm_public_subnet" {
  name        = "public-subnet-irl"
  description = "public subnet"
  type        = "String"
  value       = join(",", module.vpc_core.subnet_ids)
}

I attempted to reference this parameter in a different component core using the data "aws_ssm_parameter" block, which worked as expected.

components/core/data.tf

data "aws_ssm_parameter" "ssm_public_subnet" {
  name = "public-subnet-irl"
}

However, when I tried to use the same data block in same region yet another different component lambda, I encountered a describing SSM parameter (public-subnet-irl): ParameterNotFound error, despite the presence of the parameter in the AWS console. components/lambda/data.tf

data "aws_ssm_parameter" "ssm_public_subnet" {
  name = "public-subnet-irl"
}

error

│ Error: describing SSM parameter (public-subnet-irl): ParameterNotFound:
│
│   with data.aws_ssm_parameter.ssm_public_subnet,
│   on data.tf line 11, in data "aws_ssm_parameter" "ssm_public_subnet":
│   11: data "aws_ssm_parameter" "ssm_public_subnet" {
│
╵
ERROR: Terraform plan failed

I have also tried to run terraform apply but got the same error message

Expected scenario to use the data block to retrieve the value second time in a different component

Thank you

0

There are 0 answers