Skip to content

Commit 3bf1a49

Browse files
authored
feat: pipeline, repo and trigger from json support (#431)
1 parent 783e339 commit 3bf1a49

File tree

10 files changed

+883
-12
lines changed

10 files changed

+883
-12
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Large diffs are not rendered by default.

code-engine/README.md

Lines changed: 24 additions & 0 deletions
Large diffs are not rendered by default.

code-engine/main.tf

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "ibm_resource_instance" "cd_instance" {
8181
module "devsecops_ci_toolchain" {
8282
count = var.create_ci_toolchain ? 1 : 0
8383
depends_on = [ibm_resource_instance.cd_instance]
84-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-ci-toolchain?ref=v1.3.0"
84+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-ci-toolchain?ref=v1.4.0"
8585
ibmcloud_api_key = var.ibmcloud_api_key
8686
toolchain_name = (var.ci_toolchain_name == "") ? format("${var.toolchain_name}%s", "-CI-Toolchain") : var.ci_toolchain_name
8787
toolchain_region = (var.ci_toolchain_region == "") ? var.toolchain_region : replace(replace(var.ci_toolchain_region, "ibm:yp:", ""), "ibm:ys1:", "")
@@ -243,6 +243,18 @@ module "devsecops_ci_toolchain" {
243243
enable_pipeline_dockerconfigjson = var.ci_enable_pipeline_dockerconfigjson
244244
peer_review_compliance = (var.ci_peer_review_compliance == "") ? var.peer_review_compliance : var.ci_peer_review_compliance
245245
print_code_signing_certificate = var.ci_print_code_signing_certificate
246+
pr_cra_bom_generate = var.pr_cra_bom_generate
247+
pr_cra_vulnerability_scan = var.pr_cra_vulnerability_scan
248+
pr_cra_deploy_analysis = var.pr_cra_deploy_analysis
249+
ci_cra_bom_generate = var.ci_cra_bom_generate
250+
ci_cra_vulnerability_scan = var.ci_cra_vulnerability_scan
251+
ci_cra_deploy_analysis = var.ci_cra_deploy_analysis
252+
enable_pipeline_notifications = var.ci_enable_pipeline_notifications
253+
event_notifications = var.ci_event_notifications
254+
pipeline_properties = var.ci_pipeline_properties
255+
pipeline_properties_filepath = var.ci_pipeline_properties_filepath
256+
repository_properties = var.ci_repository_properties
257+
repository_properties_filepath = var.ci_repository_properties_filepath
246258

247259
#CODE ENGINE
248260

@@ -338,7 +350,7 @@ module "devsecops_ci_toolchain" {
338350
module "devsecops_cd_toolchain" {
339351
count = var.create_cd_toolchain ? 1 : 0
340352
depends_on = [ibm_resource_instance.cd_instance]
341-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-cd-toolchain?ref=v1.3.0"
353+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-cd-toolchain?ref=v1.4.0"
342354
ibmcloud_api_key = var.ibmcloud_api_key
343355

344356
toolchain_name = (var.cd_toolchain_name == "") ? format("${var.toolchain_name}%s", "-CD-Toolchain") : var.cd_toolchain_name
@@ -509,6 +521,14 @@ module "devsecops_cd_toolchain" {
509521
scc_profile_name = var.scc_profile_name
510522
scc_profile_version = var.scc_profile_version
511523
scc_use_profile_attachment = (var.cd_scc_use_profile_attachment == "") ? var.scc_use_profile_attachment : var.cd_scc_use_profile_attachment
524+
enable_pipeline_notifications = var.cd_enable_pipeline_notifications
525+
event_notifications = var.cd_event_notifications
526+
pipeline_properties = var.cd_pipeline_properties
527+
pipeline_properties_filepath = var.cd_pipeline_properties_filepath
528+
pre_prod_evidence_collection = var.cd_pre_prod_evidence_collection
529+
530+
repository_properties = var.cd_repository_properties
531+
repository_properties_filepath = var.cd_repository_properties_filepath
512532

513533
#SLACK INTEGRATION
514534
enable_slack = (local.use_slack_enable_override) ? local.enable_slack : var.cd_enable_slack
@@ -580,7 +600,7 @@ module "devsecops_cd_toolchain" {
580600
module "devsecops_cc_toolchain" {
581601
count = var.create_cc_toolchain ? 1 : 0
582602
depends_on = [ibm_resource_instance.cd_instance]
583-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-cc-toolchain?ref=v1.3.0"
603+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-cc-toolchain?ref=v1.4.0"
584604
ibmcloud_api_key = var.ibmcloud_api_key
585605
toolchain_name = (var.cc_toolchain_name == "") ? format("${var.toolchain_name}%s", "-CC-Toolchain") : var.cc_toolchain_name
586606
toolchain_description = var.cc_toolchain_description
@@ -736,6 +756,15 @@ module "devsecops_cc_toolchain" {
736756
scc_profile_name = var.scc_profile_name
737757
scc_profile_version = var.scc_profile_version
738758
scc_use_profile_attachment = (var.cc_scc_use_profile_attachment == "") ? var.scc_use_profile_attachment : var.cc_scc_use_profile_attachment
759+
enable_pipeline_notifications = var.cc_enable_pipeline_notifications
760+
event_notifications = var.cc_event_notifications
761+
cra_bom_generate = var.cc_cra_bom_generate
762+
cra_vulnerability_scan = var.cc_cra_vulnerability_scan
763+
cra_deploy_analysis = var.cc_cra_deploy_analysis
764+
pipeline_properties = var.cc_pipeline_properties
765+
pipeline_properties_filepath = var.cc_pipeline_properties_filepath
766+
repository_properties = var.cc_repository_properties
767+
repository_properties_filepath = var.cc_repository_properties_filepath
739768

740769
#SLACK INTEGRATION
741770
enable_slack = (local.use_slack_enable_override) ? local.enable_slack : var.cc_enable_slack

code-engine/variables.tf

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,12 +659,36 @@ variable "pr_pipeline_git_tag" {
659659
default = ""
660660
}
661661

662+
variable "ci_pipeline_properties" {
663+
type = string
664+
description = "Stringified JSON containing the properties for the CI toolchain pipelines."
665+
default = ""
666+
}
667+
668+
variable "ci_pipeline_properties_filepath" {
669+
type = string
670+
description = "The path to the file containing the property JSON. If this is not set, it will by default read the `properties.json` file at the root of the module."
671+
default = ""
672+
}
673+
662674
variable "ci_print_code_signing_certificate" {
663675
type = string
664676
description = "Set to `1` to enable printing of the public signing certificate in the logs."
665677
default = "1"
666678
}
667679

680+
variable "ci_repository_properties" {
681+
type = string
682+
description = "Stringified JSON containing the repositories and triggers that get created in the CI toolchain pipelines."
683+
default = ""
684+
}
685+
686+
variable "ci_repository_properties_filepath" {
687+
type = string
688+
description = "The path to the file containing the repository and triggers JSON. If this is not set, it will by default read the `repositories.json` file at the root of the module."
689+
default = ""
690+
}
691+
668692
variable "ci_repositories_prefix" {
669693
type = string
670694
description = "Prefix name for the cloned compliance repos. For the repositories_prefix value only a-z, A-Z and 0-9 and the special characters `-_` are allowed. In addition the string must not end with a special character or have two consecutive special characters."
@@ -692,6 +716,84 @@ variable "ci_link_to_doi_toolchain" {
692716
default = false
693717
}
694718

719+
variable "pr_cra_bom_generate" {
720+
type = string
721+
description = "Set this flag to `1` to generate cra bom in PR pipeline"
722+
default = "1"
723+
validation {
724+
condition = contains(["0", "1"], var.pr_cra_bom_generate)
725+
error_message = "Must be either \"0\" or \"1\" ."
726+
}
727+
}
728+
729+
variable "pr_cra_vulnerability_scan" {
730+
type = string
731+
description = "Set this flag to `1` and `pr-cra-bom-generate` to `1` for cra vulnerability scan in PR pipeline. If this value is set to `1` and `pr-cra-bom-generate` is set to `0`, the scan will be marked as `failure`"
732+
default = "1"
733+
validation {
734+
condition = contains(["0", "1"], var.pr_cra_vulnerability_scan)
735+
error_message = "Must be either \"0\" or \"1\" ."
736+
}
737+
738+
}
739+
740+
variable "pr_cra_deploy_analysis" {
741+
type = string
742+
description = "Set this flag to `1` for cra deployment analysis to be done in PR pipeline."
743+
default = "1"
744+
validation {
745+
condition = contains(["0", "1"], var.pr_cra_deploy_analysis)
746+
error_message = "Must be either \"0\" or \"1\" ."
747+
}
748+
}
749+
750+
variable "ci_cra_bom_generate" {
751+
type = string
752+
description = "Set this flag to `1` to generate cra bom in CI pipeline."
753+
default = "1"
754+
validation {
755+
condition = contains(["0", "1"], var.ci_cra_bom_generate)
756+
error_message = "Must be either \"0\" or \"1\" ."
757+
}
758+
}
759+
760+
variable "ci_cra_vulnerability_scan" {
761+
type = string
762+
description = "Set this flag to `1` and `ci-cra-bom-generate` to `1` for cra vulnerability scan in CI pipeline. If this value is set to 1 and `ci-cra-bom-generate` is set to `0`, the scan will be marked as `failure`"
763+
default = "1"
764+
validation {
765+
condition = contains(["0", "1"], var.ci_cra_vulnerability_scan)
766+
error_message = "Must be either \"0\" or \"1\" ."
767+
}
768+
769+
}
770+
771+
variable "ci_cra_deploy_analysis" {
772+
type = string
773+
description = "Set this flag to `1` for cra deployment analysis to be done in CI pipeline."
774+
default = "1"
775+
validation {
776+
condition = contains(["0", "1"], var.ci_cra_deploy_analysis)
777+
error_message = "Must be either \"0\" or \"1\" ."
778+
}
779+
}
780+
781+
variable "ci_enable_pipeline_notifications" {
782+
type = bool
783+
description = "When enabled, pipeline run events will be sent to the Event Notifications and Slack integrations in the enclosing toolchain."
784+
default = false
785+
}
786+
787+
variable "ci_event_notifications" {
788+
type = string
789+
description = "To enable event notification, set event_notifications to 1 "
790+
default = "0"
791+
validation {
792+
condition = contains(["0", "1"], var.ci_event_notifications)
793+
error_message = "Must be either \"0\" or \"1\" ."
794+
}
795+
}
796+
695797
variable "ci_doi_toolchain_id" {
696798
type = string
697799
description = "DevOps Insights toolchain ID to link to."
@@ -1918,12 +2020,62 @@ variable "cd_enable_key_protect" {
19182020
default = false
19192021
}
19202022

2023+
variable "cd_enable_pipeline_notifications" {
2024+
type = bool
2025+
description = "When enabled, pipeline run events will be sent to the Event Notifications and Slack integrations in the enclosing toolchain."
2026+
default = false
2027+
}
2028+
2029+
variable "cd_event_notifications" {
2030+
type = string
2031+
description = "To enable event notification, set event_notifications to 1 "
2032+
default = "0"
2033+
validation {
2034+
condition = contains(["0", "1"], var.cd_event_notifications)
2035+
error_message = "Must be either \"0\" or \"1\" ."
2036+
}
2037+
}
2038+
19212039
variable "cd_enable_secrets_manager" {
19222040
description = "Use the Secrets Manager integration."
19232041
type = bool
19242042
default = false
19252043
}
19262044

2045+
variable "cd_pipeline_properties" {
2046+
type = string
2047+
description = "Stringified JSON containing the properties for the CD toolchain pipelines."
2048+
default = ""
2049+
}
2050+
2051+
variable "cd_pipeline_properties_filepath" {
2052+
type = string
2053+
description = "The path to the file containing the property JSON. If this is not set, it will by default read the `properties.json` file at the root of the module."
2054+
default = ""
2055+
}
2056+
2057+
variable "cd_pre_prod_evidence_collection" {
2058+
type = string
2059+
description = "Set this flag to collect the pre-prod evidences and the change requests in the production deployment (target-environment-purpose set to production). Default value is 0."
2060+
default = "0"
2061+
validation {
2062+
condition = contains(["0", "1"], var.cd_pre_prod_evidence_collection)
2063+
error_message = "Must be either \"0\" or \"1\" ."
2064+
}
2065+
}
2066+
2067+
variable "cd_repository_properties" {
2068+
type = string
2069+
description = "Stringified JSON containing the repositories and triggers that get created in the CI toolchain pipelines."
2070+
default = ""
2071+
}
2072+
2073+
variable "cd_repository_properties_filepath" {
2074+
type = string
2075+
description = "The path to the file containing the repository and triggers JSON. If this is not set, it will by default read the `repositories.json` file at the root of the module."
2076+
default = ""
2077+
}
2078+
19272079
variable "cd_sm_secret_group" {
19282080
type = string
19292081
description = "Group in Secrets Manager for organizing/grouping secrets."
@@ -3576,6 +3728,53 @@ variable "cc_compliance_pipeline_branch" {
35763728
default = ""
35773729
}
35783730

3731+
variable "cc_cra_bom_generate" {
3732+
type = string
3733+
description = "Set this flag to `1` to generate cra bom"
3734+
default = "1"
3735+
validation {
3736+
condition = contains(["0", "1"], var.cc_cra_bom_generate)
3737+
error_message = "Must be either \"0\" or \"1\" ."
3738+
}
3739+
}
3740+
3741+
variable "cc_cra_vulnerability_scan" {
3742+
type = string
3743+
description = "Set this flag to `1` and `cra-bom-generate` to `1` for cra vulnerability scan. If this value is set to 1 and `cra-bom-generate` is set to 0, the scan will be marked as `failure`"
3744+
default = "1"
3745+
validation {
3746+
condition = contains(["0", "1"], var.cc_cra_vulnerability_scan)
3747+
error_message = "Must be either \"0\" or \"1\" ."
3748+
}
3749+
3750+
}
3751+
3752+
variable "cc_cra_deploy_analysis" {
3753+
type = string
3754+
description = "Set this flag to `1` for cra deployment analysis to be done."
3755+
default = "1"
3756+
validation {
3757+
condition = contains(["0", "1"], var.cc_cra_deploy_analysis)
3758+
error_message = "Must be either \"0\" or \"1\" ."
3759+
}
3760+
}
3761+
3762+
variable "cc_enable_pipeline_notifications" {
3763+
type = bool
3764+
description = "When enabled, pipeline run events will be sent to the Event Notifications and Slack integrations in the enclosing toolchain."
3765+
default = false
3766+
}
3767+
3768+
variable "cc_event_notifications" {
3769+
type = string
3770+
description = "To enable event notification, set event_notifications to 1 "
3771+
default = "0"
3772+
validation {
3773+
condition = contains(["0", "1"], var.cc_event_notifications)
3774+
error_message = "Must be either \"0\" or \"1\" ."
3775+
}
3776+
}
3777+
35793778
variable "cc_pipeline_git_tag" {
35803779
type = string
35813780
description = "The GIT tag within the pipeline definitions repository for the Compliance CC Pipeline."
@@ -3588,6 +3787,30 @@ variable "cc_pipeline_debug" {
35883787
default = "0"
35893788
}
35903789

3790+
variable "cc_pipeline_properties" {
3791+
type = string
3792+
description = "Stringified JSON containing the properties for the CC toolchain pipelines."
3793+
default = ""
3794+
}
3795+
3796+
variable "cc_pipeline_properties_filepath" {
3797+
type = string
3798+
description = "The path to the file containing the property JSON. If this is not set, it will by default read the `properties.json` file at the root of the module."
3799+
default = ""
3800+
}
3801+
3802+
variable "cc_repository_properties" {
3803+
type = string
3804+
description = "Stringified JSON containing the repositories and triggers that get created in the CI toolchain pipelines."
3805+
default = ""
3806+
}
3807+
3808+
variable "cc_repository_properties_filepath" {
3809+
type = string
3810+
description = "The path to the file containing the repository and triggers JSON. If this is not set, it will by default read the `repositories.json` file at the root of the module."
3811+
default = ""
3812+
}
3813+
35913814
variable "cc_opt_in_dynamic_api_scan" {
35923815
type = string
35933816
description = "To enable the OWASP Zap API scan. '1' enable or '0' disable."

examples/default/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "terraform_devsecops_alm" {
2-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.6.1"
2+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.7.0"
33
ibmcloud_api_key = var.ibmcloud_api_key
44
toolchain_resource_group = var.toolchain_resource_group
55
toolchain_region = var.toolchain_region

examples/devsecops-ci-toolchain-bring-your-own-app/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "terraform_devsecops_alm" {
2-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.6.1"
2+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.7.0"
33
ibmcloud_api_key = var.ibmcloud_api_key
44
toolchain_resource_group = var.toolchain_resource_group
55
toolchain_region = var.toolchain_region

examples/devsecops-ci-toolchain-with-key-protect/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "terraform_devsecops_alm" {
2-
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.6.1"
2+
source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-devsecops-alm?ref=v1.7.0"
33
ibmcloud_api_key = var.ibmcloud_api_key
44
toolchain_resource_group = var.toolchain_resource_group
55
toolchain_region = var.toolchain_region

0 commit comments

Comments
 (0)