File tree Expand file tree Collapse file tree 9 files changed +115
-0
lines changed Expand file tree Collapse file tree 9 files changed +115
-0
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,17 @@ offerings:
9
9
- name : security-enforced
10
10
mark_ready : true
11
11
install_type : fullstack
12
+ pre_validation : " tests/scripts/pre-validate.sh solutions/security-enforced"
13
+ post_validation : " tests/scripts/post-validate.sh"
12
14
scc :
13
15
instance_id : 1c7d5f78-9262-44c3-b779-b28fe4d88c37
14
16
region : us-south
15
17
scope_resource_group_var_name : existing_resource_group_name
16
18
- name : fully-configurable
17
19
mark_ready : true
18
20
install_type : fullstack
21
+ pre_validation : " tests/scripts/pre-validate.sh solutions/fully-configurable"
22
+ post_validation : " tests/scripts/post-validate.sh"
19
23
scc :
20
24
instance_id : 1c7d5f78-9262-44c3-b779-b28fe4d88c37
21
25
region : us-south
Original file line number Diff line number Diff line change
1
+ The terraform code in this directory is used for by catalog pipeline
Original file line number Diff line number Diff line change
1
+ # #############################################################################
2
+ # Resource Group
3
+ # #############################################################################
4
+
5
+ module "resource_group" {
6
+ source = " terraform-ibm-modules/resource-group/ibm"
7
+ version = " 1.3.0"
8
+ # if an existing resource group is not set (null) create a new one using prefix
9
+ resource_group_name = var. resource_group == null ? " ${ var . prefix } -resource-group" : null
10
+ existing_resource_group_name = var. resource_group
11
+ }
Original file line number Diff line number Diff line change
1
+ # #############################################################################
2
+ # Outputs
3
+ # #############################################################################
4
+
5
+ output "resource_group_id" {
6
+ value = module. resource_group . resource_group_id
7
+ description = " Resource group ID."
8
+ }
9
+
10
+ output "resource_group_name" {
11
+ value = module. resource_group . resource_group_name
12
+ description = " Resource group name."
13
+ }
Original file line number Diff line number Diff line change
1
+ provider "ibm" {
2
+ ibmcloud_api_key = var. ibmcloud_api_key
3
+ }
Original file line number Diff line number Diff line change
1
+ variable "ibmcloud_api_key" {
2
+ type = string
3
+ description = " The IBM Cloud API Key."
4
+ sensitive = true
5
+ }
6
+
7
+ variable "prefix" {
8
+ type = string
9
+ description = " Prefix to append to all resources created by this example."
10
+ default = " sm"
11
+ }
12
+
13
+ variable "resource_group" {
14
+ type = string
15
+ description = " The name of an existing resource group to provision resources in. If not specified, a new resource group is created with the `prefix` variable."
16
+ default = null
17
+ }
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_version = " >= 1.9.0"
3
+ required_providers {
4
+ ibm = {
5
+ source = " ibm-cloud/ibm"
6
+ version = " >= 1.79.0"
7
+ }
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # #######################################################################################################################
4
+ # # This script is used by the catalog pipeline to destroy prerequisite resource required for catalog validation ##
5
+ # #######################################################################################################################
6
+
7
+ set -e
8
+
9
+ TERRAFORM_SOURCE_DIR=" tests/new-rg"
10
+ TF_VARS_FILE=" terraform.tfvars"
11
+
12
+ (
13
+ cd ${TERRAFORM_SOURCE_DIR}
14
+ echo " Destroying resource group .."
15
+ terraform destroy -input=false -auto-approve -var-file=${TF_VARS_FILE} || exit 1
16
+ rm -f " ${TF_VARS_FILE} "
17
+
18
+ echo " Post-validation completed successfully"
19
+ )
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # ###########################################################################################################
4
+ # # This script is used by the catalog pipeline to provision a new resource group
5
+ # # (required to ensure auth policies don't clash in account)
6
+ # ###########################################################################################################
7
+
8
+ set -e
9
+
10
+ DA_DIR=" ${1} "
11
+ TERRAFORM_SOURCE_DIR=" tests/new-rg"
12
+ JSON_FILE=" ${DA_DIR} /catalogValidationValues.json"
13
+ TF_VARS_FILE=" terraform.tfvars"
14
+
15
+ (
16
+ cwd=$( pwd)
17
+ cd ${TERRAFORM_SOURCE_DIR}
18
+ echo " Provisioning new resource group .."
19
+ terraform init || exit 1
20
+ # $VALIDATION_APIKEY is available in the catalog runtime
21
+ {
22
+ echo " ibmcloud_api_key=\" ${VALIDATION_APIKEY} \" "
23
+ echo " prefix=\" ocp-$( openssl rand -hex 2) \" "
24
+ } >> ${TF_VARS_FILE}
25
+ terraform apply -input=false -auto-approve -var-file=${TF_VARS_FILE} || exit 1
26
+
27
+ rg_var_name=" existing_resource_group_name"
28
+ rg_value=$( terraform output -state=terraform.tfstate -raw resource_group_name)
29
+
30
+ echo " Appending '${rg_var_name} ', input variable value to ${JSON_FILE} .."
31
+
32
+ cd " ${cwd} "
33
+ jq -r --arg rg_var_name " ${rg_var_name} " \
34
+ --arg rg_value " ${rg_value} " \
35
+ ' . + {($rg_var_name): $rg_value}' " ${JSON_FILE} " > tmpfile && mv tmpfile " ${JSON_FILE} " || exit 1
36
+
37
+ echo " Pre-validation complete successfully"
38
+ )
You can’t perform that action at this time.
0 commit comments