Data Source: aws_secretsmanager_secret_version

Retrieve information about a Secrets Manager secret version includings its secret value. To retrieve secret metadata, see the aws_secretsmanager_secret data source.

Example Usage

Retrieve Current Secret Version

By default, this data sources retrieves information based on the AWSCURRENT staging label.

data "aws_secretsmanager_secret_version" "example" {
  secret_id = "${data.aws_secretsmanager_secret.example.id}"
}

Retrieve Specific Secret Version

data "aws_secretsmanager_secret_version" "by-version-stage" {
  secret_id     = "${data.aws_secretsmanager_secret.example.id}"
  version_stage = "example"
}

Argument Reference

  • secret_id - (Required) Specifies the secret containing the version that you want to retrieve. You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
  • version_id - (Optional) Specifies the unique identifier of the version of the secret that you want to retrieve. Overrides version_stage.
  • version_stage - (Optional) Specifies the secret version that you want to retrieve by the staging label attached to the version. Defaults to AWSCURRENT.

Attributes Reference

  • id - The unique identifier of this version of the secret.
  • secret_string - The decrypted part of the protected secret information that was originally provided as a string.
  • version_id - The unique identifier of this version of the secret.

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/d/secretsmanager_secret_version.html