ionoscloud.nsg.Nsg
Explore with Pulumi AI
Manages a Network Security Group on IonosCloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
const example = new ionoscloud.compute.Datacenter("example", {
name: "Datacenter NSG Example",
location: "de/txl",
});
const exampleNsg = new ionoscloud.nsg.Nsg("example", {
name: "Example NSG",
description: "Example NSG Description",
datacenterId: example.id,
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.compute.Datacenter("example",
name="Datacenter NSG Example",
location="de/txl")
example_nsg = ionoscloud.nsg.Nsg("example",
name="Example NSG",
description="Example NSG Description",
datacenter_id=example.id)
package main
import (
"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/compute"
"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/nsg"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := compute.NewDatacenter(ctx, "example", &compute.DatacenterArgs{
Name: pulumi.String("Datacenter NSG Example"),
Location: pulumi.String("de/txl"),
})
if err != nil {
return err
}
_, err = nsg.NewNsg(ctx, "example", &nsg.NsgArgs{
Name: pulumi.String("Example NSG"),
Description: pulumi.String("Example NSG Description"),
DatacenterId: example.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = new Ionoscloud.Compute.Datacenter("example", new()
{
Name = "Datacenter NSG Example",
Location = "de/txl",
});
var exampleNsg = new Ionoscloud.Nsg.Nsg("example", new()
{
Name = "Example NSG",
Description = "Example NSG Description",
DatacenterId = example.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.compute.Datacenter;
import com.pulumi.ionoscloud.compute.DatacenterArgs;
import com.pulumi.ionoscloud.nsg.Nsg;
import com.pulumi.ionoscloud.nsg.NsgArgs;
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 example = new Datacenter("example", DatacenterArgs.builder()
.name("Datacenter NSG Example")
.location("de/txl")
.build());
var exampleNsg = new Nsg("exampleNsg", NsgArgs.builder()
.name("Example NSG")
.description("Example NSG Description")
.datacenterId(example.id())
.build());
}
}
resources:
example:
type: ionoscloud:compute:Datacenter
properties:
name: Datacenter NSG Example
location: de/txl
exampleNsg:
type: ionoscloud:nsg:Nsg
name: example
properties:
name: Example NSG
description: Example NSG Description
datacenterId: ${example.id}
Create Nsg Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Nsg(name: string, args: NsgArgs, opts?: CustomResourceOptions);
@overload
def Nsg(resource_name: str,
args: NsgArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Nsg(resource_name: str,
opts: Optional[ResourceOptions] = None,
datacenter_id: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None)
func NewNsg(ctx *Context, name string, args NsgArgs, opts ...ResourceOption) (*Nsg, error)
public Nsg(string name, NsgArgs args, CustomResourceOptions? opts = null)
type: ionoscloud:nsg:Nsg
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 NsgArgs
- 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 NsgArgs
- 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 NsgArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NsgArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NsgArgs
- 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 nsgResource = new Ionoscloud.Nsg.Nsg("nsgResource", new()
{
DatacenterId = "string",
Description = "string",
Name = "string",
});
example, err := nsg.NewNsg(ctx, "nsgResource", &nsg.NsgArgs{
DatacenterId: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
var nsgResource = new Nsg("nsgResource", NsgArgs.builder()
.datacenterId("string")
.description("string")
.name("string")
.build());
nsg_resource = ionoscloud.nsg.Nsg("nsgResource",
datacenter_id="string",
description="string",
name="string")
const nsgResource = new ionoscloud.nsg.Nsg("nsgResource", {
datacenterId: "string",
description: "string",
name: "string",
});
type: ionoscloud:nsg:Nsg
properties:
datacenterId: string
description: string
name: string
Nsg 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 Nsg resource accepts the following input properties:
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Description string
- [string] Description for the Network Security Group.
- Name string
- [string] The name of the Network Security Group.
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Description string
- [string] Description for the Network Security Group.
- Name string
- [string] The name of the Network Security Group.
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- description String
- [string] Description for the Network Security Group.
- name String
- [string] The name of the Network Security Group.
- datacenter
Id string - [string] The ID of a Virtual Data Center.
- description string
- [string] Description for the Network Security Group.
- name string
- [string] The name of the Network Security Group.
- datacenter_
id str - [string] The ID of a Virtual Data Center.
- description str
- [string] Description for the Network Security Group.
- name str
- [string] The name of the Network Security Group.
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- description String
- [string] Description for the Network Security Group.
- name String
- [string] The name of the Network Security Group.
Outputs
All input properties are implicitly available as output properties. Additionally, the Nsg resource produces the following output properties:
Look up Existing Nsg Resource
Get an existing Nsg 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?: NsgState, opts?: CustomResourceOptions): Nsg
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
datacenter_id: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
rule_ids: Optional[Sequence[str]] = None) -> Nsg
func GetNsg(ctx *Context, name string, id IDInput, state *NsgState, opts ...ResourceOption) (*Nsg, error)
public static Nsg Get(string name, Input<string> id, NsgState? state, CustomResourceOptions? opts = null)
public static Nsg get(String name, Output<String> id, NsgState state, CustomResourceOptions options)
resources: _: type: ionoscloud:nsg:Nsg 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.
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Description string
- [string] Description for the Network Security Group.
- Name string
- [string] The name of the Network Security Group.
- Rule
Ids List<string> - List of Firewall Rules that are part of the Network Security Group
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Description string
- [string] Description for the Network Security Group.
- Name string
- [string] The name of the Network Security Group.
- Rule
Ids []string - List of Firewall Rules that are part of the Network Security Group
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- description String
- [string] Description for the Network Security Group.
- name String
- [string] The name of the Network Security Group.
- rule
Ids List<String> - List of Firewall Rules that are part of the Network Security Group
- datacenter
Id string - [string] The ID of a Virtual Data Center.
- description string
- [string] Description for the Network Security Group.
- name string
- [string] The name of the Network Security Group.
- rule
Ids string[] - List of Firewall Rules that are part of the Network Security Group
- datacenter_
id str - [string] The ID of a Virtual Data Center.
- description str
- [string] Description for the Network Security Group.
- name str
- [string] The name of the Network Security Group.
- rule_
ids Sequence[str] - List of Firewall Rules that are part of the Network Security Group
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- description String
- [string] Description for the Network Security Group.
- name String
- [string] The name of the Network Security Group.
- rule
Ids List<String> - List of Firewall Rules that are part of the Network Security Group
Import
Resource Server can be imported using the resource id
and the datacenter id
, e.g.
$ pulumi import ionoscloud:nsg/nsg:Nsg mynsg datacenter uuid/nsg uuid
Or by using an import
block. Here is an example that allows you to import the default created nsg into pulumi.
hcl
resource “ionoscloud_datacenter” “example” {
name = “Datacenter NSG Example”
location = “de/txl”
}
import {
to = ionoscloud_nsg.imported
id = “datacenter uuid/default nsg uuid”
}
resource “ionoscloud_nsg” “imported_default” { # Imported here
datacenter_id = ionoscloud_datacenter.example.id
}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/pulumi-ionoscloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.