Skip to content

Commit

Permalink
Removed consumer_ids computed attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasslash committed Jan 31, 2022
1 parent fdf466b commit efc9291
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 39 deletions.
12 changes: 0 additions & 12 deletions tfe/resource_tfe_organization_module_sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func resourceTFEOrganizationModuleSharing() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
Required: true,
},

"consumer_ids": {
Type: schema.TypeMap,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -73,7 +68,6 @@ func resourceTFEOrganizationModuleSharingRead(d *schema.ResourceData, meta inter
tfeClient := meta.(*tfe.Client)

options := tfe.AdminOrganizationListModuleConsumersOptions{}
consumerIDs := make(map[string]string)

log.Printf("[DEBUG] Read configuration of module sharing for organization: %s", d.Id())
for {
Expand All @@ -87,19 +81,13 @@ func resourceTFEOrganizationModuleSharingRead(d *schema.ResourceData, meta inter
return fmt.Errorf("Error reading organization %s module consumer list: %w", d.Id(), err)
}

for _, consumer := range consumerList.Items {
consumerIDs[consumer.Name] = consumer.ExternalID
}

if consumerList.CurrentPage >= consumerList.TotalPages {
break
}

options.PageNumber = consumerList.NextPage
}

d.Set("consumer_ids", consumerIDs)

return nil
}

Expand Down
21 changes: 0 additions & 21 deletions tfe/resource_tfe_organization_module_sharing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ func TestAccTFEOrganizationModuleSharing_basic(t *testing.T) {
"tfe_organization_module_sharing.producer", "module_consumers.0"),
resource.TestCheckResourceAttrSet(
"tfe_organization_module_sharing.producer", "module_consumers.1"),

// consumer_ids attribute
resource.TestCheckResourceAttr(
"tfe_organization_module_sharing.producer", "consumer_ids.%", "2"),
resource.TestCheckResourceAttrSet(
"tfe_organization_module_sharing.producer", fmt.Sprintf("consumer_ids.%s", fmt.Sprintf("tst-terraform-%d", rInt2))),
resource.TestCheckResourceAttrSet(
"tfe_organization_module_sharing.producer", fmt.Sprintf("consumer_ids.%s", fmt.Sprintf("tst-terraform-%d", rInt3))),
),
},
},
Expand Down Expand Up @@ -81,14 +73,6 @@ func TestAccTFEOrganizationModuleSharing_emptyOrg(t *testing.T) {
"tfe_organization_module_sharing.foo", "module_consumers.0", ""),
resource.TestCheckResourceAttr(
"tfe_organization_module_sharing.foo", "module_consumers.1", fmt.Sprintf("tst-terraform-%d", rInt2)),

// consumer_ids attribute
// since we've provided an empty string, we should only
// have one valid entry
resource.TestCheckResourceAttr(
"tfe_organization_module_sharing.foo", "consumer_ids.%", "1"),
resource.TestCheckResourceAttrSet(
"tfe_organization_module_sharing.foo", fmt.Sprintf("consumer_ids.%s", fmt.Sprintf("tst-terraform-%d", rInt2))),
),
},
},
Expand Down Expand Up @@ -118,11 +102,6 @@ func TestAccTFEOrganizationModuleSharing_stopSharing(t *testing.T) {
// module_consumers attribute
resource.TestCheckResourceAttr(
"tfe_organization_module_sharing.foo", "module_consumers.#", "0"),

// consumer_ids attribute
// since we've stopped sharing, this should be an empty map
resource.TestCheckResourceAttr(
"tfe_organization_module_sharing.foo", "consumer_ids.%", "0"),
),
},
},
Expand Down
6 changes: 0 additions & 6 deletions website/docs/r/organization_module_sharing.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,3 @@ The following arguments are supported:

* `organization` - (Required) Name of the organization.
* `module_consumers` - (Required) Names of the organizations to consume the module registry.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `consumer_ids` - A map of organization names and their opaque, immutable IDs, which look like `org-<RANDOM STRING>`.

0 comments on commit efc9291

Please sign in to comment.