Skip to content

Instantly share code, notes, and snippets.

@luispabon
Created October 4, 2022 11:47
Show Gist options
  • Save luispabon/ef9fecc29d19b6fd41561971e89a2a70 to your computer and use it in GitHub Desktop.
Save luispabon/ef9fecc29d19b6fd41561971e89a2a70 to your computer and use it in GitHub Desktop.
aws cli terraform import secret and secret version
~ terraform import aws_secretsmanager_secret.yep my_name
~ terraform import aws_secretsmanager_secret_version.yep my_name\|$(aws secretsmanager get-secret-value --secret-id=my_name | jq ".VersionId" --raw-output)
resource "aws_secretsmanager_secret" "yep" {
name = "my_name"
recovery_window_in_days = 7
}
resource "aws_secretsmanager_secret_version" "yep" {
secret_id = aws_secretsmanager_secret.yep.id
secret_string = jsonencode({})
lifecycle {
ignore_changes = [secret_string]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment