Skip to content

Commit

Permalink
Make CD Pagerduty prop computed and general tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarjoram authored and hkantare committed Jul 1, 2022
1 parent 2389e88 commit 8d69c7b
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,10 @@ func DataSourceIBMCdToolchainToolAppconfigRead(context context.Context, d *schem
parameters := []map[string]interface{}{}
if getToolByIDResponse.Parameters != nil {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
}
modelMap := GetParametersFromRead(getToolByIDResponse.Parameters, DataSourceIBMCdToolchainToolAppconfig(), remapFields)
parameters = append(parameters, modelMap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ func DataSourceIBMCdToolchainToolGithubintegrated() *schema.Resource {
Computed: true,
Description: "Select this check box to make this repository private.",
},
"auto_init": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Select this checkbox to initialize this repository with a README.",
},
"has_issues": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand All @@ -146,11 +151,6 @@ func DataSourceIBMCdToolchainToolGithubintegrated() *schema.Resource {
Computed: true,
Description: "Select the user which git operations will be performed as.",
},
"auto_init": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "Select this checkbox to initialize this repository with a README.",
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@ func DataSourceIBMCdToolchainToolKeyprotectRead(context context.Context, d *sche
parameters := []map[string]interface{}{}
if getToolByIDResponse.Parameters != nil {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
modelMap := GetParametersFromRead(getToolByIDResponse.Parameters, DataSourceIBMCdToolchainToolKeyprotect(), remapFields)
parameters = append(parameters, modelMap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@ func DataSourceIBMCdToolchainToolSecretsmanagerRead(context context.Context, d *
parameters := []map[string]interface{}{}
if getToolByIDResponse.Parameters != nil {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
modelMap := GetParametersFromRead(getToolByIDResponse.Parameters, DataSourceIBMCdToolchainToolSecretsmanager(), remapFields)
parameters = append(parameters, modelMap)
Expand Down
27 changes: 12 additions & 15 deletions ibm/service/cdtoolchain/resource_ibm_cd_toolchain_tool_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,10 @@ func ResourceIBMCdToolchainToolAppconfigCreate(context context.Context, d *schem
createToolOptions.SetToolchainID(d.Get("toolchain_id").(string))
createToolOptions.SetToolTypeID("appconfig")
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
}
parametersModel := GetParametersForCreate(d, ResourceIBMCdToolchainToolAppconfig(), remapFields)
createToolOptions.SetParameters(parametersModel)
Expand Down Expand Up @@ -229,11 +228,10 @@ func ResourceIBMCdToolchainToolAppconfigRead(context context.Context, d *schema.
return diag.FromErr(fmt.Errorf("Error setting toolchain_id: %s", err))
}
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
}
parametersMap := GetParametersFromRead(getToolByIDResponse.Parameters, ResourceIBMCdToolchainToolAppconfig(), remapFields)
if err = d.Set("parameters", []map[string]interface{}{parametersMap}); err != nil {
Expand Down Expand Up @@ -299,11 +297,10 @@ func ResourceIBMCdToolchainToolAppconfigUpdate(context context.Context, d *schem
}
if d.HasChange("parameters") {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
"environment_name": "environment-name",
"collection_name": "collection-name",
}
parameters := GetParametersForUpdate(d, ResourceIBMCdToolchainToolAppconfig(), remapFields)
updateToolOptions.SetParameters(parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func ResourceIBMCdToolchainToolGithubintegrated() *schema.Resource {
Computed: true,
Description: "Select this check box to make this repository private.",
},
"auto_init": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Select this checkbox to initialize this repository with a README.",
},
"has_issues": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Expand All @@ -114,12 +120,6 @@ func ResourceIBMCdToolchainToolGithubintegrated() *schema.Resource {
Computed: true,
Description: "Select the user which git operations will be performed as.",
},
"auto_init": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
Description: "Select this checkbox to initialize this repository with a README.",
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ func ResourceIBMCdToolchainToolKeyprotectCreate(context context.Context, d *sche
createToolOptions.SetToolchainID(d.Get("toolchain_id").(string))
createToolOptions.SetToolTypeID("keyprotect")
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parametersModel := GetParametersForCreate(d, ResourceIBMCdToolchainToolKeyprotect(), remapFields)
createToolOptions.SetParameters(parametersModel)
Expand Down Expand Up @@ -217,9 +216,8 @@ func ResourceIBMCdToolchainToolKeyprotectRead(context context.Context, d *schema
return diag.FromErr(fmt.Errorf("Error setting toolchain_id: %s", err))
}
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parametersMap := GetParametersFromRead(getToolByIDResponse.Parameters, ResourceIBMCdToolchainToolKeyprotect(), remapFields)
if err = d.Set("parameters", []map[string]interface{}{parametersMap}); err != nil {
Expand Down Expand Up @@ -285,9 +283,8 @@ func ResourceIBMCdToolchainToolKeyprotectUpdate(context context.Context, d *sche
}
if d.HasChange("parameters") {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parameters := GetParametersForUpdate(d, ResourceIBMCdToolchainToolKeyprotect(), remapFields)
updateToolOptions.SetParameters(parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func ResourceIBMCdToolchainToolPagerduty() *schema.Resource {
"service_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "service_id.",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ func ResourceIBMCdToolchainToolSecretsmanagerCreate(context context.Context, d *
createToolOptions.SetToolchainID(d.Get("toolchain_id").(string))
createToolOptions.SetToolTypeID("secretsmanager")
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parametersModel := GetParametersForCreate(d, ResourceIBMCdToolchainToolSecretsmanager(), remapFields)
createToolOptions.SetParameters(parametersModel)
Expand Down Expand Up @@ -217,9 +216,8 @@ func ResourceIBMCdToolchainToolSecretsmanagerRead(context context.Context, d *sc
return diag.FromErr(fmt.Errorf("Error setting toolchain_id: %s", err))
}
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parametersMap := GetParametersFromRead(getToolByIDResponse.Parameters, ResourceIBMCdToolchainToolSecretsmanager(), remapFields)
if err = d.Set("parameters", []map[string]interface{}{parametersMap}); err != nil {
Expand Down Expand Up @@ -285,9 +283,8 @@ func ResourceIBMCdToolchainToolSecretsmanagerUpdate(context context.Context, d *
}
if d.HasChange("parameters") {
remapFields := map[string]string{
"resource_group": "resource-group",
"instance_name": "instance-name",
"integration_status": "integration-status",
"resource_group": "resource-group",
"instance_name": "instance-name",
}
parameters := GetParametersForUpdate(d, ResourceIBMCdToolchainToolSecretsmanager(), remapFields)
updateToolOptions.SetParameters(parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In addition to all argument references listed, you can access the following attr
* `id` - The unique identifier of the cd_toolchain_tool_bitbucketgit.
* `crn` - (Required, String) Tool CRN.


* `href` - (Required, String) URI representing the tool.

* `name` - (Optional, String) Tool name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In addition to all argument references listed, you can access the following attr
* `id` - The unique identifier of the cd_toolchain_tool_githubconsolidated.
* `crn` - (Required, String) Tool CRN.


* `href` - (Required, String) URI representing the tool.

* `name` - (Optional, String) Tool name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In addition to all argument references listed, you can access the following attr
* `id` - The unique identifier of the cd_toolchain_tool_githubintegrated.
* `crn` - (Required, String) Tool CRN.


* `href` - (Required, String) URI representing the tool.

* `name` - (Optional, String) Tool name.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/cd_toolchain_tool_gitlab.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In addition to all argument references listed, you can access the following attr
* `id` - The unique identifier of the cd_toolchain_tool_gitlab.
* `crn` - (Required, String) Tool CRN.


* `href` - (Required, String) URI representing the tool.

* `name` - (Optional, String) Tool name.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/cd_toolchain_tool_hostedgit.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In addition to all argument references listed, you can access the following attr
* `id` - The unique identifier of the cd_toolchain_tool_hostedgit.
* `crn` - (Required, String) Tool CRN.


* `href` - (Required, String) URI representing the tool.

* `name` - (Optional, String) Tool name.
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/cd_toolchain_tool_appconfig.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ resource "ibm_cd_toolchain_tool_appconfig" "cd_toolchain_tool_appconfig" {
instance_name = "instance-name"
environment_name = "environment-name"
collection_name = "collection-name"
integration_status = "integration-status"
}
toolchain_id = "toolchain_id"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ resource "ibm_cd_toolchain_tool_githubintegrated" "cd_toolchain_tool_githubinteg
token_url = "token_url"
type = "new"
private_repo = true
auto_init = true
has_issues = true
enable_traceability = true
integration_owner = "integration_owner"
auto_init = true
}
toolchain_id = "toolchain_id"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "ibm_cd_toolchain_tool_privateworker" "cd_toolchain_tool_privateworker"
parameters {
name = "name"
worker_queue_credentials = "workerQueueCredentials"
worker_queue_cdentifier = "workerQueueIdentifier"
worker_queue_identifier = "workerQueueIdentifier"
}
toolchain_id = "toolchain_id"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ resource "ibm_cd_toolchain_tool_secretsmanager" "cd_toolchain_tool_secretsmanage
region = "region"
resource_group = "resource-group"
instance_name = "instance-name"
integration_status = "integration-status"
}
toolchain_id = "toolchain_id"
}
Expand Down

0 comments on commit 8d69c7b

Please sign in to comment.