1. Packages
  2. Exoscale
  3. API Docs
  4. getSecurityGroup
Exoscale v0.55.0 published on Monday, Jan 29, 2024 by Pulumiverse

exoscale.getSecurityGroup

Explore with Pulumi AI

exoscale logo
Exoscale v0.55.0 published on Monday, Jan 29, 2024 by Pulumiverse

    Fetch Exoscale Security Groups data.

    Corresponding resource: exoscale_security_group.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Exoscale = Pulumi.Exoscale;
    
    return await Deployment.RunAsync(() => 
    {
        var mySecurityGroup = Exoscale.GetSecurityGroup.Invoke(new()
        {
            Name = "my-security-group",
        });
    
        return new Dictionary<string, object?>
        {
            ["mySecurityGroupId"] = mySecurityGroup.Apply(getSecurityGroupResult => getSecurityGroupResult.Id),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-exoscale/sdk/go/exoscale"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		mySecurityGroup, err := exoscale.LookupSecurityGroup(ctx, &exoscale.LookupSecurityGroupArgs{
    			Name: pulumi.StringRef("my-security-group"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("mySecurityGroupId", mySecurityGroup.Id)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.exoscale.ExoscaleFunctions;
    import com.pulumi.exoscale.inputs.GetSecurityGroupArgs;
    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) {
            final var mySecurityGroup = ExoscaleFunctions.getSecurityGroup(GetSecurityGroupArgs.builder()
                .name("my-security-group")
                .build());
    
            ctx.export("mySecurityGroupId", mySecurityGroup.applyValue(getSecurityGroupResult -> getSecurityGroupResult.id()));
        }
    }
    
    import pulumi
    import pulumi_exoscale as exoscale
    
    my_security_group = exoscale.get_security_group(name="my-security-group")
    pulumi.export("mySecurityGroupId", my_security_group.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as exoscale from "@pulumi/exoscale";
    
    const mySecurityGroup = exoscale.getSecurityGroup({
        name: "my-security-group",
    });
    export const mySecurityGroupId = mySecurityGroup.then(mySecurityGroup => mySecurityGroup.id);
    
    variables:
      mySecurityGroup:
        fn::invoke:
          Function: exoscale:getSecurityGroup
          Arguments:
            name: my-security-group
    outputs:
      mySecurityGroupId: ${mySecurityGroup.id}
    

    Using getSecurityGroup

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSecurityGroup(args: GetSecurityGroupArgs, opts?: InvokeOptions): Promise<GetSecurityGroupResult>
    function getSecurityGroupOutput(args: GetSecurityGroupOutputArgs, opts?: InvokeOptions): Output<GetSecurityGroupResult>
    def get_security_group(id: Optional[str] = None,
                           name: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetSecurityGroupResult
    def get_security_group_output(id: Optional[pulumi.Input[str]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetSecurityGroupResult]
    func LookupSecurityGroup(ctx *Context, args *LookupSecurityGroupArgs, opts ...InvokeOption) (*LookupSecurityGroupResult, error)
    func LookupSecurityGroupOutput(ctx *Context, args *LookupSecurityGroupOutputArgs, opts ...InvokeOption) LookupSecurityGroupResultOutput

    > Note: This function is named LookupSecurityGroup in the Go SDK.

    public static class GetSecurityGroup 
    {
        public static Task<GetSecurityGroupResult> InvokeAsync(GetSecurityGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetSecurityGroupResult> Invoke(GetSecurityGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSecurityGroupResult> getSecurityGroup(GetSecurityGroupArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: exoscale:index/getSecurityGroup:getSecurityGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The security group ID to match (conflicts with name)
    Name string
    The name to match (conflicts with id)
    Id string
    The security group ID to match (conflicts with name)
    Name string
    The name to match (conflicts with id)
    id String
    The security group ID to match (conflicts with name)
    name String
    The name to match (conflicts with id)
    id string
    The security group ID to match (conflicts with name)
    name string
    The name to match (conflicts with id)
    id str
    The security group ID to match (conflicts with name)
    name str
    The name to match (conflicts with id)
    id String
    The security group ID to match (conflicts with name)
    name String
    The name to match (conflicts with id)

    getSecurityGroup Result

    The following output properties are available:

    ExternalSources List<string>
    The list of external network sources, in CIDR notation.
    Id string
    The security group ID to match (conflicts with name)
    Name string
    The name to match (conflicts with id)
    ExternalSources []string
    The list of external network sources, in CIDR notation.
    Id string
    The security group ID to match (conflicts with name)
    Name string
    The name to match (conflicts with id)
    externalSources List<String>
    The list of external network sources, in CIDR notation.
    id String
    The security group ID to match (conflicts with name)
    name String
    The name to match (conflicts with id)
    externalSources string[]
    The list of external network sources, in CIDR notation.
    id string
    The security group ID to match (conflicts with name)
    name string
    The name to match (conflicts with id)
    external_sources Sequence[str]
    The list of external network sources, in CIDR notation.
    id str
    The security group ID to match (conflicts with name)
    name str
    The name to match (conflicts with id)
    externalSources List<String>
    The list of external network sources, in CIDR notation.
    id String
    The security group ID to match (conflicts with name)
    name String
    The name to match (conflicts with id)

    Package Details

    Repository
    exoscale pulumiverse/pulumi-exoscale
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the exoscale Terraform Provider.
    exoscale logo
    Exoscale v0.55.0 published on Monday, Jan 29, 2024 by Pulumiverse