Skip to content

Commit 344eb7c

Browse files
authored
fix: correct argument capitalization, update cm account doc (IBM-Cloud#6486)
* fix: correct argument capitalization, update cm account doc * fix: add update test
1 parent 91292e4 commit 344eb7c

File tree

3 files changed

+84
-8
lines changed

3 files changed

+84
-8
lines changed

ibm/service/catalogmanagement/resource_ibm_cm_account.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ func resourceIBMCmAccountUpdate(context context.Context, d *schema.ResourceData,
384384
updateCatalogAccountOptions.SetID(*account.ID)
385385
updateCatalogAccountOptions.SetRev(*account.Rev)
386386

387-
if d.HasChange("hide_IBM_cloud_catalog") {
388-
if v, ok := d.GetOk("hide_IBM_cloud_catalog"); ok {
387+
if d.HasChange("hide_ibm_cloud_catalog") {
388+
if v, ok := d.GetOk("hide_ibm_cloud_catalog"); ok {
389389
updateCatalogAccountOptions.SetHideIBMCloudCatalog(v.(bool))
390390
}
391391
} else if account.HideIBMCloudCatalog != nil {

ibm/service/catalogmanagement/resource_ibm_cm_account_test.go

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ func TestAccIBMCmAccountBasic(t *testing.T) {
3030
Config: testAccCheckIBMCmAccountConfigBasic(),
3131
Check: resource.ComposeAggregateTestCheckFunc(
3232
testAccCheckIBMCmAccountExists("ibm_cm_account.cm_account", conf),
33+
resource.TestCheckResourceAttr("ibm_cm_account.cm_account", "hide_ibm_cloud_catalog", "true"),
3334
),
3435
},
3536
resource.TestStep{
36-
ResourceName: "ibm_cm_account.cm_account",
37-
ImportState: true,
38-
ImportStateVerify: true,
37+
Config: testAccCheckIBMCmAccountConfigBasicUpdate(),
38+
Check: resource.ComposeAggregateTestCheckFunc(
39+
testAccCheckIBMCmAccountExists("ibm_cm_account.cm_account", conf),
40+
resource.TestCheckResourceAttr("ibm_cm_account.cm_account", "hide_ibm_cloud_catalog", "false"),
41+
),
3942
},
4043
},
4144
})
@@ -49,6 +52,37 @@ func testAccCheckIBMCmAccountConfigBasic() string {
4952
}
5053
5154
resource "ibm_cm_account" "cm_account" {
55+
hide_ibm_cloud_catalog = true
56+
terraform_engines {
57+
name = "my-tfe-instance"
58+
type = "terraform-enterprise"
59+
public_endpoint = "foo"
60+
private_endpoint = "foo"
61+
api_token = "foo"
62+
da_creation {
63+
enabled = true
64+
default_private_catalog_id = ibm_cm_catalog.cm_catalog.id
65+
polling_info {
66+
scopes {
67+
name = "foo-project"
68+
type = "project"
69+
}
70+
}
71+
}
72+
}
73+
}
74+
`)
75+
}
76+
77+
func testAccCheckIBMCmAccountConfigBasicUpdate() string {
78+
return fmt.Sprintf(`
79+
resource "ibm_cm_catalog" "cm_catalog" {
80+
label = "test_tf_account_catalog_label_1"
81+
kind = "offering"
82+
}
83+
84+
resource "ibm_cm_account" "cm_account" {
85+
hide_ibm_cloud_catalog = false
5286
terraform_engines {
5387
name = "my-tfe-instance"
5488
type = "terraform-enterprise"

website/docs/r/cm_account.html.markdown

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,10 @@ resource "ibm_cm_account" "cm_account_instance" {
6969
```
7070

7171

72-
## Attribute Reference
72+
## Argument Reference
7373

7474
After your resource is created, you can read values from the listed arguments and the following attributes.
7575

76-
* `id` - The unique identifier of the cm_account.
7776
* `account_filters` - (List, Optional) Filters for account and catalog filters.
7877
Nested schema for **account_filters**:
7978
* `category_filters` - (List, Optional) Filter against offering properties.
@@ -94,6 +93,50 @@ Nested schema for **account_filters**:
9493
* `include_all` - (Boolean, Optional) -> true - Include all of the public catalog when filtering. Further settings will specifically exclude some offerings. false - Exclude all of the public catalog when filtering. Further settings will specifically include some offerings.
9594
* `hide_ibm_cloud_catalog` - (Boolean, Optional) Hide the public catalog in this account.
9695
* `region_filter` - (String, Optional) Region filter string.
96+
* `terraform_engines` - (List, Optional) List of terraform engines configured for this account.
97+
Nested schema for **terraform_engines**:
98+
* `api_token` - (String, Optional) The api key used to access the engine instance.
99+
* `da_creation` - (List, Optional) The settings that determines how deployable architectures are auto-created from workspaces in the terraform engine.
100+
Nested schema for **da_creation**:
101+
* `default_private_catalog_id` - (String, Optional) Default private catalog to create the deployable architectures in.
102+
* `enabled` - (Boolean, Optional) Determines whether deployable architectures are auto-created from workspaces in the engine.
103+
* `polling_info` - (List, Optional) Determines which workspace scope to query to auto-create deployable architectures from.
104+
Nested schema for **polling_info**:
105+
* `scopes` - (List, Optional) List of scopes to auto-create deployable architectures from workspaces in the engine.
106+
Nested schema for **scopes**:
107+
* `name` - (String, Optional) Identifier for the specified type in the scope.
108+
* `type` - (String, Optional) Scope to auto-create deployable architectures from. The supported scopes today are workspace, org, and project.
109+
* `name` - (String, Optional) User provided name for the specified engine.
110+
* `private_endpoint` - (String, Optional) The private endpoint for the engine instance.
111+
* `public_endpoint` - (String, Optional) The public endpoint for the engine instance.
112+
* `type` - (String, Optional) The terraform engine type. The only one supported at the moment is terraform-enterprise.
113+
114+
115+
## Attribute Reference
116+
117+
After your resource is created, you can read values from the listed arguments and the following attributes.
118+
119+
* `id` - The unique identifier of the cm_account.
120+
* `account_filters` - (List) Filters for account and catalog filters.
121+
Nested schema for **account_filters**:
122+
* `category_filters` - (List) Filter against offering properties.
123+
Nested schema for **category_filters**:
124+
* `category_name` - (String, Required) Name of the category.
125+
* `include` - (Boolean) Whether to include the category in the catalog filter.
126+
* `filter` - (List) Filter terms related to the category.
127+
Nested schema for **filter**:
128+
* `filter_terms` - (List) List of values to match against. If include is true, then if the offering has one of the values then the offering is included. If include is false, then if the offering has one of the values then the offering is excluded.
129+
* `id_filters` - (List) Filter on offering ID's. There is an include filter and an exclule filter. Both can be set.
130+
Nested schema for **id_filters**:
131+
* `exclude` - (List) Offering filter terms.
132+
Nested schema for **exclude**:
133+
* `filter_terms` - (List) List of values to match against. If include is true, then if the offering has one of the values then the offering is included. If include is false, then if the offering has one of the values then the offering is excluded.
134+
* `include` - (List) Offering filter terms.
135+
Nested schema for **include**:
136+
* `filter_terms` - (List) List of values to match against. If include is true, then if the offering has one of the values then the offering is included. If include is false, then if the offering has one of the values then the offering is excluded.
137+
* `include_all` - (Boolean) -> true - Include all of the public catalog when filtering. Further settings will specifically exclude some offerings. false - Exclude all of the public catalog when filtering. Further settings will specifically include some offerings.
138+
* `hide_ibm_cloud_catalog` - (Boolean) Hide the public catalog in this account.
139+
* `region_filter` - (String) Region filter string.
97140
* `rev` - (String) Cloudant revision.
98141
* `terraform_engines` - (List) List of terraform engines configured for this account.
99142
Nested schema for **terraform_engines**:
@@ -117,7 +160,6 @@ Nested schema for **terraform_engines**:
117160
* `public_endpoint` - (String) The public endpoint for the engine instance.
118161
* `type` - (String) The terraform engine type. The only one supported at the moment is terraform-enterprise.
119162

120-
121163
## Import
122164

123165
You can import the `ibm_cm_account` resource by using `id`. Account identification.

0 commit comments

Comments
 (0)