terraform-aws-secrets-manager icon indicating copy to clipboard operation
terraform-aws-secrets-manager copied to clipboard

Warning: Available Write-only Attribute Alternative

Open MattiaEffendi opened this issue 9 months ago β€’ 6 comments

Description

Terraform v1.11.0 introduced the concept of write-only attributes, documented here. When creating a secret with a secret_string attribute set, the AWS provider now complains that "Available Write-only Attribute Alternative" is present, suggesting instead to use the secret_string_wo attribute.

β”‚ Warning: Available Write-only Attribute Alternative
β”‚ 
β”‚   with module.secrets.aws_secretsmanager_secret_version.ignore_changes,
β”‚   on .terraform/modules/secrets/main.tf line 105, in resource "aws_secretsmanager_secret_version" "ignore_changes":
β”‚  105:   secret_string  = var.create_random_password ? random_password.this[0].result : var.secret_string
β”‚ 
β”‚ The attribute secret_string has a write-only alternative secret_string_wo
β”‚ available. Use the write-only alternative of the attribute when possible.
  • [x] βœ‹ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 1.3.1

  • Terraform version: v1.11.0

Terraform v1.11.0
on darwin_arm64
  • Provider version(s):
+ provider registry.terraform.io/hashicorp/aws v5.88.0
+ provider registry.terraform.io/hashicorp/random v3.7.1
+ provider registry.terraform.io/hashicorp/tfe v0.60.1

Reproduction Code [Required]

module "secrets" {
  source  = "terraform-aws-modules/secrets-manager/aws"
  version = "1.3.1"

  name                    = "foo-secret"
  description             = "foo"

  create_policy          = false
  create_random_password = false

  secret_string = jsonencode({ foo = "bar" })
}

Steps to reproduce the behavior:

  • Create a secret setting the secret_string attribute using Terraform 1.11.0
  • Run terraform plan
  • A warning is thrown suggesting to use the secret_string_wo writeonly parameter

Expected behavior

  • terraform plan does not throw any warnings

Actual behavior

  • A warning is shown suggesting to use the writeonly parameter

Terminal Output

β”‚ Warning: Available Write-only Attribute Alternative
β”‚ 
β”‚   with module.secrets.aws_secretsmanager_secret_version.ignore_changes,
β”‚   on .terraform/modules/secrets/main.tf line 105, in resource "aws_secretsmanager_secret_version" "ignore_changes":
β”‚  105:   secret_string  = var.create_random_password ? random_password.this[0].result : var.secret_string
β”‚ 
β”‚ The attribute secret_string has a write-only alternative secret_string_wo
β”‚ available. Use the write-only alternative of the attribute when possible.

MattiaEffendi avatar Feb 28 '25 09:02 MattiaEffendi

We are having a related issue on which we want to feed the module secret_string with an ephemeral value which are not supported. I believe supporting the write-only value i.e. secret_string_wo for the resource aws_secretsmanager_secret_version will allow us to do just that.

estar-platform-team avatar Mar 11 '25 15:03 estar-platform-team

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Apr 11 '25 00:04 github-actions[bot]

Still a valid issue.

pawelpesz avatar Apr 11 '25 07:04 pawelpesz

can someone describe the workflow for using these new write-only attributes?

bryantbiggs avatar Apr 11 '25 13:04 bryantbiggs

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar May 12 '25 00:05 github-actions[bot]

Remove stale.

pawelpesz avatar May 12 '25 07:05 pawelpesz

I am getting a similar error using Terraform v1.11.4

β”‚ Warning: Failed to decode resource from state
β”‚ 
β”‚ Error decoding
β”‚ "module.XXXXX.module.container_secrets[\"XXXXX\"].aws_secretsmanager_secret_version.ignore_changes[0]"
β”‚ from prior state: unsupported attribute "has_secret_string_wo"

wilblack avatar Jun 04 '25 20:06 wilblack

This issue has been resolved in version 2.0.0 :tada:

antonbabenko avatar Aug 09 '25 11:08 antonbabenko

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.

github-actions[bot] avatar Sep 17 '25 02:09 github-actions[bot]