Skip to content

Commit

Permalink
Merge branch 'master' of github.com:powervs-ibm/terraform-provider-ib…
Browse files Browse the repository at this point in the history
…m into network-port-attach
  • Loading branch information
ismirlia committed Jul 15, 2024
2 parents dcadea8 + 6bf9688 commit 3b8f8d9
Show file tree
Hide file tree
Showing 73 changed files with 3,643 additions and 2,032 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ require (
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f
github.com/IBM/cloud-databases-go-sdk v0.7.0
github.com/IBM/cloudant-go-sdk v0.0.43
github.com/IBM/code-engine-go-sdk v0.0.0-20231106200405-99e81b3ee752
github.com/IBM/code-engine-go-sdk v0.0.0-20240126185534-a6e054aa01ed
github.com/IBM/container-registry-go-sdk v1.1.0
github.com/IBM/continuous-delivery-go-sdk v1.5.0
github.com/IBM/event-notifications-go-admin-sdk v0.6.1
github.com/IBM/eventstreams-go-sdk v1.4.0
github.com/IBM/go-sdk-core/v3 v3.2.4
github.com/IBM/go-sdk-core/v5 v5.17.3
github.com/IBM/go-sdk-core/v5 v5.17.4
github.com/IBM/ibm-cos-sdk-go v1.10.3
github.com/IBM/ibm-cos-sdk-go-config/v2 v2.1.0
github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1
github.com/IBM/ibm-hpcs-uko-sdk v0.0.20-beta
github.com/IBM/keyprotect-go-client v0.14.0
github.com/IBM/logs-go-sdk v0.3.0
github.com/IBM/networking-go-sdk v0.47.1
github.com/IBM/platform-services-go-sdk v0.62.11
github.com/IBM/platform-services-go-sdk v0.64.3
github.com/IBM/project-go-sdk v0.3.5
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/scc-go-sdk/v5 v5.1.6
Expand Down
141 changes: 135 additions & 6 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ibm/service/codeengine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ This area is primarily for IBM provider contributors and maintainers. For inform
* IBM Provider Docs: [Home](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs)
* IBM Provider Docs: [One of the resources](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/code_engine_app)
* IBM API Docs: [IBM API Docs for ]()
* IBM SDK: [IBM SDK for ](https://github.com/IBM/code-engine-go-sdk/tree/main/codeenginev2)
* IBM SDK: [IBM SDK for ](https://github.com/IBM/appconfiguration-go-admin-sdk/tree/master/codeenginev2)
378 changes: 296 additions & 82 deletions ibm/service/codeengine/data_source_ibm_code_engine_app.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ func testAccCheckIbmCodeEngineAppDataSourceConfigBasic(projectID string, appImag
lifecycle {
ignore_changes = [
run_env_variables
run_env_variables,
probe_liveness,
probe_readiness
]
}
}
Expand Down Expand Up @@ -153,7 +155,9 @@ func testAccCheckIbmCodeEngineAppDataSourceConfig(projectID string, appImageRefe
lifecycle {
ignore_changes = [
run_env_variables
run_env_variables,
probe_liveness,
probe_readiness
]
}
}
Expand Down
39 changes: 24 additions & 15 deletions ibm/service/codeengine/data_source_ibm_code_engine_binding.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright IBM Corp. 2023 All Rights Reserved.
// Copyright IBM Corp. 2024 All Rights Reserved.
// Licensed under the Mozilla Public License v2.0

package codeengine
Expand All @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns"
"github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex"
"github.com/IBM/code-engine-go-sdk/codeenginev2"
)

Expand Down Expand Up @@ -57,7 +58,7 @@ func DataSourceIbmCodeEngineBinding() *schema.Resource {
"prefix": {
Type: schema.TypeString,
Computed: true,
Description: "The value that is set as prefix in the component that is bound.",
Description: "The value that is set as a prefix in the component that is bound.",
},
"resource_type": {
Type: schema.TypeString,
Expand All @@ -81,18 +82,21 @@ func DataSourceIbmCodeEngineBinding() *schema.Resource {
func dataSourceIbmCodeEngineBindingRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
codeEngineClient, err := meta.(conns.ClientSession).CodeEngineV2()
if err != nil {
return diag.FromErr(err)
tfErr := flex.TerraformErrorf(err, err.Error(), "(Data) ibm_code_engine_binding", "read")
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
return tfErr.GetDiag()
}

getBindingOptions := &codeenginev2.GetBindingOptions{}

getBindingOptions.SetProjectID(d.Get("project_id").(string))
getBindingOptions.SetID(d.Get("binding_id").(string))

binding, response, err := codeEngineClient.GetBindingWithContext(context, getBindingOptions)
binding, _, err := codeEngineClient.GetBindingWithContext(context, getBindingOptions)
if err != nil {
log.Printf("[DEBUG] GetBindingWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("GetBindingWithContext failed %s\n%s", err, response))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("GetBindingWithContext failed: %s", err.Error()), "(Data) ibm_code_engine_binding", "read")
log.Printf("[DEBUG]\n%s", tfErr.GetDebugMessage())
return tfErr.GetDiag()
}

d.SetId(fmt.Sprintf("%s/%s", *getBindingOptions.ProjectID, *getBindingOptions.ID))
Expand All @@ -101,34 +105,39 @@ func dataSourceIbmCodeEngineBindingRead(context context.Context, d *schema.Resou
if binding.Component != nil {
modelMap, err := dataSourceIbmCodeEngineBindingComponentRefToMap(binding.Component)
if err != nil {
return diag.FromErr(err)
tfErr := flex.TerraformErrorf(err, err.Error(), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}
component = append(component, modelMap)
}

errString := "Error setting %s %s"
if err = d.Set("component", component); err != nil {
return diag.FromErr(fmt.Errorf(errString, "component", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting component: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

if err = d.Set("href", binding.Href); err != nil {
return diag.FromErr(fmt.Errorf(errString, "href", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting href: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

if err = d.Set("prefix", binding.Prefix); err != nil {
return diag.FromErr(fmt.Errorf(errString, "prefix", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting prefix: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

if err = d.Set("resource_type", binding.ResourceType); err != nil {
return diag.FromErr(fmt.Errorf(errString, "resource_type", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting resource_type: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

if err = d.Set("secret_name", binding.SecretName); err != nil {
return diag.FromErr(fmt.Errorf(errString, "secret_name", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting secret_name: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

if err = d.Set("status", binding.Status); err != nil {
return diag.FromErr(fmt.Errorf(errString, "status", err))
tfErr := flex.TerraformErrorf(err, fmt.Sprintf("Error setting status: %s", err), "(Data) ibm_code_engine_binding", "read")
return tfErr.GetDiag()
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func testAccCheckIbmCodeEngineBindingDataSourceConfigBasic(projectID string, app
lifecycle {
ignore_changes = [
run_env_variables
run_env_variables,
probe_liveness,
probe_readiness
]
}
}
Expand Down
Loading

0 comments on commit 3b8f8d9

Please sign in to comment.