Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hetzner.hcloud.hcloud_network module is missing network_zone option #347

Closed
jzielke84 opened this issue Oct 4, 2023 · 4 comments
Closed
Labels
usage This is an usage issue

Comments

@jzielke84
Copy link

SUMMARY

Module hetzner.hcloud.hcloud_network doesn't allow setting a zone (e.g. eu-central), which is required to attach server.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

hetzner.hcloud.hcloud_network

ANSIBLE VERSION
ansible [core 2.15.4]
  config file = /Users/juz/repos/ansible_deployments/ansible.cfg
  configured module search path = ['/Users/juz/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/juz/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/opt/python@3.11/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
@jooola
Copy link
Collaborator

jooola commented Oct 5, 2023

To define the network zone, you should probably use the subnetwork module: https://docs.ansible.com/ansible/latest/collections/hetzner/hcloud/hcloud_subnetwork_module.html#parameter-network_zone

@jooola jooola added question Further information is requested usage This is an usage issue and removed question Further information is requested labels Oct 5, 2023
@jooola jooola closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2023
@jzielke84
Copy link
Author

jzielke84 commented Oct 5, 2023

@jooola We're talking about a network, not a subnetwork. Lookup the hetzner cloud: When you create a network, eu-central is automatically assigned. There is no need to create another subnetwork:

image

Please re-open the request.

@jooola
Copy link
Collaborator

jooola commented Oct 5, 2023

When creating a network on the console, a subnet is automatically added to the network after its creation. If you delete all the subnets in the network, you will be able to create a new subnetwork and define the network zone:

image

If you look at the API reference https://docs.hetzner.cloud/#networks-create-a-network, you can see that the subnetworks are holding the network zone information.

So you have to do the following:

- name: Create a network
  hetzner.hcloud.hcloud_network:
    name: my-network
    ip_range: 10.0.0.0/8
    state: present

- name: Create a subnetwork
  hetzner.hcloud.hcloud_subnetwork:
    network: my-network
    ip_range: 10.0.0.0/16
    network_zone: eu-central
    type: cloud
    state: present

@jzielke84
Copy link
Author

OK, thank you for clarifying. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage This is an usage issue
Projects
None yet
Development

No branches or pull requests

2 participants