{% for version in resources %}
{% if version.get('name_sanitized') %}
resource "aws_secretsmanager_secret_version" "{{ version.name_sanitized }}" {
{% else %}
resource "aws_secretsmanager_secret_version" "{{ version.secret_name_sanitized }}_{{ version.version_id_sanitized | tf_resource_name }}" {
{% endif %}
  secret_id = "{{ version.SecretArn }}"

  # Placeholder - actual secret value should be set manually or via CI/CD
  secret_string = jsonencode({
    placeholder = "CHANGE_ME"
  })

  {% if version.version_stages_formatted %}
  version_stages = {{ version.version_stages_formatted | tojson }}
  {%  endif %}

  lifecycle {
    ignore_changes = [
      secret_string,
      secret_binary
    ]
  }
}

{% endfor %}
