Skip to content

Commit 6ba39a0

Browse files
committed
Merge branch 'master' into img-ds
2 parents d3e94ca + 7836604 commit 6ba39a0

File tree

6 files changed

+254
-17
lines changed

6 files changed

+254
-17
lines changed

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
# 1.86.0 (December 3, 2025)
2+
3+
## Bug Fixes
4+
5+
### Cloud Logs
6+
* fix entity_label in logs_alert_Definition resource ([6554](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6554))
7+
### AppConfig
8+
* Fixing Issues in App Configuration Service ([6545](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6545))
9+
### Global Catalog
10+
* fixed import of ibm_cm_object ([6553](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6553))
11+
* renamed error variable for GlobalSearchV2 ([6547](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6547))
12+
### IAM
13+
* fix(ibm_iam_account_settings) when only updating user domain restrictions ([6549](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6549))
14+
* update trusted profile id policies to support both iam_id and profile_id ([6543](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6543))
15+
### Power Systems
16+
* Fix instance data sources to use id ([6506](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6506))
17+
* Refactor terraform errors to use new toolchain in network and route data sources ([6552](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6552))
18+
### Schematics
19+
* Fixed agent create crash ([6570](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6570))
20+
### CIS
21+
* handled nil pointer exceptions during runtime ([6550](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6550))
22+
23+
## Enhancements
24+
### VPC Infrastructure
25+
* feat(vpn-gateway) - Add support for VPN Gateway as spoke of Transit Gateway ([6546](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6546))
26+
* updated the import for vpc resources ([6548](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6548))
27+
### Resource Management
28+
* added support for resource_groups datasource ([6499](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6499))
29+
* Added support for working with resource reclamations ([6396](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6396))
30+
### DR Automation
31+
* DR Automation Terraform Apis ([6481](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6481))
32+
### Backup/Recovery
33+
* Add instance and region update in connection token resource ([6566](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6566))
34+
### Cloud Databases
35+
* block unsupported Gen 2 plans with helpful validation message ([6571](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6571))
36+
### Event Notification
37+
* support for smtp user credentials clone ([6535](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6535))
38+
39+
### General
40+
* bump actions/checkout from 5.0.0 to 5.0.1 ([6556](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6556))
41+
* bump golang.org/x/crypto from 0.41.0 to 0.45.0 ([6562](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6562))
42+
* bump `bluemix-go` ([6574](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6574))
43+
### IAM
44+
* add role templates & assignments ([6539](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6539))
45+
### Transit Gateway
46+
* tgw95 - vpn gateway changes ([6339](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6339))
47+
48+
49+
## Documentation
50+
### General
51+
* add provider-wide best practices section to CONTRIBUTING.md ([6573](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6573))
52+
### Project
53+
* regenerate projects provider with new go sdk level and API doc ([6557](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/6557))
54+
55+
56+
157
# 1.85.0 (November 9, 2025)
258

359
## Bug Fixes

