-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add support to create resource key #90
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
Changes from 41 commits
35ba0cb
bd4ccf0
78ad177
4df2403
07816b3
0bdb1dc
4647240
83a9a20
96c820d
7e13bc9
b15ad6a
d264ed8
441c212
986997c
08479eb
0807d34
a633588
71f7606
f8d23ba
f17f2df
c72858f
f5b9794
83e4cd0
bd9fcb0
5d7b07f
f68d9e6
dbc1eee
96489c8
68ab9c3
12183b3
736a645
ab6cca0
275d050
5da9bf6
9f829cd
1b32a05
132f678
f885ed0
33b9d98
6a02896
1b8e005
92b82c5
31339a2
8e2d1fa
bdf1388
df2e732
4e461cb
bf5e586
a4d04c4
58577bc
17dde29
ea61469
5280ede
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 |
|---|---|---|
|
|
@@ -17,6 +17,18 @@ output "resource_group_id" { | |
| description = "The resource group where cloud monitoring monitor instance resides." | ||
| } | ||
|
|
||
| output "cloud_monitoring_resource_keys" { | ||
| value = module.cloud_monitoring.resource_keys | ||
| description = "The map of resource keys created for the Cloud Monitoring instance." | ||
|
||
| sensitive = true | ||
| } | ||
|
|
||
| output "cloud_monitoring_access_key" { | ||
| value = module.cloud_monitoring.access_keys["SysdigManagerKey"] | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description = "The Cloud Monitoring access keys for agents to use." | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sensitive = true | ||
| } | ||
|
|
||
| output "ingestion_endpoint_private" { | ||
| value = module.cloud_monitoring.ingestion_endpoint_private | ||
| description = "The Cloud Monitoring private ingestion endpoint." | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,13 +31,33 @@ resource "ibm_resource_tag" "cloud_monitoring_tag" { | |
| tag_type = "access" | ||
| } | ||
|
|
||
| ############################################################################### | ||
| # Resource Key (Default Manager Key) | ||
| ############################################################################### | ||
|
|
||
| resource "ibm_resource_key" "resource_key" { | ||
| name = var.manager_key_name | ||
| count = var.disable_access_key_creation ? 0 : 1 | ||
|
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. wont this be a breaking change without a moved block? Why did upgrade test not fail? 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. No, when I ran locally terraform is understanding that we've added a count around the resource block. I will attach the screenshot 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. Are you sure? Usually a moved block is required when we add a count |
||
| name = var.access_key_name | ||
| resource_instance_id = ibm_resource_instance.cloud_monitoring.id | ||
| role = "Manager" | ||
| tags = var.manager_key_tags | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| ############################################################################### | ||
| # Resource Keys (Custom Access Keys) | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ############################################################################### | ||
|
|
||
| resource "ibm_resource_key" "resource_keys" { | ||
| for_each = { for key in var.resource_keys : key.name => key } | ||
| name = each.value.key_name == null ? each.key : each.value.key_name | ||
| resource_instance_id = ibm_resource_instance.cloud_monitoring.id | ||
| role = each.value.role | ||
| parameters = { | ||
| "serviceid_crn" = each.value.service_id_crn | ||
| "HMAC" = each.value.generate_hmac_credentials | ||
| } | ||
| } | ||
|
|
||
| ######################################################################## | ||
| # Context Based Restrictions | ||
| ######################################################################### | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,15 +23,26 @@ output "resource_group_id" { | |
| description = "The resource group where cloud monitoring monitor instance resides" | ||
| } | ||
|
|
||
| output "resource_keys" { | ||
| description = "Map of resource keys created for the IBM Cloud Monitoring instance, used by agents for authentication and data forwarding." | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| value = ibm_resource_key.resource_keys | ||
| sensitive = true | ||
| } | ||
|
|
||
| output "access_key" { | ||
| value = ibm_resource_key.resource_key.credentials["Sysdig Access Key"] | ||
| value = !var.disable_access_key_creation ? ibm_resource_key.resource_key[0].credentials["Sysdig Access Key"] : null | ||
| description = "The cloud monitoring access key for agents to use" | ||
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sensitive = true | ||
| } | ||
|
|
||
| output "manager_key_name" { | ||
|
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. We should keep this output, but it should be renamed to 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. I remember that I have renamed this and added it back, somehow it is not in the final push :( |
||
| value = ibm_resource_key.resource_key.name | ||
| description = "The cloud monitoring manager key name" | ||
| # https://cloud.ibm.com/docs/monitoring?topic=monitoring-access_key | ||
| output "access_keys" { | ||
ocofaigh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
iamar7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description = "The Cloud Monitoring access keys for agents to use." | ||
| value = length(var.resource_keys) == 0 ? null : { | ||
| for name, key in ibm_resource_key.resource_keys : | ||
| name => key.credentials["Sysdig Access Key"] | ||
| } | ||
| sensitive = true | ||
| } | ||
|
|
||
| # https://cloud.ibm.com/docs/monitoring?topic=monitoring-endpoints#endpoints_ingestion | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.