ionoscloud.Nsg
Explore with Pulumi AI
Manages a Network Security Group on IonosCloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const exampleDatacenter = new ionoscloud.Datacenter("exampleDatacenter", {location: "de/txl"});
const exampleNsg = new ionoscloud.Nsg("exampleNsg", {
description: "Example NSG Description",
datacenterId: exampleDatacenter.datacenterId,
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example_datacenter = ionoscloud.Datacenter("exampleDatacenter", location="de/txl")
example_nsg = ionoscloud.Nsg("exampleNsg",
description="Example NSG Description",
datacenter_id=example_datacenter.datacenter_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleDatacenter, err := ionoscloud.NewDatacenter(ctx, "exampleDatacenter", &ionoscloud.DatacenterArgs{
Location: pulumi.String("de/txl"),
})
if err != nil {
return err
}
_, err = ionoscloud.NewNsg(ctx, "exampleNsg", &ionoscloud.NsgArgs{
Description: pulumi.String("Example NSG Description"),
DatacenterId: exampleDatacenter.DatacenterId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var exampleDatacenter = new Ionoscloud.Datacenter("exampleDatacenter", new()
{
Location = "de/txl",
});
var exampleNsg = new Ionoscloud.Nsg("exampleNsg", new()
{
Description = "Example NSG Description",
DatacenterId = exampleDatacenter.DatacenterId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.Datacenter;
import com.pulumi.ionoscloud.DatacenterArgs;
import com.pulumi.ionoscloud.Nsg;
import com.pulumi.ionoscloud.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 exampleDatacenter = new Datacenter("exampleDatacenter", DatacenterArgs.builder()
.location("de/txl")
.build());
var exampleNsg = new Nsg("exampleNsg", NsgArgs.builder()
.description("Example NSG Description")
.datacenterId(exampleDatacenter.datacenterId())
.build());
}
}
resources:
exampleDatacenter:
type: ionoscloud:Datacenter
properties:
location: de/txl
exampleNsg:
type: ionoscloud:Nsg
properties:
description: Example NSG Description
datacenterId: ${exampleDatacenter.datacenterId}
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,
nsg_id: Optional[str] = None,
timeouts: Optional[NsgTimeoutsArgs] = 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
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("nsgResource", new()
{
DatacenterId = "string",
Description = "string",
Name = "string",
NsgId = "string",
Timeouts = new Ionoscloud.Inputs.NsgTimeoutsArgs
{
Create = "string",
Default = "string",
Delete = "string",
Update = "string",
},
});
example, err := ionoscloud.NewNsg(ctx, "nsgResource", &ionoscloud.NsgArgs{
DatacenterId: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
NsgId: pulumi.String("string"),
Timeouts: &ionoscloud.NsgTimeoutsArgs{
Create: pulumi.String("string"),
Default: pulumi.String("string"),
Delete: pulumi.String("string"),
Update: pulumi.String("string"),
},
})
var nsgResource = new Nsg("nsgResource", NsgArgs.builder()
.datacenterId("string")
.description("string")
.name("string")
.nsgId("string")
.timeouts(NsgTimeoutsArgs.builder()
.create("string")
.default_("string")
.delete("string")
.update("string")
.build())
.build());
nsg_resource = ionoscloud.Nsg("nsgResource",
datacenter_id="string",
description="string",
name="string",
nsg_id="string",
timeouts={
"create": "string",
"default": "string",
"delete": "string",
"update": "string",
})
const nsgResource = new ionoscloud.Nsg("nsgResource", {
datacenterId: "string",
description: "string",
name: "string",
nsgId: "string",
timeouts: {
create: "string",
"default": "string",
"delete": "string",
update: "string",
},
});
type: ionoscloud:Nsg
properties:
datacenterId: string
description: string
name: string
nsgId: string
timeouts:
create: string
default: string
delete: string
update: 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.
- Nsg
Id string - Timeouts
Nsg
Timeouts
- 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.
- Nsg
Id string - Timeouts
Nsg
Timeouts Args
- 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.
- nsg
Id String - timeouts
Nsg
Timeouts
- 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.
- nsg
Id string - timeouts
Nsg
Timeouts
- 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.
- nsg_
id str - timeouts
Nsg
Timeouts Args
- 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.
- nsg
Id String - timeouts Property Map
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,
nsg_id: Optional[str] = None,
rule_ids: Optional[Sequence[str]] = None,
timeouts: Optional[NsgTimeoutsArgs] = 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 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.
- Nsg
Id string - Rule
Ids List<string> - List of Firewall Rules that are part of the Network Security Group
- Timeouts
Nsg
Timeouts
- 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.
- Nsg
Id string - Rule
Ids []string - List of Firewall Rules that are part of the Network Security Group
- Timeouts
Nsg
Timeouts Args
- 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.
- nsg
Id String - rule
Ids List<String> - List of Firewall Rules that are part of the Network Security Group
- timeouts
Nsg
Timeouts
- 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.
- nsg
Id string - rule
Ids string[] - List of Firewall Rules that are part of the Network Security Group
- timeouts
Nsg
Timeouts
- 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.
- nsg_
id str - rule_
ids Sequence[str] - List of Firewall Rules that are part of the Network Security Group
- timeouts
Nsg
Timeouts Args
- 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.
- nsg
Id String - rule
Ids List<String> - List of Firewall Rules that are part of the Network Security Group
- timeouts Property Map
Supporting Types
NsgTimeouts, NsgTimeoutsArgs
Import
Resource Server can be imported using the resource id
and the datacenter id
, e.g.
$ pulumi import ionoscloud:index/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 terraform.
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/terraform-provider-ionoscloud
- License
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.