Skip to content
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

feat: initial commit for DA #915

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

feat: initial commit for DA #915

wants to merge 11 commits into from

Conversation

maheshwarishikha
Copy link
Member

@maheshwarishikha maheshwarishikha commented Feb 14, 2025

Description

Simple VPC DA

Issue: https://github.ibm.com/GoldenEye/issues/issues/12217

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (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:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@maheshwarishikha maheshwarishikha marked this pull request as draft February 14, 2025 18:53
##############################################################################

variable "network_acls" {
description = "The list of ACLs to create. Provide at least one rule for each ACL."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a supporting markdown doc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add, once code is completed.

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is still under development, but I left a few comments to make sure we address them. We should talk about the variation name. simple is probably not what we will go with

@maheshwarishikha
Copy link
Member Author

I know it is still under development, but I left a few comments to make sure we address them. We should talk about the variation name. simple is probably not what we will go with

I created this draft PR with the intent of early review. Thanks for this. Yes, name will be changed once we decide.

@maheshwarishikha
Copy link
Member Author

Currently,

  • this simple variation does not support existing_cos_kms_key_crn scenario.
  • it does not support the existing COS buckets.
    More secured version can have both of these. Let me know your thoughts.

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need to make use of cross variable validation in the variables.tf file. For example, if person sets kms_encryption_enabled_bucket or enable_vpc_flow_logs then other inputs become required.

Also question - should we support creating VPEs? Or are we planning to have a standalone VPE DA? (cc @vburckhardt )

@ocofaigh
Copy link
Member

ocofaigh commented Feb 27, 2025

@maheshwarishikha FYI these are the variation names we will go with:

  1. label: Fully configurable, name: fully-configurable
  2. label: Security-enforced, name: security-enforced

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maheshwarishikha maheshwarishikha changed the title feat: initial commit feat: initial commit for DA Mar 3, 2025
}

variable "kms_encryption_enabled_bucket" {
description = "Set to true if Cloud Object Storage bucket needs to be KMS encryption enabled."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set to true to encrypt the Cloud Object Storage Flow Logs bucket with a KMS key. If set to true, a value must be passed for existing_kms_key_crn (to use that key) or existing_kms_instance_crn (to create a new key). Value cannot be set to true if enable_vpc_flow_logs is set to false.

# KMS
###############################################################################################################

variable "existing_kms_key_crn" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually suggest you name this existing_flow_logs_bucket_kms_key_crn so it is clear what the key is used for. Maybe some day there be something else in this DA that will need its own KMS key, so better to future proof it

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 = "public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set this to private

variable "prefix" {
type = string
nullable = true
description = "Prefix to add to all the resources created by this solution. To not use any prefix value, you can set this value to `null` or an empty string."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type = string
}

variable "resource_tags" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different vpc resource support tags (e.g. a VPC can have different tags to subnets). I think this needs to be broken down. VPC tags variable should be explicitly named vpc_resource_tags


variable "subnets" {
description = "List of subnets for the vpc. For each item in each array, a subnet will be created. Items can be either CIDR blocks or total ipv4 addressess. Public gateways will be enabled only in zones where a gateway has been created"
type = object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add a subnet_resource_tags attribute so subnets can individually tagged

variable "clean_default_sg_acl" {
description = "Remove all rules from the default VPC security group and VPC ACL (less permissive)"
type = bool
default = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, should this default to secure by design (aka true) ?

}

variable "existing_cos_instance_crn" {
description = "CRN of the existing COS instance. It is required to create the bucket used for flow logs."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should mention it is only required if enable_vpc_flow_logs is set to true in the description

}
}

variable "cos_bucket_name" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps call it flow_logs_new_bucket_name so its clear that its a new bucket that will be created for flow logs

variable "cos_bucket_name" {
description = "Name of the Cloud Object Storage bucket to be created collect VPC flow logs."
type = string
default = "cos-bucket"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename this to flow-logs-bucket

variable "management_endpoint_type_for_bucket" {
description = "The type of endpoint for the IBM Terraform provider to use to manage Cloud Object Storage buckets (`public`, `private`, or `direct`). If you are using a private endpoint, make sure that you enable virtual routing and forwarding (VRF) in your account, and that the Terraform runtime can access the IBM Cloud Private network."
type = string
default = "public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default this to direct

variable "kms_endpoint_type" {
type = string
description = "The type of endpoint to use for communicating with the Key Protect instance. Possible values: `public`, `private`. Applies only if `existing_cos_kms_key_crn` is not specified."
default = "public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private

}
}

variable "kms_key_ring_name" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be more explicit? flow_logs_bucket_kms_key_ring_name ?


variable "kms_key_ring_name" {
type = string
default = "cos-key-ring"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flow-logs-bucket-key-ring

description = "The name of the key ring to create for the Cloud Object Storage bucket key. If an existing key is used, this variable is not required. If the prefix input variable is passed, the name of the key ring is prefixed to the value in the `<prefix>-value` format."
}

variable "kms_key_name" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be more explicit? flow_logs_bucket_kms_key_name ?


variable "kms_key_name" {
type = string
default = "cos-key"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flow-logs-bucket-key

storage_class = var.cos_bucket_class
resource_instance_id = var.existing_cos_instance_crn
region_location = var.region
force_delete = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really default this to force delete? I suspect the safer option would be to not force delete by default? Especially since the bucket will contain flow logs, which would be needed for audit purposes. Perhaos it needs to be exposed, defaulted to false but set to true in all our tests (otherwise the destroy would fail)

@ocofaigh
Copy link
Member

ocofaigh commented Mar 9, 2025

Should we be supporting existing VPC @vburckhardt ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants