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

[Bug]: Data source hcloud_network does not properly resolve dependencies #513

Closed
FriesPascal opened this issue Mar 23, 2022 · 4 comments
Closed
Assignees

Comments

@FriesPascal
Copy link

What happened?

When using the data source hcloud_network to read infos about a network that is created in the same run as the data source, ip_range, labels, name, and delete_protection are returned immediately as null instead of reading them from the network. I think that is because they are not listed as computed in https://github.com/hetznercloud/terraform-provider-hcloud/blob/master/internal/network/data_source.go#L27.

This becomes a problem, when trying to define a module, that lets you pass in network ids, and attaches servers to these networks and adds allow-rules to a corresponding firewall.

What did you expect to happen?

data.hcloud_network should mark ip_range, labels, name, and delete_protection as (known after apply) when the network is read via id and does not exist until the next apply.

Please provide a minimal working example

resource "hcloud_network" "this" {
  name = "test"
  ip_range = "10.0.0.0/24"
}

data "hcloud_network" "this" {
  id = hcloud_network.this.id
}

# contains several instances of null :(
output "debug" {
  value = data.hcloud_network.this
}
@github-actions
Copy link

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Oct 12, 2023
@apricote apricote removed the stale label Oct 13, 2023
@apricote apricote self-assigned this Dec 4, 2023
apricote added a commit that referenced this issue Dec 4, 2023
This fixes an issue where resources depending on the data source get
evaluated before the actual field values are available.

See #513
@apricote
Copy link
Member

apricote commented Dec 4, 2023

Thanks for the report and sorry for letting it go stale. I can confirm the issue and pushed a fix in #805.

apricote added a commit that referenced this issue Dec 11, 2023
This fixes an issue where resources depending on the data source get
evaluated before the actual field values are available.

See #513
Copy link

github-actions bot commented Mar 3, 2024

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Mar 3, 2024
@jooola
Copy link
Member

jooola commented Mar 4, 2024

Closing as solved by #805

@jooola jooola closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants