# ionoscloud\_nsg

Manages a [Network Security Group](https://docs.ionos.com/cloud/network-services/network-security-groups/overview) on IONOS CLOUD.

## Example Usage

```hcl
resource "ionoscloud_datacenter" "example" {
  name            = "Datacenter NSG Example"
  location        = "de/txl"
}

resource "ionoscloud_nsg" "example" {
  name              = "Example NSG"
  description       = "Example NSG Description"
  datacenter_id     = ionoscloud_datacenter.example.id
}
```

## Argument Reference

The following arguments are supported:

* `datacenter_id` - (Required)\[string] The ID of a Virtual Data Center.
* `name` - (Optional)\[string] The name of the Network Security Group.
* `description` - (Optional)\[string] Description for the Network Security Group.
* `rule_ids` - (Computed) 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.

```shell
terraform import ionoscloud_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
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/resources/nsg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
