r/aws_ssm_parameter: updating `description` on a write-only (`value_wo`) parameter sends an empty Value to PutParameter
Terraform Core Version
1.15.9
AWS Provider Version
6.62.0
Affected Resource(s)
- aws_ssm_parameter
Expected Behavior
Changing a non-value argument (e.g. description) on a parameter managed with value_wo / value_wo_version should update that argument without requiring a new value_wo_version, and without sending an empty value.
Actual Behavior
The update calls PutParameter with Value = "", and SSM rejects it:
Error: updating SSM Parameter (/example/value-wo): operation error SSM: PutParameter, https response error StatusCode: 400, api error ValidationException: 1 validation error detected: Value at 'value' failed to satisfy constraint: Member must have length greater than or equal to 1The stored parameter is left unchanged (version, value and description), so it fails safe, but the description can't be changed without bumping value_wo_version, which rewrites the secret.
Terraform Configuration Files
terraform {
required_providers {
aws = { source = "hashicorp/aws", version = "6.62.0" }
}
}
provider "aws" { region = "us-east-1" }
variable "description" { type = string }
resource "aws_ssm_parameter" "example" {
name = "/example/value-wo"
type = "SecureString"
description = var.description
value_wo = "example-value"
value_wo_version = 1
}Steps to Reproduce
terraform apply -var description=one: the parameter is created.terraform apply -var description=two: the plan shows only~ description = "one" -> "two", and the apply fails with the error above.
Debug Output
(available on request)
Important Factoids
From reading internal/service/ssm/parameter.go (resourceParameterUpdate): the update issues PutParameter for any change other than tags/overwrite, taking Value from d.Get("value"). For a write-only parameter, Read leaves value empty, and value_wo is only substituted when value_wo_version has changed. So a non-value change sends Value = "". A possible fix: when only non-value attributes changed and the parameter is write-only, skip Value (use a path that doesn't require it), or require value_wo to be resent. Note that PutParameter requires Value, so updating description alone may need the write-only value to be supplied from config on every such update.
References
- Similar/related: none found open (searched for
value_wo+PutParameter+ empty value).
Would you like to implement a fix?
None
Source: hashicorp/terraform-provider-aws