Skip to content

Commit

Permalink
Updating to latest schematics sdk and updating sch_agent resource to …
Browse files Browse the repository at this point in the history
…enable force deletion by default (IBM-Cloud#5660)

* Updated schematics go sdk version to v0.3.0

* Fix issue5475

* Changed the supported tf version for ws creation from 1.4-1.9
  • Loading branch information
VaishnaviGopal authored and Ramya-c4 committed Sep 26, 2024
1 parent 47a713f commit e96fad0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/sarama v1.41.2
github.com/IBM/scc-go-sdk/v5 v5.4.1
github.com/IBM/schematics-go-sdk v0.2.3
github.com/IBM/schematics-go-sdk v0.3.0
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.6
github.com/IBM/vmware-go-sdk v0.1.2
github.com/IBM/vpc-beta-go-sdk v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c=
github.com/IBM/sarama v1.41.2/go.mod h1:xdpu7sd6OE1uxNdjYTSKUfY8FaKkJES9/+EyjSgiGQk=
github.com/IBM/scc-go-sdk/v5 v5.4.1 h1:RXIuxOo9/hxkWyHCI69ae+KIJgSbXcAkJwTEl+fO3LQ=
github.com/IBM/scc-go-sdk/v5 v5.4.1/go.mod h1:2xQTDgNXG5QMEfQxBDKB067z+5ha6OgcaKCTcdGDAo8=
github.com/IBM/schematics-go-sdk v0.2.3 h1:lgTt0Sbudii3cuSk1YSQgrtiZAXDbBABAoVj3eQuBrU=
github.com/IBM/schematics-go-sdk v0.2.3/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
github.com/IBM/schematics-go-sdk v0.3.0 h1:Vwxw85SONflakiBsNHAfViKLyp9zJiH5/hh6SewOP5Q=
github.com/IBM/schematics-go-sdk v0.3.0/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.6 h1:bF6bAdI4wDZSje6+Yx1mJxvirboxO+uMuKhzgfRCNxE=
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.6/go.mod h1:XWYnbcc5vN1RnKwk/fCzfD8aZd7At/Y1/b6c+oDyliU=
github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w9M=
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/schematics/data_source_ibm_schematics_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -4212,7 +4212,7 @@ func dataSourceJobLogSummaryToMap(logSummaryItem schematicsv1.JobLogSummary) (lo
return logSummaryMap
}

func dataSourceJobLogSummaryLogErrorsToMap(logErrorsItem schematicsv1.JobLogSummaryLogErrorsItem) (logErrorsMap map[string]interface{}) {
func dataSourceJobLogSummaryLogErrorsToMap(logErrorsItem schematicsv1.JobLogSummaryLogErrors) (logErrorsMap map[string]interface{}) {
logErrorsMap = map[string]interface{}{}

if logErrorsItem.ErrorCode != nil {
Expand Down
4 changes: 3 additions & 1 deletion ibm/service/schematics/resource_ibm_schematics_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,9 @@ func resourceIbmSchematicsAgentDelete(context context.Context, d *schema.Resourc
return diag.FromErr(err)
}

deleteAgentDataOptions := &schematicsv1.DeleteAgentDataOptions{}
deleteAgentDataOptions := &schematicsv1.DeleteAgentDataOptions{
Force: core.BoolPtr(true),
}
session, err := meta.(conns.ClientSession).BluemixSession()
if err != nil {
return diag.FromErr(err)
Expand Down
4 changes: 1 addition & 3 deletions ibm/service/schematics/resource_ibm_schematics_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ func testAccCheckIbmSchematicsAgentDestroy(s *terraform.State) error {
// Try to find the key
_, response, err := schematicsClient.GetAgentData(getAgentDataOptions)
if err == nil {
return nil
// TODO: uncomment the following lines of code once the agent delete actually deletes agentdoc
// return fmt.Errorf("schematics_agent still exists: %s", rs.Primary.ID)
return fmt.Errorf("schematics_agent still exists: %s", rs.Primary.ID)
} else if response.StatusCode != 404 {
return fmt.Errorf("Error checking for schematics_agent (%s) has been destroyed: %s", rs.Primary.ID, err)
}
Expand Down
8 changes: 4 additions & 4 deletions ibm/service/schematics/resource_ibm_schematics_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -3701,7 +3701,7 @@ func resourceIBMSchematicsJobMapToJobLogSummary(jobLogSummaryMap map[string]inte
jobLogSummary.ElapsedTime = core.Float64Ptr(jobLogSummaryMap["elapsed_time"].(float64))
}
if jobLogSummaryMap["log_errors"] != nil {
logErrors := []schematicsv1.JobLogSummaryLogErrorsItem{}
logErrors := []schematicsv1.JobLogSummaryLogErrors{}
for _, logErrorsItem := range jobLogSummaryMap["log_errors"].([]interface{}) {
logErrorsItemModel := resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(logErrorsItem.(map[string]interface{}))
logErrors = append(logErrors, logErrorsItemModel)
Expand Down Expand Up @@ -3732,8 +3732,8 @@ func resourceIBMSchematicsJobMapToJobLogSummary(jobLogSummaryMap map[string]inte
return jobLogSummary
}

func resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(jobLogSummaryLogErrorsMap map[string]interface{}) schematicsv1.JobLogSummaryLogErrorsItem {
jobLogSummaryLogErrors := schematicsv1.JobLogSummaryLogErrorsItem{}
func resourceIBMSchematicsJobMapToJobLogSummaryLogErrors(jobLogSummaryLogErrorsMap map[string]interface{}) schematicsv1.JobLogSummaryLogErrors {
jobLogSummaryLogErrors := schematicsv1.JobLogSummaryLogErrors{}

if jobLogSummaryLogErrorsMap["error_code"] != nil {
jobLogSummaryLogErrors.ErrorCode = core.StringPtr(jobLogSummaryLogErrorsMap["error_code"].(string))
Expand Down Expand Up @@ -4803,7 +4803,7 @@ func resourceIBMSchematicsJobJobLogSummaryToMap(jobLogSummary schematicsv1.JobLo
return jobLogSummaryMap
}

func resourceIBMSchematicsJobJobLogSummaryLogErrorsToMap(jobLogSummaryLogErrors schematicsv1.JobLogSummaryLogErrorsItem) map[string]interface{} {
func resourceIBMSchematicsJobJobLogSummaryLogErrorsToMap(jobLogSummaryLogErrors schematicsv1.JobLogSummaryLogErrors) map[string]interface{} {
jobLogSummaryLogErrorsMap := map[string]interface{}{}

if jobLogSummaryLogErrors.ErrorCode != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func ResourceIBMSchematicsWorkspaceValidator() *validate.ResourceValidator {
Identifier: schematicsWorkspaceTemplateType,
ValidateFunctionIdentifier: validate.ValidateRegexp,
Type: validate.TypeString,
Regexp: `^terraform_v(?:0\.11|0\.12|0\.13|0\.14|0\.15|1\.0|1\.1|1\.2|1\.3|1\.4|1\.5|1\.6)(?:\.\d+)?$`,
Regexp: `^terraform_v(?:1\.4|1\.5|1\.6|1\.7|1\.8|1\.9)(?:\.\d+)?$`,
Default: "[]",
Optional: true})

Expand Down

0 comments on commit e96fad0

Please sign in to comment.