1. Packages
  2. Exoscale
  3. API Docs
  4. getSecurityGroup
Exoscale v0.62.7 published on Tuesday, Dec 10, 2024 by Pulumiverse

exoscale.getSecurityGroup

Explore with Pulumi AI

Exoscale v0.62.7 published on Tuesday, Dec 10, 2024 by Pulumiverse

Fetch Exoscale Security Groups data.

Corresponding resource: exoscale_security_group.

Example Usage

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  mySecurityGroup:
    fn::invoke:
      function: exoscale:getSecurityGroup
      arguments:
        name: my-security-group
outputs:
  mySecurityGroupId: ${mySecurityGroup.id}
Copy

Please refer to the examples directory for complete configuration examples.

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>
Copy
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]
Copy
func LookupSecurityGroup(ctx *Context, args *LookupSecurityGroupArgs, opts ...InvokeOption) (*LookupSecurityGroupResult, error)
func LookupSecurityGroupOutput(ctx *Context, args *LookupSecurityGroupOutputArgs, opts ...InvokeOption) LookupSecurityGroupResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetSecurityGroupResult> getSecurityGroup(GetSecurityGroupArgs args, InvokeOptions options)
public static Output<GetSecurityGroupResult> getSecurityGroup(GetSecurityGroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: exoscale:index/getSecurityGroup:getSecurityGroup
  arguments:
    # arguments dictionary
Copy

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 v0.62.7 published on Tuesday, Dec 10, 2024 by Pulumiverse