-
Notifications
You must be signed in to change notification settings - Fork 5
Ce projects da #92
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ce projects da #92
Changes from 12 commits
1f44934
6391503
1763a87
df9f3e8
6dd146d
51513ff
5c169c8
2303f85
0b2b370
08904b2
cf7ebd4
c6d7a49
b1ed3b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# IBM Cloud Code Engine projects deployable architecture | ||
|
||
This deployable architecture creates IBM Cloud Code Engine projects and the following optional resources: | ||
|
||
- A resource group. | ||
|
||
 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"ibmcloud_api_key": $VALIDATION_APIKEY, | ||
"resource_group_name": $PREFIX, | ||
"prefix": $PREFIX, | ||
"project_names": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah this syntax is not supported. The variable substitution only works for strings right now. However you should be able to do this and it will add the prefix value to each project name right? So the validation wont have ant name clashes.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A list of project names is required input. Is there another way of passing the values? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That string will convert to a terraform list when passed to projects / schematics. Just like it does here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daniel-butler-irl you still need to update to |
||
$PREFIX | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
locals { | ||
# add prefix to all projects created by this solution if prefix is not null | ||
projects = [ | ||
for project in var.project_names : ( | ||
var.prefix != null ? "${var.prefix}-${project}" : project | ||
) | ||
] | ||
} | ||
|
||
######################################################################################################################## | ||
# Resource group | ||
######################################################################################################################## | ||
|
||
module "resource_group" { | ||
source = "terraform-ibm-modules/resource-group/ibm" | ||
version = "1.1.6" | ||
resource_group_name = var.existing_resource_group == false ? var.resource_group_name : null | ||
existing_resource_group_name = var.existing_resource_group == true ? var.resource_group_name : null | ||
} | ||
|
||
######################################################################################################################## | ||
# Code Engine Projects | ||
######################################################################################################################## | ||
|
||
module "project" { | ||
for_each = toset(local.projects) | ||
source = "../../modules/project" | ||
name = each.value | ||
resource_group_id = module.resource_group.resource_group_id | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
######################################################################################################################## | ||
# Outputs | ||
######################################################################################################################## | ||
|
||
output "project_name_id_map" { | ||
description = "Map of project names to their corresponding IDs." | ||
value = { for p in module.project : p.name => p.project_id } | ||
} | ||
|
||
# IBM Projects Stacks do not support complex outputs at this time, | ||
# As a workaround, we will output the first 5 projects individually. If a project does not exist, the output will be null. | ||
output "project_1_name" { | ||
description = "Name of the first project." | ||
value = length(values(module.project)) > 0 ? values(module.project)[0].name : null | ||
} | ||
|
||
output "project_1_id" { | ||
description = "ID of the first project." | ||
value = length(values(module.project)) > 0 ? values(module.project)[0].project_id : null | ||
} | ||
|
||
output "project_2_name" { | ||
description = "Name of the second project." | ||
value = length(values(module.project)) > 1 ? values(module.project)[1].name : null | ||
} | ||
|
||
output "project_2_id" { | ||
description = "ID of the second project." | ||
value = length(values(module.project)) > 1 ? values(module.project)[1].project_id : null | ||
} | ||
|
||
output "project_3_name" { | ||
description = "Name of the third project." | ||
value = length(values(module.project)) > 2 ? values(module.project)[2].name : null | ||
} | ||
|
||
output "project_3_id" { | ||
description = "ID of the third project." | ||
value = length(values(module.project)) > 2 ? values(module.project)[2].project_id : null | ||
} | ||
|
||
output "project_4_name" { | ||
description = "Name of the fourth project." | ||
value = length(values(module.project)) > 3 ? values(module.project)[3].name : null | ||
} | ||
|
||
output "project_4_id" { | ||
description = "ID of the fourth project." | ||
value = length(values(module.project)) > 3 ? values(module.project)[3].project_id : null | ||
} | ||
|
||
output "project_5_name" { | ||
description = "Name of the fifth project." | ||
value = length(values(module.project)) > 4 ? values(module.project)[4].name : null | ||
} | ||
|
||
output "project_5_id" { | ||
description = "ID of the fifth project." | ||
value = length(values(module.project)) > 4 ? values(module.project)[4].project_id : null | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
######################################################################################################################## | ||
# Provider config | ||
######################################################################################################################## | ||
|
||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
region = var.region | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
######################################################################################################################## | ||
# Input variables | ||
######################################################################################################################## | ||
|
||
variable "ibmcloud_api_key" { | ||
type = string | ||
description = "The IBM Cloud API key." | ||
sensitive = true | ||
} | ||
|
||
variable "prefix" { | ||
type = string | ||
description = "Prefix to added to all projects created by this solution." | ||
default = null | ||
nullable = true | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
description = "The region in which to provision all resources created by this solution." | ||
default = "us-south" | ||
} | ||
|
||
variable "existing_resource_group" { | ||
type = bool | ||
description = "Whether to use an existing resource group." | ||
default = false | ||
} | ||
|
||
variable "resource_group_name" { | ||
type = string | ||
description = "The name of a new or an existing resource group to provision the IBM Cloud Code Engine resources to." | ||
} | ||
|
||
variable "project_names" { | ||
description = "The names of the projects to add the IBM Cloud Code Engine." | ||
type = list(string) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
terraform { | ||
required_version = ">= 1.3.0" | ||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = "1.68.1" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you didnt include any compliance section in the ibm_catalog.json so these SCC details will not be used. This means that no SCC scan will be done, and the flavor wont show a compliance tab in the tile. If there is even 1 compliance rule that is applicable to code engine projects, we should probably add a compliance section to the ibm_catalog.json for this flavor, but I’ll create a follow up issue so we don't hold this PR up