Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

new feature "monitoring_enabled" for Project service #5120

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
"hashed_secret": "06d988e96c3d9325c9fbc7c0ef3c6c0f2b4eb8e7",
"is_secret": false,
"is_verified": false,
"line_number": 41,
"line_number": 42,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2852,7 +2852,7 @@
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 707,
"line_number": 709,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2862,7 +2862,7 @@
"hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3",
"is_secret": false,
"is_verified": false,
"line_number": 59,
"line_number": 60,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2890,7 +2890,7 @@
"hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3",
"is_secret": false,
"is_verified": false,
"line_number": 56,
"line_number": 57,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2908,7 +2908,7 @@
"hashed_secret": "92f08f2d9a0dc3f0d4cb3796435a48508cf59ecd",
"is_secret": false,
"is_verified": false,
"line_number": 1059,
"line_number": 1061,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -2918,7 +2918,7 @@
"hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3",
"is_secret": false,
"is_verified": false,
"line_number": 61,
"line_number": 62,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2946,7 +2946,7 @@
"hashed_secret": "347cd9c53ff77d41a7b22aa56c7b4efaf54658e3",
"is_secret": false,
"is_verified": false,
"line_number": 62,
"line_number": 63,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -4938,7 +4938,7 @@
}
]
},
"version": "0.13.1+ibm.61.dss",
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
1 change: 1 addition & 0 deletions examples/ibm-project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "ibm_project" "project_instance" {
name = "My static website"
description = "Sample static website test using the IBM catalog deployable architecture"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/IBM/keyprotect-go-client v0.12.2
github.com/IBM/networking-go-sdk v0.44.0
github.com/IBM/platform-services-go-sdk v0.56.3
github.com/IBM/project-go-sdk v0.2.0
github.com/IBM/project-go-sdk v0.2.1
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
github.com/IBM/scc-go-sdk/v5 v5.1.4
github.com/IBM/schematics-go-sdk v0.2.3
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,10 @@ github.com/IBM/mqcloud-go-sdk v0.0.4 h1:gqMpoU5a0qJ0GETG4PQrkgeEEoaQLvbxRJnEe6yt
github.com/IBM/mqcloud-go-sdk v0.0.4/go.mod h1:gQptHC6D+rxfg0muRFFGvTDmvl4YfiDE0uXkaRRewRk=
github.com/IBM/networking-go-sdk v0.44.0 h1:6acyMd6hwxcjK3bJ2suiUBTjzg8mRFAvYD76zbx0adk=
github.com/IBM/networking-go-sdk v0.44.0/go.mod h1:XtqYRInR5NHmFUXhOL6RovpDdv6PnJfZ1lPFvssA8MA=
github.com/IBM/platform-services-go-sdk v0.55.0 h1:W598xZanL61bwd8O2DQexr4qjIr+/tP0Y845zoms5yA=
github.com/IBM/platform-services-go-sdk v0.55.0/go.mod h1:CWSprvsCsXWvujmBzbtoJSmbRZS9FVV3O594b0t/GiM=
github.com/IBM/platform-services-go-sdk v0.56.3 h1:DQ1VMQSknhPsdT7d+AybKiZT82esczAkHCIBkwYubzQ=
github.com/IBM/platform-services-go-sdk v0.56.3/go.mod h1:+U6Kg7o5u/Bh4ZkLxjymSgfdpVsaWAtsMtzhwclUry0=
github.com/IBM/project-go-sdk v0.2.0 h1:DMv0HQfS3GQHkkagZ4E2vt1H1paN5Gh357K9izeaGj8=
github.com/IBM/project-go-sdk v0.2.0/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig=
github.com/IBM/project-go-sdk v0.2.1 h1:Xo7ITrfyfVm0eCsaC2SADlhcEjqjx9rtU37fwnzGMCI=
github.com/IBM/project-go-sdk v0.2.1/go.mod h1:lqe0M4cKvABI1iHR1b+KfasVcxQL6nl2VJ8eOyQs8Ig=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5/go.mod h1:b07XHUVh0XYnQE9s2mqgjYST1h9buaQNqN4EcKhOsX0=
github.com/IBM/sarama v1.41.2 h1:ZDBZfGPHAD4uuAtSv4U22fRZBgst0eEwGFzLj0fb85c=
Expand Down
6 changes: 6 additions & 0 deletions ibm/service/project/data_source_ibm_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ func DataSourceIbmProject() *schema.Resource {
Computed: true,
Description: "A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.",
},
"monitoring_enabled": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Description: "A boolean flag to enable project monitoring.",
},
},
},
},
Expand Down Expand Up @@ -546,5 +551,6 @@ func dataSourceIbmProjectProjectDefinitionPropertiesToMap(model *projectv1.Proje
modelMap["name"] = model.Name
modelMap["destroy_on_delete"] = model.DestroyOnDelete
modelMap["description"] = model.Description
modelMap["monitoring_enabled"] = model.MonitoringEnabled
return modelMap, nil
}
19 changes: 19 additions & 0 deletions ibm/service/project/data_source_ibm_project_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,8 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model projec
return dataSourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties); ok {
return dataSourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties); ok {
return dataSourceIbmProjectConfigProjectConfigResponseDefinitionStackConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinition); ok {
modelMap := make(map[string]interface{})
model := model.(*projectv1.ProjectConfigResponseDefinition)
Expand Down Expand Up @@ -791,3 +793,20 @@ func dataSourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefi
}
return modelMap, nil
}

