Skip to content

Commit

Permalink
Merge pull request #572 from hashicorp/uk1288-prevent-unnecessary-tfe…
Browse files Browse the repository at this point in the history
…_registry_modules-replacement

Changes to prevent unnecessary tfe_registry_modules replacement
  • Loading branch information
brandonc authored Jul 27, 2022
2 parents 81b587b + df18056 commit 05f353a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.35.0 (July 27th, 2022)

BUG FIXES:
* r/tfe_registry_module: Added `Computed` modifier to attributes in order to prevent unnecessary resource replacement ([#572](https://github.com/hashicorp/terraform-provider-tfe/pull/572))

## 0.34.0 (July 26th, 2022)

BUG FIXES:
Expand Down
5 changes: 5 additions & 0 deletions tfe/resource_tfe_registry_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ func resourceTFERegistryModule() *schema.Resource {
"organization": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"module_provider": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ExactlyOneOf: []string{"vcs_repo"},
RequiredWith: []string{"organization", "name"},
},
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"vcs_repo": {
Expand Down Expand Up @@ -68,12 +71,14 @@ func resourceTFERegistryModule() *schema.Resource {
"namespace": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
RequiredWith: []string{"registry_name"},
},
"registry_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
RequiredWith: []string{"module_provider"},
ValidateFunc: validation.StringInSlice(
Expand Down
18 changes: 6 additions & 12 deletions tfe/resource_tfe_registry_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ func TestAccTFERegistryModule_vcs(t *testing.T) {
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_vcs(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_vcs(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckTFERegistryModuleExists(
"tfe_registry_module.foobar",
Expand Down Expand Up @@ -111,8 +110,7 @@ func TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithoutRegistryName(t *
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_privateRMWithoutRegistryName(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_privateRMWithoutRegistryName(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckTFERegistryModuleExists(
"tfe_registry_module.foobar",
Expand Down Expand Up @@ -161,8 +159,7 @@ func TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithRegistryName(t *tes
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_privateRMWithRegistryName(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_privateRMWithRegistryName(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckTFERegistryModuleExists(
"tfe_registry_module.foobar",
Expand Down Expand Up @@ -251,8 +248,7 @@ func TestAccTFERegistryModuleImport_vcsPrivateRMDeprecatedFormat(t *testing.T) {
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_vcs(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_vcs(rInt),
},
{
ResourceName: "tfe_registry_module.foobar",
Expand All @@ -276,8 +272,7 @@ func TestAccTFERegistryModuleImport_vcsPrivateRMRecommendedFormat(t *testing.T)
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_vcs(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_vcs(rInt),
},
{
ResourceName: "tfe_registry_module.foobar",
Expand All @@ -300,8 +295,7 @@ func TestAccTFERegistryModuleImport_nonVCSPrivateRM(t *testing.T) {
CheckDestroy: testAccCheckTFERegistryModuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccTFERegistryModule_privateRMWithRegistryName(rInt),
ExpectNonEmptyPlan: true,
Config: testAccTFERegistryModule_privateRMWithRegistryName(rInt),
},
{
ResourceName: "tfe_registry_module.foobar",
Expand Down

0 comments on commit 05f353a

Please sign in to comment.