gcore 0.22.0 published on Wednesday, Apr 30, 2025 by g-core
gcore.getSecuritygroup
Explore with Pulumi AI
Represent SecurityGroups(Firewall)
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";
const pr = gcore.getProject({
name: "test",
});
const rg = gcore.getRegion({
name: "ED-10 Preprod",
});
const _default = Promise.all([rg, pr]).then(([rg, pr]) => gcore.getSecuritygroup({
name: "default",
regionId: rg.id,
projectId: pr.id,
}));
export const view = _default;
import pulumi
import pulumi_gcore as gcore
pr = gcore.get_project(name="test")
rg = gcore.get_region(name="ED-10 Preprod")
default = gcore.get_securitygroup(name="default",
region_id=rg.id,
project_id=pr.id)
pulumi.export("view", default)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
pr, err := gcore.GetProject(ctx, &gcore.GetProjectArgs{
Name: "test",
}, nil)
if err != nil {
return err
}
rg, err := gcore.GetRegion(ctx, &gcore.GetRegionArgs{
Name: "ED-10 Preprod",
}, nil)
if err != nil {
return err
}
_default, err := gcore.LookupSecuritygroup(ctx, &gcore.LookupSecuritygroupArgs{
Name: "default",
RegionId: pulumi.Float64Ref(rg.Id),
ProjectId: pulumi.Float64Ref(pr.Id),
}, nil)
if err != nil {
return err
}
ctx.Export("view", _default)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcore = Pulumi.Gcore;
return await Deployment.RunAsync(() =>
{
var pr = Gcore.GetProject.Invoke(new()
{
Name = "test",
});
var rg = Gcore.GetRegion.Invoke(new()
{
Name = "ED-10 Preprod",
});
var @default = Gcore.GetSecuritygroup.Invoke(new()
{
Name = "default",
RegionId = rg.Apply(getRegionResult => getRegionResult.Id),
ProjectId = pr.Apply(getProjectResult => getProjectResult.Id),
});
return new Dictionary<string, object?>
{
["view"] = @default,
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.GcoreFunctions;
import com.pulumi.gcore.inputs.GetProjectArgs;
import com.pulumi.gcore.inputs.GetRegionArgs;
import com.pulumi.gcore.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 pr = GcoreFunctions.getProject(GetProjectArgs.builder()
.name("test")
.build());
final var rg = GcoreFunctions.getRegion(GetRegionArgs.builder()
.name("ED-10 Preprod")
.build());
final var default = GcoreFunctions.getSecuritygroup(GetSecuritygroupArgs.builder()
.name("default")
.regionId(rg.applyValue(getRegionResult -> getRegionResult.id()))
.projectId(pr.applyValue(getProjectResult -> getProjectResult.id()))
.build());
ctx.export("view", default_);
}
}
variables:
pr:
fn::invoke:
function: gcore:getProject
arguments:
name: test
rg:
fn::invoke:
function: gcore:getRegion
arguments:
name: ED-10 Preprod
default:
fn::invoke:
function: gcore:getSecuritygroup
arguments:
name: default
regionId: ${rg.id}
projectId: ${pr.id}
outputs:
view: ${default}
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_securitygroup(id: Optional[str] = None,
metadata_k: Optional[str] = None,
metadata_kv: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
project_id: Optional[float] = None,
project_name: Optional[str] = None,
region_id: Optional[float] = None,
region_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSecuritygroupResult
def get_securitygroup_output(id: Optional[pulumi.Input[str]] = None,
metadata_k: Optional[pulumi.Input[str]] = None,
metadata_kv: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[float]] = None,
project_name: Optional[pulumi.Input[str]] = None,
region_id: Optional[pulumi.Input[float]] = None,
region_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)
public static Output<GetSecuritygroupResult> getSecuritygroup(GetSecuritygroupArgs args, InvokeOptions options)
fn::invoke:
function: gcore:index/getSecuritygroup:getSecuritygroup
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- Id string
- The ID of this resource.
- Metadata
K string - Metadata
Kv Dictionary<string, string> - Project
Id double - Project
Name string - Region
Id double - Region
Name string
- Name string
- Id string
- The ID of this resource.
- Metadata
K string - Metadata
Kv map[string]string - Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string
- name String
- id String
- The ID of this resource.
- metadata
K String - metadata
Kv Map<String,String> - project
Id Double - project
Name String - region
Id Double - region
Name String
- name string
- id string
- The ID of this resource.
- metadata
K string - metadata
Kv {[key: string]: string} - project
Id number - project
Name string - region
Id number - region
Name string
- name str
- id str
- The ID of this resource.
- metadata_
k str - metadata_
kv Mapping[str, str] - project_
id float - project_
name str - region_
id float - region_
name str
- name String
- id String
- The ID of this resource.
- metadata
K String - metadata
Kv Map<String> - project
Id Number - project
Name String - region
Id Number - region
Name String
getSecuritygroup Result
The following output properties are available:
- Description string
- Id string
- The ID of this resource.
- Metadata
Read List<GetOnlies Securitygroup Metadata Read Only> - Name string
- Security
Group List<GetRules Securitygroup Security Group Rule> - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- Metadata
K string - Metadata
Kv Dictionary<string, string> - Project
Id double - Project
Name string - Region
Id double - Region
Name string
- Description string
- Id string
- The ID of this resource.
- Metadata
Read []GetOnlies Securitygroup Metadata Read Only - Name string
- Security
Group []GetRules Securitygroup Security Group Rule - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- Metadata
K string - Metadata
Kv map[string]string - Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string
- description String
- id String
- The ID of this resource.
- metadata
Read List<GetOnlies Securitygroup Metadata Read Only> - name String
- security
Group List<GetRules Securitygroup Security Group Rule> - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- metadata
K String - metadata
Kv Map<String,String> - project
Id Double - project
Name String - region
Id Double - region
Name String
- description string
- id string
- The ID of this resource.
- metadata
Read GetOnlies Securitygroup Metadata Read Only[] - name string
- security
Group GetRules Securitygroup Security Group Rule[] - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- metadata
K string - metadata
Kv {[key: string]: string} - project
Id number - project
Name string - region
Id number - region
Name string
- description str
- id str
- The ID of this resource.
- metadata_
read_ Sequence[Getonlies Securitygroup Metadata Read Only] - name str
- security_
group_ Sequence[Getrules Securitygroup Security Group Rule] - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- metadata_
k str - metadata_
kv Mapping[str, str] - project_
id float - project_
name str - region_
id float - region_
name str
- description String
- id String
- The ID of this resource.
- metadata
Read List<Property Map>Onlies - name String
- security
Group List<Property Map>Rules - Firewall rules control what inbound(ingress) and outbound(egress) traffic is allowed to enter or leave a Instance. At least one 'egress' rule should be set
- metadata
K String - metadata
Kv Map<String> - project
Id Number - project
Name String - region
Id Number - region
Name String
Supporting Types
GetSecuritygroupMetadataReadOnly
GetSecuritygroupSecurityGroupRule
- Created
At string - Description string
- Direction string
- Ethertype string
- Id string
- Port
Range doubleMax - Port
Range doubleMin - Protocol string
- Remote
Group stringId - Remote
Ip stringPrefix - Updated
At string
- Created
At string - Description string
- Direction string
- Ethertype string
- Id string
- Port
Range float64Max - Port
Range float64Min - Protocol string
- Remote
Group stringId - Remote
Ip stringPrefix - Updated
At string
- created
At String - description String
- direction String
- ethertype String
- id String
- port
Range DoubleMax - port
Range DoubleMin - protocol String
- remote
Group StringId - remote
Ip StringPrefix - updated
At String
- created
At string - description string
- direction string
- ethertype string
- id string
- port
Range numberMax - port
Range numberMin - protocol string
- remote
Group stringId - remote
Ip stringPrefix - updated
At string
- created_
at str - description str
- direction str
- ethertype str
- id str
- port_
range_ floatmax - port_
range_ floatmin - protocol str
- remote_
group_ strid - remote_
ip_ strprefix - updated_
at str
- created
At String - description String
- direction String
- ethertype String
- id String
- port
Range NumberMax - port
Range NumberMin - protocol String
- remote
Group StringId - remote
Ip StringPrefix - updated
At String
Package Details
- Repository
- gcore g-core/terraform-provider-gcore
- License
- Notes
- This Pulumi package is based on the
gcore
Terraform Provider.