diff --git a/go.mod b/go.mod index df51040..1a4f0db 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golangci/golangci-lint v1.55.2 github.com/hashicorp/terraform-plugin-docs v0.19.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 - github.com/hewlettpackard/hpegl-metal-client v1.5.10 + github.com/hewlettpackard/hpegl-metal-client v1.5.11 github.com/hewlettpackard/hpegl-provider-lib v0.0.14 github.com/stretchr/testify v1.9.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 41899ef..7fc7327 100644 --- a/go.sum +++ b/go.sum @@ -401,8 +401,8 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hewlettpackard/hpegl-metal-client v1.5.10 h1:8E7JWzFrQoVH4x1EKTIG5vrKmWdXhennQquRuBne8hI= -github.com/hewlettpackard/hpegl-metal-client v1.5.10/go.mod h1:E72/o32a5WwVAUhXvXEUKZOGiSA84hsTS+xezFqtbgU= +github.com/hewlettpackard/hpegl-metal-client v1.5.11 h1:uTCGYRrKGG/Nd5i7KLL9jSW1XDYrB1pKI3mpZsKtSYM= +github.com/hewlettpackard/hpegl-metal-client v1.5.11/go.mod h1:E72/o32a5WwVAUhXvXEUKZOGiSA84hsTS+xezFqtbgU= github.com/hewlettpackard/hpegl-provider-lib v0.0.14 h1:fwIXQsdEdeYYvaJQr1vwfPgCGYKgZaP7kL0p8xbBQJ4= github.com/hewlettpackard/hpegl-provider-lib v0.0.14/go.mod h1:7StTTobQIl8pZCLcJnZm0/+N4lNE2MO6H/U0LhTfXog= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= diff --git a/internal/acceptance_test/resource_project_test.go b/internal/acceptance_test/resource_project_test.go index 4943ce2..b31a1e3 100644 --- a/internal/acceptance_test/resource_project_test.go +++ b/internal/acceptance_test/resource_project_test.go @@ -1,4 +1,4 @@ -// (C) Copyright 2022 Hewlett Packard Enterprise Development LP +// (C) Copyright 2022,2024 Hewlett Packard Enterprise Development LP package acceptance_test @@ -88,6 +88,7 @@ func projectBasic(op string) string { private_networks = 30 } sites=["1ad98170-993e-4bfc-8b84-e689ea9a429b"] + volume_replication_enabled = true }`, name, company, hosts) return common + res diff --git a/internal/resources/resource_project.go b/internal/resources/resource_project.go index 65202c8..55db681 100644 --- a/internal/resources/resource_project.go +++ b/internal/resources/resource_project.go @@ -1,4 +1,4 @@ -// (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP +// (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP package resources @@ -32,6 +32,8 @@ const ( pPrivateNetworks = "private_networks" pInstanceTypes = "instance_types" pPermittedImages = "permitted_images" + + pVolumeReplicationEnabled = "volume_replication_enabled" ) func limitsSchema() map[string]*schema.Schema { @@ -163,6 +165,14 @@ func projectSchema() map[string]*schema.Schema { Type: schema.TypeString, }, }, + + pVolumeReplicationEnabled: { + Type: schema.TypeBool, + Optional: true, + Default: false, + ForceNew: true, + Description: "Volume replication is enabled for the project if set.", + }, } } @@ -190,6 +200,8 @@ func resourceMetalProjectCreate(d *schema.ResourceData, meta interface{}) (err e np := rest.NewProject{ Name: d.Get(pName).(string), + + VolumeReplicationEnabled: d.Get(pVolumeReplicationEnabled).(bool), } if list, ok := d.Get(pProfile).([]interface{}); ok && len(list) == 1 { @@ -372,6 +384,10 @@ func resourceMetalProjectRead(d *schema.ResourceData, meta interface{}) (err err } } + if err = d.Set(pVolumeReplicationEnabled, project.VolumeReplicationEnabled); err != nil { + return err //nolint:wrapcheck // defer func is wrapping the error. + } + return nil } diff --git a/version b/version index 825879a..3cb7374 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.3.52 +1.3.53