ibm/service/catalogmanagement/resource_ibm_cm_object.go

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,66 @@ func ResourceIBMCmObject() *schema.Resource {
2626
ReadContext: resourceIBMCmObjectRead,
2727
UpdateContext: resourceIBMCmObjectUpdate,
2828
DeleteContext: resourceIBMCmObjectDelete,
29-
Importer: &schema.ResourceImporter{},
29+
Importer: &schema.ResourceImporter{
30+
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
31+
32+
catalogManagementClient, err := meta.(conns.ClientSession).CatalogManagementV1()
33+
if err != nil {
34+
tfErr := flex.TerraformErrorf(err, err.Error(), "ibm_cm_object", "import")
35+
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
36+
return nil, fmt.Errorf("error creating catalog management client during import: %w", err)
37+
}
38+
39+
catalogOptions := &catalogmanagementv1.ListCatalogsOptions{}
40+
catalogs, _, err := catalogManagementClient.ListCatalogs(catalogOptions)
41+
if err != nil {
42+
tfErr := flex.TerraformErrorf(err, err.Error(), "ibm_cm_object", "import")
43+
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
44+
return nil, fmt.Errorf("error listing catalogs during import: %w", err)
45+
}
46+
47+
id := d.Id()
48+
found := false
49+
50+
for _, c := range catalogs.Resources {
51+
if c.ID == nil {
52+
continue
53+
}
54+
55+
getObjectOptions := &catalogmanagementv1.GetObjectOptions{
56+
CatalogIdentifier: c.ID,
57+
ObjectIdentifier: &id,
58+
}
59+
60+
catalogObject, res, err := catalogManagementClient.GetObject(getObjectOptions)
61+
62+
if err != nil && res.StatusCode != 404 {
63+
tfErr := flex.TerraformErrorf(err, err.Error(), "ibm_cm_object", "import")
64+
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
65+
continue
66+
}
67+
68+
if catalogObject == nil || catalogObject.CatalogID == nil {
69+
continue
70+
}
71+
72+
if err := d.Set("catalog_id", *catalogObject.CatalogID); err != nil {
73+
tfErr := flex.TerraformErrorf(err, err.Error(), "ibm_cm_object", "import")
74+
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
75+
return nil, fmt.Errorf("error setting catalog_id during import: %w", err)
76+
}
77+
78+
found = true
79+
break
80+
}
81+
82+
if !found {
83+
return nil, fmt.Errorf("ibm_cm_object with id %q not found in any catalog", d.Id())
84+
}
85+
86+
return []*schema.ResourceData{d}, nil
87+
},
88+
},
3089

