# Zone

## dns\_zone

This is a module that supports creating, updating or destroying DNS Zones

### Example Syntax

```yaml

name: Create Zone
ionoscloudsdk.ionoscloud.dns_zone:
  name: 'test.example.test.ansible.com'
  description: 'test_description'
  enabled: 'False'
register: zone_response


name: Update Zone
ionoscloudsdk.ionoscloud.dns_zone:
  zone: ''
  description: 'zone_description_updated'
  enabled: 'True'
  allow_replace: false
  state: update
register: updated_zone_response


name: Delete Zone
ionoscloudsdk.ionoscloud.dns_zone:
  zone: ''
  wait: true
  state: absent

```

&#x20; &#x20;

### Returned object

```json
{
    "changed": true,
    "failed": false,
    "action": "create",
    "zone": {
        "id": "36d63502-7110-57f3-8794-a24fe8959d18",
        "type": "zone",
        "href": "/zones/36d63502-7110-57f3-8794-a24fe8959d18",
        "metadata": {
            "last_modified_date": "2023-10-05T14:38:51+00:00",
            "created_date": "2023-10-05T14:38:51+00:00",
            "state": "AVAILABLE",
            "nameservers": [
                "<NAMESERVER1>",
                "<NAMESERVER2>",
                "<NAMESERVER3>",
                "<NAMESERVER4>"
            ]
        },
        "properties": {
            "zone_name": "<ZONE_NAME>",
            "description": "test_description",
            "enabled": true
        }
    }
}

```

#### For more examples please check out the tests [here](https://github.com/ionos-cloud/module-ansible/tree/master/tests/dns).

&#x20;

&#x20;

## state: **present**

```yaml
  
name: Create Zone
ionoscloudsdk.ionoscloud.dns_zone:
  name: 'test.example.test.ansible.com'
  description: 'test_description'
  enabled: 'False'
register: zone_response

```

#### Available parameters for state **present**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>enabled<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Users can activate and deactivate zones.</td></tr><tr><td>description<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The hosted zone is used for...</td></tr><tr><td>name<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The zone name</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;

## state: **absent**

```yaml
  
name: Delete Zone
ionoscloudsdk.ionoscloud.dns_zone:
  zone: ''
  wait: true
  state: absent

```

#### Available parameters for state **absent**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>zone<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing Zone.</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;

## state: **update**

```yaml
  
name: Update Zone
ionoscloudsdk.ionoscloud.dns_zone:
  zone: ''
  description: 'zone_description_updated'
  enabled: 'True'
  allow_replace: false
  state: update
register: updated_zone_response

```

#### Available parameters for state **update**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>enabled<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Users can activate and deactivate zones.</td></tr><tr><td>description<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The hosted zone is used for...</td></tr><tr><td>name<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The zone name</td></tr><tr><td>zone<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing Zone.</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;
