Show / Hide Table of Contents

Class NetworkInterfaceSecurityGroupAttachment

This resource attaches a security group to an Elastic Network Interface (ENI). It can be used to attach a security group to any existing ENI, be it a secondary ENI or one attached as the primary interface on an instance.

NOTE on instances, interfaces, and security groups: This provider currently provides the capability to assign security groups via the aws.ec2.Instance and the aws.ec2.NetworkInterface resources. Using this resource in conjunction with security groups provided in-line in those resources will cause conflicts, and will lead to spurious diffs and undefined behavior - please use one or the other.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var ami = Output.Create(Aws.GetAmi.InvokeAsync(new Aws.GetAmiArgs
    {
        Filters = 
        {
            new Aws.Inputs.GetAmiFilterArgs
            {
                Name = "name",
                Values = 
                {
                    "amzn-ami-hvm-*",
                },
            },
        },
        MostRecent = true,
        Owners = 
        {
            "amazon",
        },
    }));
    var instance = new Aws.Ec2.Instance("instance", new Aws.Ec2.InstanceArgs
    {
        Ami = ami.Apply(ami => ami.Id),
        InstanceType = "t2.micro",
        Tags = 
        {
            { "type", "test-instance" },
        },
    });
    var sg = new Aws.Ec2.SecurityGroup("sg", new Aws.Ec2.SecurityGroupArgs
    {
        Tags = 
        {
            { "type", "test-security-group" },
        },
    });
    var sgAttachment = new Aws.Ec2.NetworkInterfaceSecurityGroupAttachment("sgAttachment", new Aws.Ec2.NetworkInterfaceSecurityGroupAttachmentArgs
    {
        NetworkInterfaceId = instance.PrimaryNetworkInterfaceId,
        SecurityGroupId = sg.Id,
    });
}

}

Output Reference

There are no outputs for this resource.

Inheritance
System.Object
Resource
CustomResource
NetworkInterfaceSecurityGroupAttachment
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Ec2
Assembly: Pulumi.Aws.dll
Syntax
public class NetworkInterfaceSecurityGroupAttachment : CustomResource

Constructors

View Source

NetworkInterfaceSecurityGroupAttachment(String, NetworkInterfaceSecurityGroupAttachmentArgs, CustomResourceOptions)

Create a NetworkInterfaceSecurityGroupAttachment resource with the given unique name, arguments, and options.

Declaration
public NetworkInterfaceSecurityGroupAttachment(string name, NetworkInterfaceSecurityGroupAttachmentArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

NetworkInterfaceSecurityGroupAttachmentArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

NetworkInterfaceId

The ID of the network interface to attach to.

Declaration
public Output<string> NetworkInterfaceId { get; }
Property Value
Type Description
Output<System.String>
View Source

SecurityGroupId

The ID of the security group.

Declaration
public Output<string> SecurityGroupId { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, NetworkInterfaceSecurityGroupAttachmentState, CustomResourceOptions)

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

Declaration
public static NetworkInterfaceSecurityGroupAttachment Get(string name, Input<string> id, NetworkInterfaceSecurityGroupAttachmentState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

NetworkInterfaceSecurityGroupAttachmentState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
NetworkInterfaceSecurityGroupAttachment
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.