3190
Schema: map[string]*schema.Schema{
3291
"catalog_id": &schema.Schema{

ibm/service/catalogmanagement/resource_ibm_cm_object_test.go

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package catalogmanagement_test
55

66
import (
77
"fmt"
8+
"regexp"
89
"testing"
910

1011
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
@@ -62,11 +63,55 @@ func testAccCheckIBMCmObjectConfig(name string, parentID string, label string, s
6263
short_description = "%s"
6364
kind = "%s"
6465
tags = ["test1", "test2"]
65-
data = jsonencode(local.catalog_object_data)
6666
}
6767
`, kind, name, parentID, label, shortDescription, kind)
6868
}
6969

70+
func TestAccIBMCmObjectImport(t *testing.T) {
71+
var conf catalogmanagementv1.CatalogObject
72+
name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100))
73+
parentID := "us-south"
74+
label := fmt.Sprintf("tf_label_%d", acctest.RandIntRange(10, 100))
75+
shortDescription := fmt.Sprintf("tf_short_description_%d", acctest.RandIntRange(10, 100))
76+
kind := "vpe"
77+
78+
badID := "this-id-does-not-exist-12345"
79+
80+
resource.Test(t, resource.TestCase{
81+
PreCheck: func() { acc.TestAccPreCheck(t) },
82+
Providers: acc.TestAccProviders,
83+
CheckDestroy: testAccCheckIBMCmObjectDestroy,
84+
Steps: []resource.TestStep{
85+
{
86+
Config: testAccCheckIBMCmObjectConfig(name, parentID, label, shortDescription, kind),
87+
Check: resource.ComposeAggregateTestCheckFunc(
88+
testAccCheckIBMCmObjectExists("ibm_cm_object.cm_object", conf),
89+
resource.TestCheckResourceAttr("ibm_cm_object.cm_object", "name", name),
90+
resource.TestCheckResourceAttr("ibm_cm_object.cm_object", "parent_id", parentID),
91+
resource.TestCheckResourceAttr("ibm_cm_object.cm_object", "label", label),
92+
resource.TestCheckResourceAttr("ibm_cm_object.cm_object", "short_description", shortDescription),
93+
resource.TestCheckResourceAttr("ibm_cm_object.cm_object", "kind", kind),
94+
),
95+
},
96+
97+
{
98+
ResourceName: "ibm_cm_object.cm_object",
99+
ImportState: true,
100+
ImportStateId: badID,
101+
ExpectError: regexp.MustCompile(
102+
`ibm_cm_object with id "` + badID + `" not found in any catalog`,
103+
),
104+
},
105+
106+
{
107+
ResourceName: "ibm_cm_object.cm_object",
108+
ImportState: true,
109+
ImportStateVerify: true,
110+
},
111+
},
112+
})
113+
}
114+
70115
func testAccCheckIBMCmObjectExists(n string, obj catalogmanagementv1.CatalogObject) resource.TestCheckFunc {
71116

72117
return func(s *terraform.State) error {

ibm/service/schematics/resource_ibm_schematics_agent.go

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,14 @@ func resourceIbmSchematicsAgentCreate(context context.Context, d *schema.Resourc
586586
if _, ok := d.GetOk("agent_metadata"); ok {
587587
var agentMetadata []schematicsv1.AgentMetadataInfo
588588
for _, e := range d.Get("agent_metadata").([]interface{}) {
589-
value := e.(map[string]interface{})
589+
if e == nil {
590+
continue
591+
}
592+
593+
value, ok := e.(map[string]interface{})
594+
if !ok {
595+
continue
596+
}
590597
agentMetadataItem, err := resourceIbmSchematicsAgentMapToAgentMetadataInfo(value)
591598
if err != nil {
592599
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("resourceIbmSchematicsAgentCreate failed: %s", err.Error()), "ibm_schematics_agent", "create")
@@ -1061,24 +1068,48 @@ func resourceIbmSchematicsAgentDelete(context context.Context, d *schema.Resourc
10611068
deleteAgentDataOptions.Headers = ff
10621069

10631070
deleteAgentDataOptions.SetAgentID(d.Id())
1071+
// get the agent data and check if deploy resources exist and then call this
10641072

1065-
// first try destroying resources associated with agent deploy and then delete the agent
1066-
1067-
deleteAgentResourcesOptions := &schematicsv1.DeleteAgentResourcesOptions{}
1068-
deleteAgentResourcesOptions.Headers = ff
1073+
getAgentDataOptions := &schematicsv1.GetAgentDataOptions{
1074+
Profile: core.StringPtr("detailed"),
1075+
}
10691076

1070-
deleteAgentResourcesOptions.SetAgentID(d.Id())
1071-
deleteAgentResourcesOptions.SetRefreshToken(iamRefreshToken)
1077+
getAgentDataOptions.SetAgentID(d.Id())
10721078

1073-
response, err := schematicsClient.DeleteAgentResourcesWithContext(context, deleteAgentResourcesOptions)
1079+
agentData, response, err := schematicsClient.GetAgentDataWithContext(context, getAgentDataOptions)
10741080
if err != nil {
1075-
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("resourceIbmSchematicsAgentDelete DeleteAgentResourcesWithContext failed with error: %s and response:\n%s", err, response), "ibm_schematics_agent", "delete")
1081+
if response != nil && response.StatusCode == 404 {
1082+
d.SetId("")
1083+
return nil
1084+
}
1085+
1086+
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("resourceIbmSchematicsAgentUpdate GetAgentDataWithContext failed with error: %s and response:\n%s", err, response), "ibm_schematics_agent", "update")
10761087
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
1077-
} else {
1078-
_, err = isWaitForAgentDestroyResources(context, schematicsClient, *deleteAgentResourcesOptions.AgentID, d.Timeout(schema.TimeoutDelete))
1079-
if err != nil {
1088+
return tfErr.GetDiag()
1089+
}
1090+
1091+
// first try destroying resources associated with agent deploy and then delete the agent
1092+
if agentData.RecentDeployJob != nil {
1093+
if agentData.RecentDeployJob.JobID != nil {
1094+
// first try destroying resources associated with agent deploy and then delete the agent
1095+
deleteAgentResourcesOptions := &schematicsv1.DeleteAgentResourcesOptions{}
1096+
deleteAgentResourcesOptions.Headers = ff
1097+
1098+
deleteAgentResourcesOptions.SetAgentID(d.Id())
1099+
deleteAgentResourcesOptions.SetRefreshToken(iamRefreshToken)
10801100

1101+
response, err := schematicsClient.DeleteAgentResourcesWithContext(context, deleteAgentResourcesOptions)
1102+
if err != nil {
1103+
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("resourceIbmSchematicsAgentDelete DeleteAgentResourcesWithContext failed with error: %s and response:\n%s", err, response), "ibm_schematics_agent", "delete")
1104+
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
1105+
} else {
1106+
_, err = isWaitForAgentDestroyResources(context, schematicsClient, *deleteAgentResourcesOptions.AgentID, d.Timeout(schema.TimeoutDelete))
1107+
if err != nil {
1108+
1109+
}
1110+
}
10811111
}
1112+
10821113
}
10831114

10841115
// After deploy associated resources are destroyed, now attempt to delete the agent

ibm/service/schematics/resource_ibm_schematics_agent_test.go

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ func TestAccIbmSchematicsAgentBasic(t *testing.T) {
5858
func TestAccIbmSchematicsAgentAllArgs(t *testing.T) {
5959
var conf schematicsv1.AgentData
6060
name := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100))
61-
version := "1.1.0"
61+
version := "1.4.0"
6262
schematicsLocation := "us-south"
6363
agentLocation := "eu-de"
6464
nameUpdate := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100))
65-
versionUpdate := "1.2.0"
65+
versionUpdate := "1.5.0"
6666
schematicsLocationUpdate := "us-east"
6767
agentLocationUpdate := "eu-gb"
6868
description := fmt.Sprintf("tf_description_%d", acctest.RandIntRange(10, 100))
@@ -94,6 +94,19 @@ func TestAccIbmSchematicsAgentAllArgs(t *testing.T) {
9494
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "description", descriptionUpdate),
9595
),
9696
},
97+
resource.TestStep{
98+
Config: testAccIbmSchematicsAgentConfig_withMetadata(name, version, schematicsLocation, agentLocation),
99+
Check: resource.ComposeTestCheckFunc(
100+
testAccCheckIbmSchematicsAgentExists("ibm_schematics_agent.schematics_agent_instance", conf),
101+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "name", name),
102+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "version", version),
103+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "schematics_location", schematicsLocation),
104+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "agent_location", agentLocation),
105+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "agent_metadata.#", "2"),
106+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "agent_metadata.0.name", "purpose"),
107+
resource.TestCheckResourceAttr("ibm_schematics_agent.schematics_agent_instance", "agent_metadata.0.value.0", "terraform"),
108+
),
109+
},
97110
resource.TestStep{
98111
ResourceName: "ibm_schematics_agent.schematics_agent_instance",
99112
ImportState: true,
@@ -151,6 +164,39 @@ func testAccCheckIbmSchematicsAgentConfig(name string, version string, schematic
151164
`, name, version, schematicsLocation, agentLocation, description)
152165
}
153166

167+
func testAccIbmSchematicsAgentConfig_withMetadata(name, version, schematicsLocation, agentLocation string) string {
168+
return fmt.Sprintf(`
169+
resource "ibm_schematics_agent" "schematics_agent_instance" {
170+
name = "%s"
171+
resource_group = "Default"
172+
version = "%s"
173+
schematics_location = "%s"
174+
agent_location = "%s"
175+
tags = ["test-tag"]
176+
agent_infrastructure {
177+
infra_type = "ibm_kubernetes"
178+
cluster_id = "cluster_id"
179+
cluster_resource_group = "cluster_resource_group"
180+
cos_instance_name = "cos_instance_name"
181+
cos_bucket_name = "cos_bucket_name"
182+
cos_bucket_region = "cos_bucket_region"
183+
}
184+
185+
// This block triggers the loop at line 589
186+
agent_metadata {
187+
name = "purpose"
188+
value = ["terraform"]
189+
}
190+
// Adding a second block to ensure the loop handles multiple items
191+
agent_metadata {
192+
name = "purpose"
193+
value = ["testing"]
194+
}
195+
196+
}
197+
`, name, version, schematicsLocation, agentLocation)
198+
}
199+
154200
func testAccCheckIbmSchematicsAgentExists(n string, obj schematicsv1.AgentData) resource.TestCheckFunc {
155201

156202
return func(s *terraform.State) error {

version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
// Version is the current provider main version
8-
const Version = "1.85.0"
8+
const Version = "1.86.0"
99

1010
// GitCommit is the git commit that was compiled. This will be filled in by the compiler.
1111
var GitCommit string

0 commit comments

Comments
 (0)