aws logo
AWS Classic v5.29.0, Feb 1 23

aws.elasticache.SecurityGroup

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 aws.elasticache.SecurityGroup resource has been deprecated and will be removed in a future version.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var barSecurityGroup = new Aws.Ec2.SecurityGroup("barSecurityGroup");

    var barElasticache_securityGroupSecurityGroup = new Aws.ElastiCache.SecurityGroup("barElasticache/securityGroupSecurityGroup", new()
    {
        SecurityGroupNames = new[]
        {
            barSecurityGroup.Name,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/elasticache"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		barSecurityGroup, err := ec2.NewSecurityGroup(ctx, "barSecurityGroup", nil)
		if err != nil {
			return err
		}
		_, err = elasticache.NewSecurityGroup(ctx, "barElasticache/securityGroupSecurityGroup", &elasticache.SecurityGroupArgs{
			SecurityGroupNames: pulumi.StringArray{
				barSecurityGroup.Name,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.aws.elasticache.SecurityGroup;
import com.pulumi.aws.elasticache.SecurityGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var barSecurityGroup = new SecurityGroup("barSecurityGroup");

        var barElasticache_securityGroupSecurityGroup = new SecurityGroup("barElasticache/securityGroupSecurityGroup", SecurityGroupArgs.builder()        
            .securityGroupNames(barSecurityGroup.name())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

bar_security_group = aws.ec2.SecurityGroup("barSecurityGroup")
bar_elasticache_security_group_security_group = aws.elasticache.SecurityGroup("barElasticache/securityGroupSecurityGroup", security_group_names=[bar_security_group.name])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const barSecurityGroup = new aws.ec2.SecurityGroup("barSecurityGroup", {});
const barElasticache_securityGroupSecurityGroup = new aws.elasticache.SecurityGroup("barElasticache/securityGroupSecurityGroup", {securityGroupNames: [barSecurityGroup.name]});
resources:
  barSecurityGroup:
    type: aws:ec2:SecurityGroup
  barElasticache/securityGroupSecurityGroup:
    type: aws:elasticache:SecurityGroup
    properties:
      securityGroupNames:
        - ${barSecurityGroup.name}

Create SecurityGroup Resource

new SecurityGroup(name: string, args: SecurityGroupArgs, opts?: CustomResourceOptions);
@overload
def SecurityGroup(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  description: Optional[str] = None,
                  name: Optional[str] = None,
                  security_group_names: Optional[Sequence[str]] = None)
@overload
def SecurityGroup(resource_name: str,
                  args: SecurityGroupArgs,
                  opts: Optional[ResourceOptions] = None)
func NewSecurityGroup(ctx *Context, name string, args SecurityGroupArgs, opts ...ResourceOption) (*SecurityGroup, error)
public SecurityGroup(string name, SecurityGroupArgs args, CustomResourceOptions? opts = null)
public SecurityGroup(String name, SecurityGroupArgs args)
public SecurityGroup(String name, SecurityGroupArgs args, CustomResourceOptions options)
type: aws:elasticache:SecurityGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args SecurityGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args SecurityGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SecurityGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SecurityGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args SecurityGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

SecurityGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The SecurityGroup resource accepts the following input properties:

SecurityGroupNames List<string>

List of EC2 security group names to be authorized for ingress to the cache security group

Description string

description for the cache security group. Defaults to "Managed by Pulumi".

Name string

Name for the cache security group. This value is stored as a lowercase string.

SecurityGroupNames []string

List of EC2 security group names to be authorized for ingress to the cache security group

Description string

description for the cache security group. Defaults to "Managed by Pulumi".

Name string

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames List<String>

List of EC2 security group names to be authorized for ingress to the cache security group

description String

description for the cache security group. Defaults to "Managed by Pulumi".

name String

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames string[]

List of EC2 security group names to be authorized for ingress to the cache security group

description string

description for the cache security group. Defaults to "Managed by Pulumi".

name string

Name for the cache security group. This value is stored as a lowercase string.

security_group_names Sequence[str]

List of EC2 security group names to be authorized for ingress to the cache security group

description str

description for the cache security group. Defaults to "Managed by Pulumi".

name str

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames List<String>

List of EC2 security group names to be authorized for ingress to the cache security group

description String

description for the cache security group. Defaults to "Managed by Pulumi".

name String

Name for the cache security group. This value is stored as a lowercase string.

Outputs

All input properties are implicitly available as output properties. Additionally, the SecurityGroup resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing SecurityGroup Resource

Get an existing SecurityGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SecurityGroupState, opts?: CustomResourceOptions): SecurityGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        security_group_names: Optional[Sequence[str]] = None) -> SecurityGroup
func GetSecurityGroup(ctx *Context, name string, id IDInput, state *SecurityGroupState, opts ...ResourceOption) (*SecurityGroup, error)
public static SecurityGroup Get(string name, Input<string> id, SecurityGroupState? state, CustomResourceOptions? opts = null)
public static SecurityGroup get(String name, Output<String> id, SecurityGroupState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string

description for the cache security group. Defaults to "Managed by Pulumi".

Name string

Name for the cache security group. This value is stored as a lowercase string.

SecurityGroupNames List<string>

List of EC2 security group names to be authorized for ingress to the cache security group

Description string

description for the cache security group. Defaults to "Managed by Pulumi".

Name string

Name for the cache security group. This value is stored as a lowercase string.

SecurityGroupNames []string

List of EC2 security group names to be authorized for ingress to the cache security group

description String

description for the cache security group. Defaults to "Managed by Pulumi".

name String

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames List<String>

List of EC2 security group names to be authorized for ingress to the cache security group

description string

description for the cache security group. Defaults to "Managed by Pulumi".

name string

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames string[]

List of EC2 security group names to be authorized for ingress to the cache security group

description str

description for the cache security group. Defaults to "Managed by Pulumi".

name str

Name for the cache security group. This value is stored as a lowercase string.

security_group_names Sequence[str]

List of EC2 security group names to be authorized for ingress to the cache security group

description String

description for the cache security group. Defaults to "Managed by Pulumi".

name String

Name for the cache security group. This value is stored as a lowercase string.

securityGroupNames List<String>

List of EC2 security group names to be authorized for ingress to the cache security group

Import

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

 $ pulumi import aws:elasticache/securityGroup:SecurityGroup my_ec_security_group ec-security-group-1

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.