# firewall\_rule

Type representing a IonosCloud firewall rule.

## Parameters:

| Name | Required | Description                    |
| ---- | :------: | ------------------------------ |
| name |   true   | The name of the firewall rule. |

## Properties:

| Name               | Required | Description                                                                                                                 |
| ------------------ | :------: | --------------------------------------------------------------------------------------------------------------------------- |
| ensure             |    No    | The basic property that the resource should be in. Valid values are `present`, `absent`.                                    |
| source\_mac        |    No    | Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff.                       |
| source\_ip         |    No    | Only traffic originating from the respective IPv4 address is allowed.                                                       |
| target\_ip         |    No    | In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. |
| port\_range\_start |    No    | Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.                             |
| port\_range\_end   |    No    | Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.                           |
| icmp\_type         |    No    | Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.                                                    |
| icmp\_code         |    No    | Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.                                                        |
| type               |    No    | The type of firewall rule. If is not specified, it will take the default value INGRESS.                                     |
| protocol           |    No    | The protocol for the firewall rule. Valid values are `TCP`, `UDP`, `ICMP`, `ANY`.                                           |
| datacenter\_id     |    No    | The ID of the virtual data center where the NIC will reside.                                                                |
| datacenter\_name   |    No    | The name of the virtual data center where the NIC will reside.                                                              |
| server\_id         |    No    | The server ID the NIC will be attached to.                                                                                  |
| server\_name       |    No    | The server name the NIC will be attached to.                                                                                |
| nic\_id            |    No    | The NIC ID the NIC will be attached to.                                                                                     |
| nic\_name          |    No    | The name of the NIC the firewall rule will be added to.                                                                     |
| id                 |    No    | The Firewall Rule ID.                                                                                                       |
| \*\*\*             |          |                                                                                                                             |

### Changeable properties:

* icmp\_code
* icmp\_type
* port\_range\_start
* port\_range\_end
* source\_mac
* source\_ip
* target\_ip
* type

## Examples

### To list resources:

```bash
puppet resource firewall_rule
```

> ***NOTE:*** If two resources have the same name only one of them will be shown.

### To create, update or delete a resource:

```ruby
$datacenter_name = 'MyDataCenter'
$server_name = 'worker4'
$nic = 'testnic3'

firewall_rule { 'SSH':
  ensure           => 'present',
  datacenter_name  => 'MyDataCenter',
  nic_name         => 'testnic3',
  port_range_end   => 29,
  port_range_start => 22,
  protocol         => 'TCP',
  provider         => 'v1',
  server_name      => 'worker4',
  type             => 'INGRESS',
}
```

> ***NOTE:*** If two resources with the same name ar found an error will be thrown, this only applies to cases where the resource cannot be identified. Example: an error is thrown for two servers with the same name in the same datacenter, not for two servers with the same name, but in different datacenters.


---

# 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/puppet-v6/types/compute-engine/firewall_rule.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.
