# Terraform configuration to create a parameter in AWS Systems Manager Parameter Store.

provider "aws" {
  region = "us-east-1"
}

# --- 1. Create Parameter ---
resource "aws_ssm_parameter" "db_url" {
  name        = "/my-terraform-app/config/database-url"
  type        = "String"
  value       = "jdbc:mysql://localhost:3306/mydb"
  description = "Database connection URL for my Terraform application"
  overwrite   = true # Allow updating if parameter already exists

  tags = {
    Name = "MyTerraformDBUrl"
  }
}

# --- Outputs ---
output "ssm_parameter_name" {
  value       = aws_ssm_parameter.db_url.name
  description = "The name of the SSM Parameter Store parameter."
}

output "ssm_parameter_value" {
  value       = aws_ssm_parameter.db_url.value
  description = "The value of the SSM Parameter Store parameter."
  sensitive   = true # Mark as sensitive if it contains secrets
}
