Skip to content

Resource: awsElasticacheSecurityGroup

Provides an ElastiCache Security Group to control access to one or more cache clusters.

\~> NOTE: ElastiCache Security Groups are for use only when working with an ElastiCache cluster outside of a VPC. If you are using a VPC, see the ElastiCache Subnet Group resource.

!> WARNING: With the retirement of EC2-Classic the awsElasticacheSecurityGroup resource has been deprecated and will be removed in a future version. Any existing resources can be removed from Terraform state using the terraformStateRm command.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSecurityGroupBar = new aws.securityGroup.SecurityGroup(this, "bar", {
  name: "security-group",
});
const awsElasticacheSecurityGroupBar =
  new aws.elasticacheSecurityGroup.ElasticacheSecurityGroup(this, "bar_1", {
    name: "elasticache-security-group",
    securityGroupNames: [awsSecurityGroupBar.name],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsElasticacheSecurityGroupBar.overrideLogicalId("bar");

Argument Reference

The following arguments are supported:

  • name – (Required) Name for the cache security group. This value is stored as a lowercase string.
  • description – (Optional) description for the cache security group. Defaults to "Managed by Terraform".
  • securityGroupNames – (Required) List of EC2 security group names to be authorized for ingress to the cache security group

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • description
  • name
  • securityGroupNames

Import

ElastiCache Security Groups can be imported by name, e.g.,

$ terraform import aws_elasticache_security_group.my_ec_security_group ec-security-group-1