Skip to content

Commit

Permalink
fix(network): mark data source fields as computed (#805)
Browse files Browse the repository at this point in the history
This fixes an issue where resources depending on the data source get
evaluated before the actual field values are available.

See #513
  • Loading branch information
apricote authored Dec 11, 2023
1 parent 53069ac commit 63e157c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/network/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/hetznercloud/hcloud-go/hcloud"
"github.com/hetznercloud/terraform-provider-hcloud/internal/hcclient"
"github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil"
Expand All @@ -34,14 +35,17 @@ func getCommonDataSchema() map[string]*schema.Schema {
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"ip_range": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"labels": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
},
"delete_protection": {
Type: schema.TypeBool,
Expand All @@ -63,8 +67,9 @@ func DataSource() *schema.Resource {
getCommonDataSchema(),
map[string]*schema.Schema{
"most_recent": {
Type: schema.TypeBool,
Optional: true,
Type: schema.TypeBool,
Optional: true,
Deprecated: "This attribute has no purpose.",
},
"with_selector": {
Type: schema.TypeString,
Expand Down

0 comments on commit 63e157c

Please sign in to comment.