Skip to content

Commit

Permalink
fix for issue#3877-add datasource to credential,collector and scope (I…
Browse files Browse the repository at this point in the history
…BM-Cloud#3898)

* fix for issue#3877-add datasource to credential,collector and scope

* fix for issue#3877-add datasource to credential,collector and scope

* fix for issue#3877-add datasource to credential,collector and scope

* correcting subcategory in documentation

Co-authored-by: ArchanaPonnada <archanaponnada@archananadasmbp.in.ibm.com>
Co-authored-by: ArchanaPonnada <archanaponnada@ArchanaPonnadas-MacBook-Pro.local>
  • Loading branch information
3 people authored and SunithaGudisagarIBM1 committed Sep 14, 2022
1 parent c1a3c67 commit 667154e
Show file tree
Hide file tree
Showing 14 changed files with 2,898 additions and 16 deletions.
130 changes: 115 additions & 15 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2022-06-30T12:32:37Z",
"generated_at": "2022-07-05T04:16:49Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -660,7 +660,7 @@
"hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6",
"is_secret": false,
"is_verified": false,
"line_number": 738,
"line_number": 740,
"type": "Base64 High Entropy String",
"verified_result": null
}
Expand Down Expand Up @@ -730,15 +730,15 @@
"hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9",
"is_secret": false,
"is_verified": false,
"line_number": 1368,
"line_number": 1370,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437",
"is_secret": false,
"is_verified": false,
"line_number": 1374,
"line_number": 1376,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -1040,7 +1040,7 @@
"hashed_secret": "9982fcad895acdfd083f1f38a5e9b44a084e4747",
"is_secret": false,
"is_verified": false,
"line_number": 56,
"line_number": 57,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -1050,23 +1050,23 @@
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 201,
"line_number": 202,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "9982fcad895acdfd083f1f38a5e9b44a084e4747",
"is_secret": false,
"is_verified": false,
"line_number": 219,
"line_number": 220,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "eea5864a56855d23883cb6b46cbf5d60080f2726",
"is_secret": false,
"is_verified": false,
"line_number": 536,
"line_number": 537,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -1076,7 +1076,7 @@
"hashed_secret": "9982fcad895acdfd083f1f38a5e9b44a084e4747",
"is_secret": false,
"is_verified": false,
"line_number": 63,
"line_number": 64,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -1322,15 +1322,15 @@
"hashed_secret": "ece6e4a51cf5a18845f07c95832586a96d5fcf4c",
"is_secret": false,
"is_verified": false,
"line_number": 82,
"line_number": 100,
"type": "Hex High Entropy String",
"verified_result": null
},
{
"hashed_secret": "1f1c2ad5fded044aae42281c1fd4253dd624bf65",
"is_secret": false,
"is_verified": false,
"line_number": 83,
"line_number": 101,
"type": "Hex High Entropy String",
"verified_result": null
}
Expand Down Expand Up @@ -2193,6 +2193,106 @@
"verified_result": null
}
],
"ibm/service/scc/data_source_ibm_scc_posture_credential.go": [
{
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 135,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "3b1da79ea2c9dfc096b4d20c8f64f7858549908e",
"is_secret": false,
"is_verified": false,
"line_number": 306,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "6cdb1e71365ff5e2d30bdf5a3fc2cef6ceb7d6ab",
"is_secret": false,
"is_verified": false,
"line_number": 312,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "dc4b301aabbb153986525c61aa1f7fc3123e2814",
"is_secret": false,
"is_verified": false,
"line_number": 324,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "3a9fcfd5d5cc8897fb6ab346640c87812b8bce07",
"is_secret": false,
"is_verified": false,
"line_number": 330,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "588848bf1bf00688744c7dbb99bd38afc00e4d9b",
"is_secret": false,
"is_verified": false,
"line_number": 354,
"type": "Secret Keyword",
"verified_result": null
}
],
"ibm/service/scc/data_source_ibm_scc_posture_scope.go": [
{
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
"is_secret": false,
"is_verified": false,
"line_number": 365,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "3b1da79ea2c9dfc096b4d20c8f64f7858549908e",
"is_secret": false,
"is_verified": false,
"line_number": 1158,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "6cdb1e71365ff5e2d30bdf5a3fc2cef6ceb7d6ab",
"is_secret": false,
"is_verified": false,
"line_number": 1164,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "dc4b301aabbb153986525c61aa1f7fc3123e2814",
"is_secret": false,
"is_verified": false,
"line_number": 1176,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "3a9fcfd5d5cc8897fb6ab346640c87812b8bce07",
"is_secret": false,
"is_verified": false,
"line_number": 1182,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "588848bf1bf00688744c7dbb99bd38afc00e4d9b",
"is_secret": false,
"is_verified": false,
"line_number": 1206,
"type": "Secret Keyword",
"verified_result": null
}
],
"ibm/service/scc/resource_ibm_scc_posture_credential.go": [
{
"hashed_secret": "0c0aa212475d8c2a2e0c559fcfc5a67cae2af9ba",
Expand Down Expand Up @@ -2542,15 +2642,15 @@
"hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e",
"is_secret": false,
"is_verified": false,
"line_number": 103,
"line_number": 102,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f",
"is_secret": false,
"is_verified": false,
"line_number": 105,
"line_number": 104,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -2864,15 +2964,15 @@
"hashed_secret": "d47dcacc720a39e236679ac3e311a0d58bb6519e",
"is_secret": false,
"is_verified": false,
"line_number": 97,
"line_number": 96,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "e66e7d67fdf3c596c435fc7828b13205e4950a0f",
"is_secret": false,
"is_verified": false,
"line_number": 99,
"line_number": 98,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
15 changes: 15 additions & 0 deletions examples/ibm-scc/posture-management/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ data "ibm_scc_posture_scan_summaries" "scan_summaries_instance" {
scope_id = var.scan_summaries_scope_id
scan_id = var.scan_summaries_scan_id
}

// Create scope data source
data "ibm_scc_posture_scope" "scope_instance" {
scope_id = var.scope_id
}

// Create collector data source
data "ibm_scc_posture_collector" "collector_instance" {
collector_id = var.collector_id
}

// Create credential data source
data "ibm_scc_posture_credential" "credential_instance" {
credential_id = var.credential_id
}
18 changes: 18 additions & 0 deletions examples/ibm-scc/posture-management/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,21 @@ variable "scope_correlation_correlation_id" {
description = "A correlation_Id is created when a scope is created and discovery task is triggered or when a validation is triggered on a Scope. This is used to get the status of the task(discovery or validation)."
type = string
}

// Data source arguments for scope
variable "scope_id" {
description = "The scope ID. This can be obtained from the Security and Compliance Center UI by clicking on the scope name. The URL contains the ID."
type = string
}

// Data source arguments for credential
variable "credential_id" {
description = "The collector ID. This can be obtained from the Security and Compliance Center UI by clicking on the credential name. The network tab contains the ID."
type = string
}

// Data source arguments for collector
variable "collector_id" {
description = "The collector ID. This can be obtained from the Security and Compliance Center UI by clicking on the collector name. The network tab contains the ID."
type = string
}
12 changes: 12 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ var Scc_posture_credential_id_scope string
var Scc_posture_credential_id_scope_update string
var Scc_posture_collector_id_scope []string
var Scc_posture_collector_id_scope_update []string
var Scc_posture_collector_id string
var Scc_posture_credential_id string

//ROKS Cluster
var ClusterName string
Expand Down Expand Up @@ -886,6 +888,16 @@ func init() {
fmt.Println("[INFO] Set the environment variable SCC_POSTURE_COLLECTOR_ID_SCOPE_UPDATE for testing SCC Posture resource or datasource else tests will fail if this is not set correctly")
}

Scc_posture_collector_id = os.Getenv("SCC_POSTURE_COLLECTOR_ID")
if Scc_posture_collector_id == "" {
fmt.Println("[INFO] Set the environment variable SCC_POSTURE_COLLECTOR_ID for testing SCC Posture resources or datasource resource else tests will fail if this is not set correctly")
}

Scc_posture_credential_id = os.Getenv("SCC_POSTURE_CREDENTIAL_ID")
if Scc_posture_credential_id == "" {
fmt.Println("[INFO] Set the environment variable SCC_POSTURE_CREDENTIAL_ID for testing SCC Posture resources or datasource resource else tests will fail if this is not set correctly")
}

CloudShellAccountID = os.Getenv("IBM_CLOUD_SHELL_ACCOUNT_ID")
if CloudShellAccountID == "" {
fmt.Println("[INFO] Set the environment variable IBM_CLOUD_SHELL_ACCOUNT_ID for ibm-cloud-shell resource or datasource else tests will fail if this is not set correctly")
Expand Down
4 changes: 3 additions & 1 deletion ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ func Provider() *schema.Provider {
"ibm_scc_posture_profile": scc.DataSourceIBMSccPostureProfileDetails(),
"ibm_scc_posture_group_profile": scc.DataSourceIBMSccPostureGroupProfileDetails(),
"ibm_scc_posture_scope_correlation": scc.DataSourceIBMSccPostureScopeCorrelation(),

"ibm_scc_posture_credential": scc.DataSourceIBMSccPostureCredential(),
"ibm_scc_posture_collector": scc.DataSourceIBMSccPostureCollector(),
"ibm_scc_posture_scope": scc.DataSourceIBMSccPostureScope(),
// // Added for Context Based Restrictions
"ibm_cbr_zone": contextbasedrestrictions.DataSourceIBMCbrZone(),
"ibm_cbr_rule": contextbasedrestrictions.DataSourceIBMCbrRule(),
Expand Down
Loading

0 comments on commit 667154e

Please sign in to comment.