Show / Hide Table of Contents

Class GetSecurityGroupRules

Inheritance
System.Object
GetSecurityGroupRules
Inherited Members
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.AliCloud.Ecs
Assembly: Pulumi.AliCloud.dll
Syntax
public static class GetSecurityGroupRules

Methods

View Source

InvokeAsync(GetSecurityGroupRulesArgs, InvokeOptions)

The alicloud.ecs.getSecurityGroupRules data source provides a collection of security permissions of a specific security group. Each collection item represents a single ingress or egress permission rule. The ID of the security group can be provided via a variable or the result from the other data source alicloud.ecs.getSecurityGroups.

{{% examples %}}

Example Usage

{{% example %}}

The following example shows how to obtain details about a security group rule and how to pass its data to an instance at launch time.

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
public MyStack()
{
    var config = new Config();
    var securityGroupId = config.RequireObject<dynamic>("securityGroupId");
    var groupsDs = Output.Create(AliCloud.Ecs.GetSecurityGroups.InvokeAsync(new AliCloud.Ecs.GetSecurityGroupsArgs
    {
        NameRegex = "api",
    }));
    var ingressRulesDs = groupsDs.Apply(groupsDs => Output.Create(AliCloud.Ecs.GetSecurityGroupRules.InvokeAsync(new AliCloud.Ecs.GetSecurityGroupRulesArgs
    {
        Direction = "ingress",
        GroupId = groupsDs.Groups[0].Id,
        IpProtocol = "TCP",
        NicType = "internet",
    })));
    // Pass port_range to the backend service
    var backend = new AliCloud.Ecs.Instance("backend", new AliCloud.Ecs.InstanceArgs
    {
        UserData = ingressRulesDs.Apply(ingressRulesDs => $"config_service.sh --portrange={ingressRulesDs.Rules[0].PortRange}"),
    });
}

}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetSecurityGroupRulesResult> InvokeAsync(GetSecurityGroupRulesArgs args, InvokeOptions options = null)
Parameters
Type Name Description
GetSecurityGroupRulesArgs args
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetSecurityGroupRulesResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.