diff --git a/internal/certificate/data_source.go b/internal/certificate/data_source.go index c02a214f9..a8f4b4a34 100644 --- a/internal/certificate/data_source.go +++ b/internal/certificate/data_source.go @@ -10,8 +10,8 @@ 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/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -77,7 +77,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudCertificateRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "with_selector": { diff --git a/internal/firewall/data_source.go b/internal/firewall/data_source.go index c4fadd4e6..7405845e5 100644 --- a/internal/firewall/data_source.go +++ b/internal/firewall/data_source.go @@ -12,8 +12,8 @@ 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/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -102,7 +102,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudFirewallRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "most_recent": { diff --git a/internal/floatingip/data_source.go b/internal/floatingip/data_source.go index 0d769d205..e2f96dc42 100644 --- a/internal/floatingip/data_source.go +++ b/internal/floatingip/data_source.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -77,7 +77,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudFloatingIPRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "selector": { diff --git a/internal/image/data_source.go b/internal/image/data_source.go index aec77571b..cdba8483d 100644 --- a/internal/image/data_source.go +++ b/internal/image/data_source.go @@ -14,8 +14,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -88,7 +88,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudImageRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "most_recent": { diff --git a/internal/loadbalancer/data_source.go b/internal/loadbalancer/data_source.go index ab9200b6f..357ab855b 100644 --- a/internal/loadbalancer/data_source.go +++ b/internal/loadbalancer/data_source.go @@ -11,8 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -227,7 +227,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudLoadBalancerRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "with_selector": { diff --git a/internal/network/data_source.go b/internal/network/data_source.go index 9028c26d0..46cdfc4fd 100644 --- a/internal/network/data_source.go +++ b/internal/network/data_source.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -63,7 +63,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudNetworkRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "most_recent": { diff --git a/internal/placementgroup/data_source.go b/internal/placementgroup/data_source.go index 7307dd5a8..54768d426 100644 --- a/internal/placementgroup/data_source.go +++ b/internal/placementgroup/data_source.go @@ -13,8 +13,8 @@ import ( "golang.org/x/net/context" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -61,7 +61,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudPlacementGroupRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "most_recent": { diff --git a/internal/primaryip/data_source.go b/internal/primaryip/data_source.go index 1a0616bd4..cc0f85df0 100644 --- a/internal/primaryip/data_source.go +++ b/internal/primaryip/data_source.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" @@ -82,7 +82,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudPrimaryIPRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "with_selector": { diff --git a/internal/server/data_source.go b/internal/server/data_source.go index b4c49c201..7b97d4e91 100644 --- a/internal/server/data_source.go +++ b/internal/server/data_source.go @@ -11,8 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -116,7 +116,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudServerRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "selector": { diff --git a/internal/util/datasourceutil/merge_schema.go b/internal/util/datasourceutil/merge_schema.go deleted file mode 100644 index c8ad046cd..000000000 --- a/internal/util/datasourceutil/merge_schema.go +++ /dev/null @@ -1,11 +0,0 @@ -package datasourceutil - -import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - -func MergeSchema(one map[string]*schema.Schema, two map[string]*schema.Schema) map[string]*schema.Schema { - for key, val := range two { - one[key] = val - } - - return one -} diff --git a/internal/volume/data_source.go b/internal/volume/data_source.go index b7554a81c..5a9fde7a8 100644 --- a/internal/volume/data_source.go +++ b/internal/volume/data_source.go @@ -11,8 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hetznercloud/hcloud-go/hcloud" - "github.com/hetznercloud/terraform-provider-hcloud/internal/util/datasourceutil" "github.com/hetznercloud/terraform-provider-hcloud/internal/util/hcloudutil" + "github.com/hetznercloud/terraform-provider-hcloud/internal/util/merge" ) const ( @@ -68,7 +68,7 @@ func getCommonDataSchema() map[string]*schema.Schema { func DataSource() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceHcloudVolumeRead, - Schema: datasourceutil.MergeSchema( + Schema: merge.Maps( getCommonDataSchema(), map[string]*schema.Schema{ "selector": {