Resource: aws_ssm_parameter

Provides an SSM Parameter resource.

Example Usage

Basic example

resource "aws_ssm_parameter" "foo" {
  name  = "foo"
  type  = "String"
  value = "bar"
}

Encrypted string using default SSM KMS key

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  storage_type         = "gp2"
  engine               = "mysql"
  engine_version       = "5.7.16"
  instance_class       = "db.t2.micro"
  db_name              = "mydb"
  username             = "foo"
  password             = var.database_master_password
  db_subnet_group_name = "my_database_subnet_group"
  parameter_group_name = "default.mysql5.7"
}

resource "aws_ssm_parameter" "secret" {
  name        = "/production/database/password/master"
  description = "The parameter description"
  type        = "SecureString"
  value       = var.database_master_password

  tags = {
    environment = "production"
  }
}

Argument Reference

The following arguments are required:

The following arguments are optional:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import SSM Parameters using the parameter store name. For example:

import {
  to = aws_ssm_parameter.my_param
  id = "/my_path/my_paramname"
}

Using terraform import, import SSM Parameters using the parameter store name. For example:

% terraform import aws_ssm_parameter.my_param /my_path/my_paramname