-
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 18 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| moved { | ||
| from = ibm_resource_key.resource_key | ||
| to = ibm_resource_key.resource_keys["SysdigManagerKey"] | ||
| } | ||
ocofaigh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,17 +23,12 @@ output "resource_group_id" { | |
| description = "The resource group where cloud monitoring monitor instance resides" | ||
| } | ||
|
|
||
| output "access_key" { | ||
| value = ibm_resource_key.resource_key.credentials["Sysdig Access Key"] | ||
| description = "The cloud monitoring access key for agents to use" | ||
| output "resource_keys" { | ||
| description = "List of resource resource_keys" | ||
|
||
| value = ibm_resource_key.resource_keys | ||
| 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-endpoints#endpoints_ingestion | ||
| output "ingestion_endpoint_private" { | ||
| value = "ingest.private.${var.region}.monitoring.cloud.ibm.com" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,16 +31,34 @@ variable "plan" { | |
| } | ||
| } | ||
|
|
||
| variable "manager_key_name" { | ||
| type = string | ||
| description = "The name to give the IBM Cloud Monitoring manager key." | ||
| default = "SysdigManagerKey" | ||
| } | ||
|
|
||
| variable "manager_key_tags" { | ||
| type = list(string) | ||
| description = "Tags associated with the IBM Cloud Monitoring manager key." | ||
| default = [] | ||
| # 'name' is the terraform static reference to the object in the list | ||
| # 'key_name' is the IBM Cloud resource key name | ||
| # name MUST not be dynamic, so that it is known at plan time | ||
| # if key_name is not specified, name will be used for the key_name | ||
| # key_name can be a dynamic reference created during apply | ||
| variable "resource_keys" { | ||
| description = "The definition of the resource keys to generate. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_key)." | ||
|
||
| type = list(object({ | ||
| name = string | ||
| key_name = optional(string, null) | ||
ocofaigh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| generate_hmac_credentials = optional(bool, false) # pragma: allowlist secret | ||
| role = optional(string, "Manager") | ||
| service_id_crn = optional(string, null) | ||
| })) | ||
| default = [ | ||
| { | ||
| name = "SysdigManagerKey" | ||
|
||
| } | ||
| ] | ||
| validation { | ||
| # From: https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_key | ||
| # Service roles (for Cloud Monitoring) https://cloud.ibm.com/iam/roles | ||
| # Reader, Writer, Manager, Supertenant Metrics Publisher, NONE | ||
| condition = alltrue([ | ||
| for key in var.resource_keys : contains(["Writer", "Reader", "Manager", "Supertenant Metrics Publisher", "NONE"], key.role) | ||
| ]) | ||
| error_message = "resource_keys role must be one of 'Writer', 'Reader', 'Manager', 'Supertenant Metrics Publisher', 'NONE', reference https://cloud.ibm.com/iam/roles and `Cloud Monitoring`" | ||
| } | ||
| } | ||
|
|
||
| variable "resource_tags" { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.