generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: added missing examples and plugged test gaps #384
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
32a34ec
feat: added missing examples and plugged test gaps
Aditya-ranjan-16 3a06e3e
Merge branch 'main' into test-coverage
Aditya-ranjan-16 ca80ff5
Merge branch 'main' into test-coverage
Aditya-ranjan-16 aca906b
feat: added existing instance test and refactored tests
Aditya-ranjan-16 b9ea717
fix: pre-commit
Aayush-Abhyarthi 5179634
fix
Aditya-ranjan-16 fdcf49e
fix: pre-commit
Aayush-Abhyarthi b6a4d7c
Merge branch 'main' into test-coverage
Aditya-ranjan-16 8fe95d5
Merge branch 'main' into test-coverage
shemau 7b7f417
Merge branch 'main' into test-coverage
ocofaigh 9e8049f
Merge branch 'main' into test-coverage
Aditya-ranjan-16 74cac69
fix:doc changes
Aditya-ranjan-16 25378ba
fix:pre commit
Aditya-ranjan-16 e2be1a2
fix pre-commit
Aayush-Abhyarthi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Submodule common-dev-assets
updated
6 files
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Restore from backup example | ||
|
|
||
| This example provides an end-to-end executable flow of how a Elasticsearch DB can be created from a backup instance. This example uses the IBM Cloud terraform provider to: | ||
|
|
||
| - Create a new resource group if one is not passed in. | ||
| - Create a new ICD Elasticsearch database instance if no existing backup crn is provided. | ||
| - Create a restored ICD Elasticsearch database instance pointing to the backup of the first instance. |
6 changes: 6 additions & 0 deletions
6
examples/backup-restore/catalogValidationValues.json.template
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "ibmcloud_api_key": $VALIDATION_APIKEY, | ||
| "region": "us-south", | ||
| "resource_tags": $TAGS, | ||
| "prefix": $PREFIX | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ############################################################################## | ||
| # 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 | ||
| } | ||
|
|
||
| data "ibm_database_backups" "backup_database" { | ||
| deployment_id = var.existing_database_crn | ||
| } | ||
| # New elasticsearch instance pointing to the backup instance | ||
| module "restored_icd_elasticsearch" { | ||
| source = "../.." | ||
| resource_group_id = module.resource_group.resource_group_id | ||
| name = "${var.prefix}-elasticsearch-restored" | ||
| elasticsearch_version = var.elasticsearch_version | ||
| region = var.region | ||
| tags = var.resource_tags | ||
| access_tags = var.access_tags | ||
| member_host_flavor = "multitenant" | ||
| backup_crn = data.ibm_database_backups.backup_database.backups[0].backup_id | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ############################################################################## | ||
| # Outputs | ||
| ############################################################################## | ||
| output "restored_icd_elasticsearch_id" { | ||
| description = "Restored elasticsearch instance id" | ||
| value = module.restored_icd_elasticsearch.id | ||
| } | ||
|
|
||
| output "restored_icd_elasticsearch_version" { | ||
| description = "Restored elasticsearch instance version" | ||
| value = module.restored_icd_elasticsearch.version | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| provider "ibm" { | ||
| ibmcloud_api_key = var.ibmcloud_api_key | ||
| region = var.region | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| variable "ibmcloud_api_key" { | ||
| type = string | ||
| 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" | ||
| } | ||
|
|
||
| variable "prefix" { | ||
| type = string | ||
| description = "Prefix to append to all resources created by this example" | ||
| default = "backup" | ||
| } | ||
|
|
||
| variable "elasticsearch_version" { | ||
| type = string | ||
| description = "Version of the elasticsearch instance. If no value passed, the current ICD preferred version is used." | ||
| default = null | ||
| } | ||
|
|
||
| variable "resource_group" { | ||
Aditya-ranjan-16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type = string | ||
| description = "An existing resource group name to use for this example, if unset a new resource group will be created" | ||
| default = null | ||
| } | ||
|
|
||
| variable "resource_tags" { | ||
| type = list(string) | ||
| description = "Optional list of tags to be added to created resources" | ||
| default = [] | ||
| } | ||
|
|
||
| variable "access_tags" { | ||
| type = list(string) | ||
| description = "A list of access tags to apply to the elasticsearch instance created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details" | ||
| default = [] | ||
| } | ||
|
|
||
| variable "existing_database_crn" { | ||
| type = string | ||
| description = "The existing CRN of a backup resource to restore from." | ||
| default = null | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| terraform { | ||
| required_version = ">= 1.3.0" | ||
| required_providers { | ||
| # Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main | ||
| # module's version.tf (basic example), and 1 example that will always use the latest provider version (complete example). | ||
| ibm = { | ||
| source = "IBM-Cloud/ibm" | ||
| version = ">=1.70.0, <2.0.0" | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.