func dataSourceIbmProjectConfigProjectConfigResponseDefinitionStackConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.Description != nil {
modelMap["description"] = model.Description
}
if model.Name != nil {
modelMap["name"] = model.Name
}
if model.LocatorID != nil {
modelMap["locator_id"] = model.LocatorID
}
if model.EnvironmentID != nil {
modelMap["environment_id"] = model.EnvironmentID
}
return modelMap, nil
}
1 change: 1 addition & 0 deletions ibm/service/project/data_source_ibm_project_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func testAccCheckIbmProjectConfigDataSourceConfigBasic() string {
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func testAccCheckIbmProjectEnvironmentDataSourceConfigBasic() string {
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
1 change: 1 addition & 0 deletions ibm/service/project/data_source_ibm_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func testAccCheckIbmProjectDataSourceConfigBasic(projectLocation string, project
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
15 changes: 14 additions & 1 deletion ibm/service/project/resource_ibm_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func ResourceIbmProject() *schema.Resource {
Required: true,
Description: "A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.",
},
"monitoring_enabled": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "A boolean flag to enable project monitoring.",
},
},
},
},
Expand Down Expand Up @@ -531,7 +537,7 @@ func resourceIbmProjectDelete(context context.Context, d *schema.ResourceData, m

deleteProjectOptions.SetID(d.Id())

response, err := projectClient.DeleteProjectWithContext(context, deleteProjectOptions)
_, response, err := projectClient.DeleteProjectWithContext(context, deleteProjectOptions)
if err != nil {
log.Printf("[DEBUG] DeleteProjectWithContext failed %s\n%s", err, response)
return diag.FromErr(fmt.Errorf("DeleteProjectWithContext failed %s\n%s", err, response))
Expand All @@ -551,6 +557,9 @@ func resourceIbmProjectMapToProjectPrototypeDefinition(modelMap map[string]inter
if modelMap["description"] != nil && modelMap["description"].(string) != "" {
model.Description = core.StringPtr(modelMap["description"].(string))
}
if modelMap["monitoring_enabled"] != nil {
model.MonitoringEnabled = core.BoolPtr(modelMap["monitoring_enabled"].(bool))
}
return model, nil
}

Expand Down Expand Up @@ -773,6 +782,9 @@ func resourceIbmProjectMapToProjectPatchDefinitionBlock(modelMap map[string]inte
if modelMap["description"] != nil && modelMap["description"].(string) != "" {
model.Description = core.StringPtr(modelMap["description"].(string))
}
if modelMap["monitoring_enabled"] != nil {
model.MonitoringEnabled = core.BoolPtr(modelMap["monitoring_enabled"].(bool))
}
return model, nil
}

Expand All @@ -781,6 +793,7 @@ func resourceIbmProjectProjectDefinitionPropertiesToMap(model *projectv1.Project
modelMap["name"] = model.Name
modelMap["destroy_on_delete"] = model.DestroyOnDelete
modelMap["description"] = model.Description
modelMap["monitoring_enabled"] = model.MonitoringEnabled
return modelMap, nil
}

Expand Down
19 changes: 19 additions & 0 deletions ibm/service/project/resource_ibm_project_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,8 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionToMap(model projectv
return resourceIbmProjectConfigProjectConfigResponseDefinitionDAConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionDAConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties); ok {
return resourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionResourceConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties); ok {
return resourceIbmProjectConfigProjectConfigResponseDefinitionStackConfigDefinitionPropertiesToMap(model.(*projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties))
} else if _, ok := model.(*projectv1.ProjectConfigResponseDefinition); ok {
modelMap := make(map[string]interface{})
model := model.(*projectv1.ProjectConfigResponseDefinition)
Expand Down Expand Up @@ -1144,6 +1146,23 @@ func resourceIbmProjectConfigProjectConfigResponseDefinitionResourceConfigDefini
return modelMap, nil
}

func resourceIbmProjectConfigProjectConfigResponseDefinitionStackConfigDefinitionPropertiesToMap(model *projectv1.ProjectConfigResponseDefinitionStackConfigDefinitionProperties) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
if model.Description != nil {
modelMap["description"] = model.Description
}
if model.Name != nil {
modelMap["name"] = model.Name
}
if model.LocatorID != nil {
modelMap["locator_id"] = model.LocatorID
}
if model.EnvironmentID != nil {
modelMap["environment_id"] = model.EnvironmentID
}
return modelMap, nil
}

func resourceIbmProjectConfigOutputValueToMap(model *projectv1.OutputValue) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
modelMap["name"] = model.Name
Expand Down
1 change: 1 addition & 0 deletions ibm/service/project/resource_ibm_project_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func testAccCheckIbmProjectConfigConfigBasic() string {
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func testAccCheckIbmProjectEnvironmentConfigBasic() string {
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}

Expand Down
1 change: 1 addition & 0 deletions ibm/service/project/resource_ibm_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func testAccCheckIbmProjectConfigBasic(location string, resourceGroup string) st
name = "acme-microservice"
description = "acme-microservice description"
destroy_on_delete = true
monitoring_enabled = true
}
}
`, location, resourceGroup)
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Nested schema for **definition**:
* `description` - (String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.
* Constraints: The default value is ``. The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`.
* `destroy_on_delete` - (Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted.
* `monitoring_enabled` - (Boolean) A boolean flag to enable project monitoring.
* Constraints: The default value is `false`.
* `name` - (String) The name of the project. It is unique within the account across regions.
* Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`.

Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resource "ibm_project" "project_instance" {
name = "My static website"
description = "Sample static website test using the IBM catalog deployable architecture"
destroy_on_delete = true
monitoring_enabled = true
}
location = "us-south"
resource_group = "Default"
Expand All @@ -33,6 +34,8 @@ Nested schema for **definition**:
* `description` - (Required, String) A brief explanation of the project's use in the configuration of a deployable architecture. It is possible to create a project without providing a description.
* Constraints: The default value is ``. The maximum length is `1024` characters. The minimum length is `0` characters. The value must match regular expression `/^$|^(?!\\s)(?!.*\\s$)[^\\x00-\\x1F]*$/`.
* `destroy_on_delete` - (Required, Boolean) The policy that indicates whether the resources are destroyed or not when a project is deleted.
* `monitoring_enabled` - (Boolean) A boolean flag to enable project monitoring.
* Constraints: The default value is `false`.
* `name` - (Required, String) The name of the project. It is unique within the account across regions.
* Constraints: The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^(?!\\s)(?!.*\\s$)[^'"`<>{}\\x00-\\x1F]+$/`.
* `location` - (Required, Forces new resource, String) The IBM Cloud location where a resource is deployed.
Expand Down