-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: several updates to module template (#848)
- Loading branch information
Showing
19 changed files
with
315 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Primary owner should be listed first in list of global owners, followed by any secondary owners | ||
* @SirSpidey @ocofaigh | ||
* @ocofaigh @daniel-butler-irl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml | ||
# | ||
# Developer tips: | ||
# - CRA = Code Risk Analyzer (more info on CRA: https://cloud.ibm.com/docs/code-risk-analyzer-cli-plugin?topic=code-risk-analyzer-cli-plugin-cra-cli-plugin) | ||
# - Multiple directories can be scanned by CRA. Ensure if there are any deployable architecture in the repository that they are all scanned | ||
# - More info about supported configurations at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml | ||
# | ||
|
||
version: "v1" | ||
CRA_TARGETS: | ||
- CRA_TARGET: "examples/advanced" # Target directory for CRA scan. If not provided, the CRA Scan will not be run. | ||
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json` | ||
PROFILE_ID: "0e6e7b5a-817d-4344-ab6f-e5d7a9c49520" # SCC profile ID (currently set to the FSCloud 1.4.0 profile). | ||
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" | ||
PROFILE_ID: "fe96bd4d-9b37-40f2-b39f-a62760e326a3" # SCC profile ID (currently set to 'IBM Cloud Framework for Financial Services' '1.7.0' profile). | ||
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used. | ||
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used. | ||
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs. | ||
# TF_VAR_sample: "sample value" | ||
# TF_VAR_other: "another value" | ||
CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs. | ||
TF_VAR_prefix: "mock" | ||
TF_VAR_region: "us-south" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
############################################################################## | ||
# Complete example | ||
############################################################################## | ||
######################################################################################################################## | ||
# Resource group | ||
######################################################################################################################## | ||
|
||
module "resource_group" { | ||
source = "terraform-ibm-modules/resource-group/ibm" | ||
version = "1.1.6" | ||
# if an existing resource group is not set (null) create a new one using prefix | ||
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null | ||
existing_resource_group_name = var.resource_group | ||
} | ||
|
||
######################################################################################################################## | ||
# COS | ||
######################################################################################################################## | ||
|
||
# | ||
# Developer tips: | ||
# - Call the local module / modules in the example to show how they can be consumed | ||
# - Include the actual module source as a code comment like below so consumers know how to consume from correct location | ||
# | ||
|
||
module "cos" { | ||
source = "../.." | ||
# remove the above line and uncomment the below 2 lines to consume the module from the registry | ||
# source = "terraform-ibm-modules/<replace>/ibm" | ||
# version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release | ||
name = "${var.prefix}-cos" | ||
resource_group_id = module.resource_group.resource_group_id | ||
resource_tags = var.resource_tags | ||
plan = "cos-one-rate-plan" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
######################################################################################################################## | ||
# Input variables | ||
######################################################################################################################## | ||
|
||
# | ||
# Module developer tips: | ||
# - Examples are references that consumers can use to see how the module can be consumed. They are not designed to be | ||
# flexible re-usable solutions for general consumption, so do not expose any more variables here and instead hard | ||
# code things in the example main.tf with code comments explaining the different configurations. | ||
# - For the same reason as above, do not add default values to the example inputs. | ||
# | ||
|
||
variable "ibmcloud_api_key" { | ||
type = string | ||
description = "The IBM Cloud API Key" | ||
description = "The IBM Cloud API Key." | ||
sensitive = true | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
description = "Region to provision all resources created by this example" | ||
default = "us-south" | ||
description = "Region to provision all resources created by this example." | ||
} | ||
|
||
variable "prefix" { | ||
type = string | ||
description = "Prefix to append to all resources created by this example" | ||
default = "complete" | ||
description = "A string value to prefix to all resources created by this example." | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "An existing resource group name to use for this example, if unset a new resource group will be created" | ||
description = "The name of an existing resource group to provision resources in to. If not set a new resource group will be created using the prefix variable." | ||
default = null | ||
} | ||
|
||
variable "resource_tags" { | ||
type = list(string) | ||
description = "Optional list of tags to be added to created resources" | ||
description = "List of resource tag to associate with all resource instances created by this example." | ||
default = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
terraform { | ||
required_version = ">= 1.3.0" | ||
required_version = ">= 1.9.0" | ||
|
||
# | ||
# Developer tips: | ||
# - Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main | ||
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version. | ||
# | ||
|
||
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main | ||
# module's version.tf (usually a basic example), and 1 example that will always use the latest provider version. | ||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = ">= 1.49.0, < 2.0.0" | ||
version = ">= 1.71.2, < 2.0.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.