Skip to content

Commit

Permalink
Force new resource when renaming cloudprovider
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlmartin committed Oct 12, 2021
1 parent 018915b commit bfb4d3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/provider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func commonCloudProviderSchema() map[string]*schema.Schema {
Description: "The name of the cloud provider.",
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"usage_scope": usageScopeSchema(),
}
Expand Down
8 changes: 8 additions & 0 deletions internal/provider/resource_cloudprovider_kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestAccResourceK8sCloudProviderConnector_delegate(t *testing.T) {

var (
name = fmt.Sprintf("%s_%s", t.Name(), utils.RandStringBytes(4))
updatedName = fmt.Sprintf("%s_updated", name)
resourceName = "harness_cloudprovider_kubernetes.test"
)

Expand All @@ -31,6 +32,13 @@ func TestAccResourceK8sCloudProviderConnector_delegate(t *testing.T) {
testAccCheckK8sCloudProviderExists(t, resourceName, name),
),
},
{
Config: testAccResourceK8sCloudProvider_delegate(updatedName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", updatedName),
testAccCheckK8sCloudProviderExists(t, resourceName, updatedName),
),
},
{
ResourceName: resourceName,
ImportState: true,
Expand Down

0 comments on commit bfb4d3e

Please sign in to comment.