Skip to content

Add new_security_group option to create dedicated SG#30

Open
yotaenom wants to merge 1 commit intomainfrom
yotaro-new-feature/create-new-or-modify-existing-sg-option
Open

Add new_security_group option to create dedicated SG#30
yotaenom wants to merge 1 commit intomainfrom
yotaro-new-feature/create-new-or-modify-existing-sg-option

Conversation

@yotaenom
Copy link
Copy Markdown

Adds new_security_group and new_security_group_name variables so users can choose between modifying the default VPC security group or creating a new dedicated one.

@yotaenom yotaenom force-pushed the yotaro-new-feature/create-new-or-modify-existing-sg-option branch from e07ce82 to 6589ee0 Compare April 14, 2026 07:39
@yotaenom yotaenom force-pushed the yotaro-new-feature/create-new-or-modify-existing-sg-option branch from 790e2c2 to 634bd49 Compare April 14, 2026 07:58
@yotaenom
Copy link
Copy Markdown
Author

Verified that the new new_security_group option works as expected. Default SG is left untouched and a new dedicated SG is created with the correct inbound/outbound rules. Screenshots attached.
Screenshot 2026-04-15 at 11 16 53
Screenshot 2026-04-15 at 11 18 36
Screenshot 2026-04-15 at 11 19 09

@haleyyyblue
Copy link
Copy Markdown
Collaborator

haleyyyblue commented Apr 27, 2026

Hi @yotaenom I tested this with an existing VPC and encountered the following error:

Attribute security_group_ids requires 1 item minimum, but config has only 0 declared.

In the current implementation, when vpc_id is provided (existing VPC case), the aws_security_group.databricks resource is not created (count = 0). As a result, if security_group_ids is also empty, the value passed to databricks_mws_networks becomes an empty list.

Since the Databricks resource requires at least one security group, the workspace deployment fails during validation.

To align with the requirement, we should ensure that a security group is always available. Specifically:

  • If security_group_ids is provided → use it
  • If security_group_ids is empty → create a new security group and use it (for both new and existing VPC cases)

This would ensure consistent behavior and prevent deployment failures when using an existing VPC.

│ Error: Not enough list items
│ 
│   with databricks_mws_networks.this,
│   on workspace.tf line 38, in resource "databricks_mws_networks" "this":
│   38:   security_group_ids = length(var.security_group_ids) > 0 ? var.security_group_ids : aws_security_group.databricks[*].id
│ 
│ Attribute security_group_ids requires 1 item minimum, but config has only 0 declared.
╵

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