1. Packages
  2. Cloudfoundry Provider
  3. API Docs
  4. Asg
cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community

cloudfoundry.Asg

Explore with Pulumi AI

cloudfoundry logo
cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community

    Provides an application security group resource for Cloud Foundry. This resource defines egress rules that can be applied to containers that stage and run applications.

    NOTE: This resource requires the provider to be authenticated with an account granted admin permissions. NOTE: Resource will not override all security group set but rather only manage ASGs defined in the resource.

    Example Usage

    Basic usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudfoundry from "@pulumi/cloudfoundry";
    
    const messaging = new cloudfoundry.Asg("messaging", {rules: [
        {
            destination: "192.168.1.100",
            log: true,
            ports: "1883,8883",
            protocol: "tcp",
        },
        {
            destination: "192.168.1.101",
            log: true,
            ports: "5671-5672",
            protocol: "tcp",
        },
    ]});
    
    import pulumi
    import pulumi_cloudfoundry as cloudfoundry
    
    messaging = cloudfoundry.Asg("messaging", rules=[
        {
            "destination": "192.168.1.100",
            "log": True,
            "ports": "1883,8883",
            "protocol": "tcp",
        },
        {
            "destination": "192.168.1.101",
            "log": True,
            "ports": "5671-5672",
            "protocol": "tcp",
        },
    ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cloudfoundry/cloudfoundry"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudfoundry.NewAsg(ctx, "messaging", &cloudfoundry.AsgArgs{
    			Rules: cloudfoundry.AsgRuleArray{
    				&cloudfoundry.AsgRuleArgs{
    					Destination: pulumi.String("192.168.1.100"),
    					Log:         pulumi.Bool(true),
    					Ports:       pulumi.String("1883,8883"),
    					Protocol:    pulumi.String("tcp"),
    				},
    				&cloudfoundry.AsgRuleArgs{
    					Destination: pulumi.String("192.168.1.101"),
    					Log:         pulumi.Bool(true),
    					Ports:       pulumi.String("5671-5672"),
    					Protocol:    pulumi.String("tcp"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudfoundry = Pulumi.Cloudfoundry;
    
    return await Deployment.RunAsync(() => 
    {
        var messaging = new Cloudfoundry.Asg("messaging", new()
        {
            Rules = new[]
            {
                new Cloudfoundry.Inputs.AsgRuleArgs
                {
                    Destination = "192.168.1.100",
                    Log = true,
                    Ports = "1883,8883",
                    Protocol = "tcp",
                },
                new Cloudfoundry.Inputs.AsgRuleArgs
                {
                    Destination = "192.168.1.101",
                    Log = true,
                    Ports = "5671-5672",
                    Protocol = "tcp",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudfoundry.Asg;
    import com.pulumi.cloudfoundry.AsgArgs;
    import com.pulumi.cloudfoundry.inputs.AsgRuleArgs;
    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 messaging = new Asg("messaging", AsgArgs.builder()
                .rules(            
                    AsgRuleArgs.builder()
                        .destination("192.168.1.100")
                        .log(true)
                        .ports("1883,8883")
                        .protocol("tcp")
                        .build(),
                    AsgRuleArgs.builder()
                        .destination("192.168.1.101")
                        .log(true)
                        .ports("5671-5672")
                        .protocol("tcp")
                        .build())
                .build());
    
        }
    }
    
    resources:
      messaging:
        type: cloudfoundry:Asg
        properties:
          rules:
            - destination: 192.168.1.100
              log: true
              ports: 1883,8883
              protocol: tcp
            - destination: 192.168.1.101
              log: true
              ports: 5671-5672
              protocol: tcp
    

    Create Asg Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Asg(name: string, args: AsgArgs, opts?: CustomResourceOptions);
    @overload
    def Asg(resource_name: str,
            args: AsgArgs,
            opts: Optional[ResourceOptions] = None)
    
    @overload
    def Asg(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            rules: Optional[Sequence[AsgRuleArgs]] = None,
            asg_id: Optional[str] = None,
            name: Optional[str] = None)
    func NewAsg(ctx *Context, name string, args AsgArgs, opts ...ResourceOption) (*Asg, error)
    public Asg(string name, AsgArgs args, CustomResourceOptions? opts = null)
    public Asg(String name, AsgArgs args)
    public Asg(String name, AsgArgs args, CustomResourceOptions options)
    
    type: cloudfoundry:Asg
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AsgArgs
    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 AsgArgs
    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 AsgArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AsgArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AsgArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var asgResource = new Cloudfoundry.Asg("asgResource", new()
    {
        Rules = new[]
        {
            new Cloudfoundry.Inputs.AsgRuleArgs
            {
                Destination = "string",
                Protocol = "string",
                Code = 0,
                Description = "string",
                Log = false,
                Ports = "string",
                Type = 0,
            },
        },
        AsgId = "string",
        Name = "string",
    });
    
    example, err := cloudfoundry.NewAsg(ctx, "asgResource", &cloudfoundry.AsgArgs{
    	Rules: cloudfoundry.AsgRuleArray{
    		&cloudfoundry.AsgRuleArgs{
    			Destination: pulumi.String("string"),
    			Protocol:    pulumi.String("string"),
    			Code:        pulumi.Float64(0),
    			Description: pulumi.String("string"),
    			Log:         pulumi.Bool(false),
    			Ports:       pulumi.String("string"),
    			Type:        pulumi.Float64(0),
    		},
    	},
    	AsgId: pulumi.String("string"),
    	Name:  pulumi.String("string"),
    })
    
    var asgResource = new Asg("asgResource", AsgArgs.builder()
        .rules(AsgRuleArgs.builder()
            .destination("string")
            .protocol("string")
            .code(0)
            .description("string")
            .log(false)
            .ports("string")
            .type(0)
            .build())
        .asgId("string")
        .name("string")
        .build());
    
    asg_resource = cloudfoundry.Asg("asgResource",
        rules=[{
            "destination": "string",
            "protocol": "string",
            "code": 0,
            "description": "string",
            "log": False,
            "ports": "string",
            "type": 0,
        }],
        asg_id="string",
        name="string")
    
    const asgResource = new cloudfoundry.Asg("asgResource", {
        rules: [{
            destination: "string",
            protocol: "string",
            code: 0,
            description: "string",
            log: false,
            ports: "string",
            type: 0,
        }],
        asgId: "string",
        name: "string",
    });
    
    type: cloudfoundry:Asg
    properties:
        asgId: string
        name: string
        rules:
            - code: 0
              description: string
              destination: string
              log: false
              ports: string
              protocol: string
              type: 0
    

    Asg Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Asg resource accepts the following input properties:

    Rules List<AsgRule>
    A list of egress rules with the following arguments.
    AsgId string
    The GUID of the application security group
    Name string
    The name of the application security group.
    Rules []AsgRuleArgs
    A list of egress rules with the following arguments.
    AsgId string
    The GUID of the application security group
    Name string
    The name of the application security group.
    rules List<AsgRule>
    A list of egress rules with the following arguments.
    asgId String
    The GUID of the application security group
    name String
    The name of the application security group.
    rules AsgRule[]
    A list of egress rules with the following arguments.
    asgId string
    The GUID of the application security group
    name string
    The name of the application security group.
    rules Sequence[AsgRuleArgs]
    A list of egress rules with the following arguments.
    asg_id str
    The GUID of the application security group
    name str
    The name of the application security group.
    rules List<Property Map>
    A list of egress rules with the following arguments.
    asgId String
    The GUID of the application security group
    name String
    The name of the application security group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Asg 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 Asg Resource

    Get an existing Asg 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?: AsgState, opts?: CustomResourceOptions): Asg
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            asg_id: Optional[str] = None,
            name: Optional[str] = None,
            rules: Optional[Sequence[AsgRuleArgs]] = None) -> Asg
    func GetAsg(ctx *Context, name string, id IDInput, state *AsgState, opts ...ResourceOption) (*Asg, error)
    public static Asg Get(string name, Input<string> id, AsgState? state, CustomResourceOptions? opts = null)
    public static Asg get(String name, Output<String> id, AsgState state, CustomResourceOptions options)
    resources:  _:    type: cloudfoundry:Asg    get:      id: ${id}
    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:
    AsgId string
    The GUID of the application security group
    Name string
    The name of the application security group.
    Rules List<AsgRule>
    A list of egress rules with the following arguments.
    AsgId string
    The GUID of the application security group
    Name string
    The name of the application security group.
    Rules []AsgRuleArgs
    A list of egress rules with the following arguments.
    asgId String
    The GUID of the application security group
    name String
    The name of the application security group.
    rules List<AsgRule>
    A list of egress rules with the following arguments.
    asgId string
    The GUID of the application security group
    name string
    The name of the application security group.
    rules AsgRule[]
    A list of egress rules with the following arguments.
    asg_id str
    The GUID of the application security group
    name str
    The name of the application security group.
    rules Sequence[AsgRuleArgs]
    A list of egress rules with the following arguments.
    asgId String
    The GUID of the application security group
    name String
    The name of the application security group.
    rules List<Property Map>
    A list of egress rules with the following arguments.

    Supporting Types

    AsgRule, AsgRuleArgs

    Destination string
    The IP address or CIDR block that can receive traffic.
    Protocol string
    One of icmp, tcp, udp, or all.
    Code double
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    Description string
    Description of the rule. Defaults to empty.
    Log bool
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    Ports string
    A single port, comma-separated ports or range of ports that can receive traffic.
    Type double
    Allowed ICMP type. A value of -1 allows all types. Default is -1.
    Destination string
    The IP address or CIDR block that can receive traffic.
    Protocol string
    One of icmp, tcp, udp, or all.
    Code float64
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    Description string
    Description of the rule. Defaults to empty.
    Log bool
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    Ports string
    A single port, comma-separated ports or range of ports that can receive traffic.
    Type float64
    Allowed ICMP type. A value of -1 allows all types. Default is -1.
    destination String
    The IP address or CIDR block that can receive traffic.
    protocol String
    One of icmp, tcp, udp, or all.
    code Double
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    description String
    Description of the rule. Defaults to empty.
    log Boolean
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    ports String
    A single port, comma-separated ports or range of ports that can receive traffic.
    type Double
    Allowed ICMP type. A value of -1 allows all types. Default is -1.
    destination string
    The IP address or CIDR block that can receive traffic.
    protocol string
    One of icmp, tcp, udp, or all.
    code number
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    description string
    Description of the rule. Defaults to empty.
    log boolean
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    ports string
    A single port, comma-separated ports or range of ports that can receive traffic.
    type number
    Allowed ICMP type. A value of -1 allows all types. Default is -1.
    destination str
    The IP address or CIDR block that can receive traffic.
    protocol str
    One of icmp, tcp, udp, or all.
    code float
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    description str
    Description of the rule. Defaults to empty.
    log bool
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    ports str
    A single port, comma-separated ports or range of ports that can receive traffic.
    type float
    Allowed ICMP type. A value of -1 allows all types. Default is -1.
    destination String
    The IP address or CIDR block that can receive traffic.
    protocol String
    One of icmp, tcp, udp, or all.
    code Number
    Allowed ICMP code. . A value of -1 allows all codes. Default is -1.
    description String
    Description of the rule. Defaults to empty.
    log Boolean
    Set to true to enable logging. For more information on how to configure system logs to be sent to a syslog drain, review the ASG logging documentation. Defaults to false.
    ports String
    A single port, comma-separated ports or range of ports that can receive traffic.
    type Number
    Allowed ICMP type. A value of -1 allows all types. Default is -1.

    Import

    The current Asg can be imported using the asg guid, e.g.

    bash

    $ pulumi import cloudfoundry:index/asg:Asg messaging a-guid
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    cloudfoundry cloudfoundry-community/terraform-provider-cloudfoundry
    License
    Notes
    This Pulumi package is based on the cloudfoundry Terraform Provider.
    cloudfoundry logo
    cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community