Skip to content

Commit

Permalink
fix(network): mark fields as computed in data source
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 committed Dec 4, 2023
1 parent 9df3599 commit e902c35
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 e902c35

Please sign in to comment.