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

fix: Security group for secondary interface #557

Merged
merged 9 commits into from
Oct 10, 2023
Merged

fix: Security group for secondary interface #557

merged 9 commits into from
Oct 10, 2023

Conversation

jor2
Copy link
Member

@jor2 jor2 commented Oct 8, 2023

Description

Previously when security groups for secondary interface was left empty, it would default to the default security group being attached, but on reapply terraform would find changes in the secondary vsi configs due to the default sg being attached, but the security group parameter empty in terraform.

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.

@jor2 jor2 self-assigned this Oct 8, 2023
@@ -135,7 +135,13 @@ resource "ibm_is_instance" "vsi" {
}
content {
subnet = network_interfaces.value.id
security_groups = flatten([
security_groups = length(flatten([
Copy link
Member Author

Choose a reason for hiding this comment

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

@ocofaigh any ideas how I could avoid code duplication here?

Copy link
Member

Choose a reason for hiding this comment

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

@jor2 Its pretty hard to follow that logic - could you maybe add some code comments to explain what its doing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added some comments. It just checks if security group list is empty don't pass empty list, instead pass default security group. This avoid reapply failures.

Copy link
Member

Choose a reason for hiding this comment

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

ok thanks, comment is good. As for code duplication, have you tried using locals?

@ocofaigh
Copy link
Member

/run pipeline

2 similar comments
@jor2
Copy link
Member Author

jor2 commented Oct 10, 2023

/run pipeline

@ocofaigh
Copy link
Member

/run pipeline

@ocofaigh ocofaigh merged commit ba4d31d into main Oct 10, 2023
2 checks passed
@ocofaigh ocofaigh deleted the sg-fix branch October 10, 2023 16:45
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