generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Add account settings variation #51
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
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
dd400a4
Add account settings variation
8a37e19
update catalog and variables
1595eff
Merge branch 'main' of https://github.com/terraform-ibm-modules/terra…
3f02fc1
Merge branch 'main' of https://github.com/terraform-ibm-modules/terra…
7bacd4d
add metrics router account settings variation
d70265d
update main.tf & catalog
46f2493
revert changes
861cea1
update account setting variation
e8cd0cc
update DA types
e38c736
add TestRunAccountSettings
5361936
update reference architecture diagram
cbfc67f
update catalog.json
ee4ec61
update pr_test and description
fa2c5de
Resolver pre-commit error,Added permission
1d18da0
Merge branch 'main' into 13686-acc
arya-girish-k 6ae2939
fix: Removed region in provider.tf,Update default_target type
186a60c
Removed DA_types.md
311ac21
Merge branch 'main' into 13686-acc
arya-girish-k 18954fa
Addressed review comments
4a7b8c3
Removed logfile
11c709c
fix: Resolve precommit error
ced9854
Merge branch 'main' into 13686-acc
arya-girish-k d7a2d36
Addressed review comments
eb9d93d
removed logfile
d2dc46a
Merge branch 'main' into 13686-acc
arya-girish-k 16f4c79
Added ignore update list
ebc143f
added catalogValidationValues.json.template and modified catalog-onbo…
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
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
4 changes: 4 additions & 0 deletions
4
reference-architecture/deployable-architecture-account-settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Configuring complex inputs for Cloud Automation for Cloud Monitoring | ||
|
|
||
| Several optional input variables in the IBM Cloud [Cloud Monitoring account settings deployable architecture](https://cloud.ibm.com/catalog#deployable_architecture) use complex object types. You specify these inputs when you configure deployable architecture. | ||
|
|
||
| * [Metrics Router Default target](#default_targets) (`default_targets`) | ||
|
|
||
| ## Default targets <a name="default_targets"></a> | ||
|
|
||
| The `default_targets` input variable allows you to provide a list of targets that will be configured as a target for IBM Cloud Metrics Routing. Refer [here](https://cloud.ibm.com/docs/metrics-router?topic=metrics-router-settings-about&interface=ui) for more information. | ||
|
|
||
| * Variable name: `default_targets`. | ||
| * Type: A list of objects. Each object represents a target. | ||
| * Default value: An empty list (`[]`). | ||
|
|
||
| ### Options for default_targets | ||
|
|
||
| * `id` (required): The id of the Cloud Monitoring target. | ||
|
|
||
| ### Example route for default target configuration | ||
|
|
||
| ```hcl | ||
| [ | ||
| { | ||
| id = "c3af557f-fb0e-4476-85c3-0889e7fe7bc4" | ||
| } | ||
| ] | ||
| ``` |
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,3 @@ | ||
| # Cloud automation for Cloud Monitoring (Metrics Router Account Settings) | ||
|
|
||
| :exclamation: **Important:** This solution is not intended to be called by other modules because it contains a provider configuration and is not compatible with the `for_each`, `count`, and `depends_on` arguments. For more information, see [Providers Within Modules](https://developer.hashicorp.com/terraform/language/modules/develop/providers). |
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,15 @@ | ||
| ####################################################################################################################### | ||
| # IBM Cloud Metrics Routing | ||
| ####################################################################################################################### | ||
|
|
||
| module "metrics_router_account_settings" { | ||
| source = "../../modules/metrics_routing" | ||
|
|
||
| metrics_router_settings = { | ||
| default_targets = var.default_targets | ||
| permitted_target_regions = var.permitted_target_regions | ||
| primary_metadata_region = var.primary_metadata_region | ||
| backup_metadata_region = var.backup_metadata_region | ||
| private_api_endpoint_only = var.private_api_endpoint_only | ||
| } | ||
| } |
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,8 @@ | ||
| ############################################################################## | ||
| # Outputs | ||
| ############################################################################## | ||
|
|
||
| output "metrics_router_account_settings" { | ||
| description = "IBM Cloud metrics router account settings." | ||
| value = module.metrics_router_account_settings.metrics_router_settings | ||
| } |
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,9 @@ | ||
| ######################################################################################################################## | ||
| # Provider config | ||
| ######################################################################################################################## | ||
|
|
||
| provider "ibm" { | ||
| ibmcloud_api_key = var.ibmcloud_api_key | ||
| region = var.region | ||
| visibility = var.provider_visibility | ||
| } |
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,62 @@ | ||
| ######################################################################################################################## | ||
| # Common variables | ||
| ######################################################################################################################## | ||
|
|
||
| variable "ibmcloud_api_key" { | ||
| type = string | ||
| description = "The IBM Cloud API key to deploy resources." | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sensitive = true | ||
| } | ||
|
|
||
| variable "provider_visibility" { | ||
| description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)." | ||
| type = string | ||
| default = "private" | ||
|
|
||
| validation { | ||
| condition = contains(["public", "private", "public-and-private"], var.provider_visibility) | ||
| error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'." | ||
| } | ||
| } | ||
|
|
||
| variable "region" { | ||
| description = "The IBM Cloud region where Cloud monitoring instance will be created." | ||
| type = string | ||
| default = "us-south" | ||
| } | ||
|
|
||
| ######################################################################################################################## | ||
| # IBM Cloud Metrics Routing | ||
| ######################################################################################################################## | ||
|
|
||
| variable "default_targets" { | ||
| description = "The default target locations, that is, 1 or more targets in the account, that will collect metrics from supported IBM Cloud Metrics Routing locations where you have not configured how you want to collect metrics. You can define up to 2 default targets per account. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-cloud-monitoring/blob/main/solutions/metrics-router-account-settings/DA-types.md#default-targets-)" | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type = list(object({ | ||
| id = string | ||
| })) | ||
| default = [] | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| variable "primary_metadata_region" { | ||
| description = "The location in your IBM Cloud account where the IBM Cloud Metrics Routing account configuration metadata is stored. To store all your meta data in a single region. For new accounts, all target/route creation will fail until `primary_metadata_region` is set." | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "backup_metadata_region" { | ||
| description = "You can also configure a backup location where the metadata is stored for recovery purposes. The `backup_metadata_region` can't be the same as `primary_metadata_region`." | ||
| type = string | ||
| default = null | ||
| } | ||
|
|
||
| variable "permitted_target_regions" { | ||
| description = "List of regions where metrics are allowed to be sent." | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type = list(string) | ||
| default = [] | ||
| } | ||
|
|
||
| variable "private_api_endpoint_only" { | ||
| description = "The type of endpoints that are allowed to manage the IBM Cloud Metrics Routing account configuration in the account. By default, public and private endpoints are enabled. When public endpoints are disabled, the IBM Cloud Metrics Routing UI will be inaccessible." | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type = bool | ||
| default = false | ||
| } | ||
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,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9.0" | ||
| required_providers { | ||
| ibm = { | ||
| source = "ibm-cloud/ibm" | ||
| version = "1.76.1" | ||
| } | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ import ( | |
| const resourceGroup = "geretain-test-resources" | ||
|
|
||
| const fullyconfigurableDADir = "solutions/fully-configurable" | ||
| const AccountSettingsDADir = "solutions/metrics-router-account-settings" | ||
|
|
||
| var validRegions = []string{ | ||
| "au-syd", | ||
|
|
@@ -158,3 +159,44 @@ func TestRunUpgradeFullyConfigurable(t *testing.T) { | |
| logger.Log(t, "END: Destroy (prereq resources)") | ||
| } | ||
| } | ||
|
|
||
| func TestRunAccountSettings(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| region := validRegions[rand.Intn(len(validRegions))] | ||
| prefix := "mr" | ||
|
|
||
| // Verify ibmcloud_api_key variable is set | ||
| checkVariable := "TF_VAR_ibmcloud_api_key" | ||
| val, present := os.LookupEnv(checkVariable) | ||
| require.True(t, present, checkVariable+" environment variable not set") | ||
| require.NotEqual(t, "", val, checkVariable+" environment variable is empty") | ||
|
|
||
| permitted_target_regions := []string{"us-south", "eu-de", "us-east", "eu-es", "eu-gb", "au-syd", "br-sao", "ca-tor", "jp-tok", "jp-osa"} | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{ | ||
| Testing: t, | ||
| Region: region, | ||
| Prefix: prefix, | ||
| TarIncludePatterns: []string{ | ||
| "*.tf", | ||
| "modules/metrics_routing" + "/*.tf", | ||
| AccountSettingsDADir + "/*.tf", | ||
| }, | ||
| TemplateFolder: AccountSettingsDADir, | ||
| Tags: []string{"mr-da-test"}, | ||
| DeleteWorkspaceOnFail: false, | ||
| WaitJobCompleteMinutes: 60, | ||
|
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. @arya-girish-k I just noticed you never added the |
||
| }) | ||
|
|
||
| options.TerraformVars = []testschematic.TestSchematicTerraformVar{ | ||
| {Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true}, | ||
| {Name: "region", Value: region, DataType: "string"}, | ||
| {Name: "primary_metadata_region", Value: "eu-de", DataType: "string"}, | ||
| {Name: "backup_metadata_region", Value: "us-east", DataType: "string"}, // The `backup_metadata_region` should not be same as `primary_metadata_region` so hard-coded the region here | ||
arya-girish-k marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {Name: "permitted_target_regions", Value: permitted_target_regions, DataType: "list(string)"}, | ||
| } | ||
|
|
||
| err := options.RunSchematicTest() | ||
| assert.Nil(t, err, "This should not have errored") | ||
| } | ||
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.