-
Notifications
You must be signed in to change notification settings - Fork 1
Event Notification DA Fully configurable #395
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
base: main
Are you sure you want to change the base?
Conversation
fd9cef1
to
5c55830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left an initial first round of comments to address - there will be more. Also we need to claify if we really should be using cloud_object_storage
and key_management_service
in our input names, as opposed to just cos
and kms
. Discussion started on slack
@@ -0,0 +1,14 @@ | |||
terraform { | |||
required_version = ">= 1.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you update to >= 1.9.0
so we can use the terraform 1.9 cross variable validation feature.
We will need to use it in many input variables in variables.tf. For an idea of how to use it, see my branch (WIP): https://github.com/terraform-ibm-modules/terraform-ibm-scc/blob/DA/solutions/fully-configurable/variables.tf
solutions/fully-configurable/catalogValidationValues.json.template
Outdated
Show resolved
Hide resolved
solutions/fully-configurable/catalogValidationValues.json.template
Outdated
Show resolved
Hide resolved
abeb33c
to
dcf9464
Compare
29995b7
to
8d7f1f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whoffler still a lot of things to address here. Its not consistent at all with the SCC DA. Please review your variable descriptions, variable validation and other logic to ensure consistency. Some other things that stand out:
- security-enforced variation needs to be a striaght wrapper around fully-configurable. See https://github.com/terraform-ibm-modules/terraform-ibm-scc/tree/main/solutions/security-enforced as a reference
- It seems we are supporting creation of cross regional buckets. We are not doing that anywhere else right now, so I think remove it so its less confusing for consumers
} | ||
} | ||
|
||
variable "existing_kms_key_name" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will never need a existing KMS key name?? The user will either pass the key using existing_kms_root_key_crn
, or we will create the key using existing_kms_instance_crn
so I'm confused as to what this is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need 2 existing KMS key inputs - one for the COS bucket, and one for the Event Notifications instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah if a KMS key is provided to the fscloud version it uses it for everything. Adding another KMS key input makes sense.. more configurable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whoffler Also take a look at terraform-ibm-modules/terraform-ibm-secrets-manager#309 - we will need something similar in this PR
was going to do that in a separate PR but will add here instead |
@whoffler A separate Pr is fine if you want - but just remove the |
71ea249
to
b3f69cf
Compare
/run pipeline |
4 similar comments
/run pipeline |
/run pipeline |
/run pipeline |
/run pipeline |
@rajatagarwal-ibm @ocofaigh think I've figured out why that unit test is failing. For COS bucket when we set
The existing standard solution does not pass In Event Notifications we create policy:
Which creates the access policy conflict we are seeing. Removing |
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
SKIP UPGRADE TEST: breaking changes
/run pipeline |
782ce09
to
4898435
Compare
/run pipeline |
/run pipeline |
4 similar comments
/run pipeline |
/run pipeline |
/run pipeline |
/run pipeline |
@@ -1,12 +1,14 @@ | |||
# 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 | |||
version: "v1" | |||
CRA_TARGETS: | |||
- CRA_TARGET: "solutions/standard" # Target directory for CRA scan. If not provided, the CRA Scan will not be run. | |||
- CRA_TARGET: "solutions/fully-configurable" # 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: "fe96bd4d-9b37-40f2-b39f-a62760e326a3" # SCC profile ID (currently set to 'IBM Cloud Framework for Financial Services' '1.7.0' profile). | |||
CRA_ENVIRONMENT_VARIABLES: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should TF_VAR_kms_encryption_enabled: true
be added as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not required as the fully-configurable
does not enforce KMS encryption.
}, | ||
{ | ||
"key": "resource_group_name" | ||
"key": "existing_resource_group_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
picker should be used
{
"key": "existing_resource_group_name",
"required": true,
"custom_config": {
"type": "resource_group",
"grouping": "deployment",
"original_grouping": "deployment",
"config_constraints": {
"identifier": "rg_name"
}
}
},
@@ -169,10 +357,27 @@ | |||
] | |||
}, | |||
{ | |||
"key": "en_key_ring_name" | |||
"key": "provider_visibility", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be hidden.
"hidden": true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure yet if we are going to hide this - it will be discussed in todays deep dive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do a full re-review of the code for consistency between the 2 variations, and between other DAs (for example SCC DA)
variable "kms_encryption_enabled" { | ||
type = bool | ||
description = "Set to true to enable KMS encryption on Event Notifications instance and Cloud Object Storage bucket. When set to true 'kms_endpoint_url' and one of 'existing_kms_instance_crn' or 'existing_kms_root_key_crn' must be set." | ||
default = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not default to true in fully configurable because the user is then required to pass either a KMS instance CRN, or a KMS key. We want fully configurable to be like a one click deploy. This is consistent with all our other fully configurable DAs
variable "enable_collecting_failed_events" { | ||
type = bool | ||
description = "Set to true to enable Cloud Object Storage integration." | ||
default = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I don't think this should be true by default in fully configurable, since it will have a dependency on COS
type = bool | ||
description = "Whether to add a randomly generated 4-character suffix to the newly provisioned Object Storage bucket name. Used only if not using an existing bucket. Set to `false` if you want full control over bucket naming by using the `cos_bucket_name` variable." | ||
description = "Set to true to enable key management service encryption on Cloud Object Storage bucket." | ||
default = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, this should not default to true for fully configurable
variable "cos_bucket_region" { | ||
type = string | ||
description = "The COS bucket region. If `cos_bucket_region` is set to null, then `region` will be used." | ||
default = "us-south" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we take same approach as SCC DA where default value will be null
(meaning it will be provisioned in same region as the EN instance). See https://github.com/terraform-ibm-modules/terraform-ibm-scc/blob/6fbd4973c72855920c157848ab9eee0b7cce5439/solutions/fully-configurable/variables.tf#L301-L305
When `existing_en_instance_crn` is not passed, this solution configures the following infrastructure: | ||
|
||
- optionally a KMS key ring and key for IBM Event Notifications encryption | ||
- optionally a KMS key ring and key for IBM Cloud Object Storage encryption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KMS is mandated in security enforced. So I would not use the word "optionally" here. The options are the DA either creates the key and key ring, or the DA takes in existing key
variable "existing_cos_instance_crn" { | ||
type = string | ||
nullable = false | ||
description = "The CRN of an IBM Cloud Object Storage instance." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description should say what its used for
|
||
variable "kms_endpoint_url" { | ||
type = string | ||
description = "The KMS endpoint URL to use when you configure KMS encryption. The Hyper Protect Crypto Services endpoint URL format is `https://api.private.<REGION>.hs-crypto.cloud.ibm.com:<port>` and the Key Protect endpoint URL format is `https://<REGION>.kms.cloud.ibm.com`. Not required if passing an existing instance using the `existing_en_instance_crn` input." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existing_en_instance_crn
is not a valid input. Do we have variable validation checking the condition mentioned?
type = string | ||
description = "The key CRN of a root key, existing in the KMS instance passed in the `existing_kms_instance_crn` input, which will be used to encrypt the data. If no value passed, a new key will be created in the instance provided in the `existing_kms_instance_crn` input." | ||
default = null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You seem to be missing variable validation for the KMS inputs. For example: https://github.com/terraform-ibm-modules/terraform-ibm-scc/blob/6fbd4973c72855920c157848ab9eee0b7cce5439/solutions/security-enforced/variables.tf#L159-L181
variable "event_notifications_name" { | ||
type = string | ||
description = "The name of the Event Notifications instance that is created by this solution. If a `prefix` input variable is specified, it is added to this name in the `<prefix>-value` format." | ||
default = "base-event-notifications" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not match the value in fully configurable. Can you please do a full review to ensure consistency
|
||
variable "prefix" { | ||
type = string | ||
description = "(Optional) Prefix to add to all resources created by this solution. To not use any prefix value, you can set this value to `null` or an empty string." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this description different to the fully configurable one? Please ensure consistency
@@ -0,0 +1,82 @@ | |||
# Event Notifications solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security-enforced
should be added to the title
@@ -0,0 +1,109 @@ | |||
# Cloud automation for Event Notifications (Fully configurable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be in consistent with other DAs, let's follow the structure by defining Prerequisites
as well . Same for security-enforced DA
Description
for issue - https://github.ibm.com/GoldenEye/issues/issues/12573
Event Notification DA Fully configurable flavor
Release required?
x.x.X
)x.X.x
)X.x.x
)Release notes content
Run the pipeline
If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.
Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:
Checklist for reviewers
For mergers