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

Migration to use terraform cross-object referencing for input variable and refactor the code #245

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

iamar7
Copy link
Member

@iamar7 iamar7 commented Jan 15, 2025

Description

Resolves: #182

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.

@iamar7 iamar7 self-assigned this Jan 15, 2025
@iamar7
Copy link
Member Author

iamar7 commented Jan 15, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Jan 20, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Jan 20, 2025

/run pipeline

@iamar7 iamar7 marked this pull request as ready for review January 20, 2025 15:22
@iamar7 iamar7 requested a review from Aashiq-J January 20, 2025 15:23
@iamar7
Copy link
Member Author

iamar7 commented Jan 20, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Jan 21, 2025

/run pipeline

@iamar7 iamar7 requested a review from ocofaigh January 21, 2025 14:08
@iamar7 iamar7 changed the title refactor observability instance DA Migration to use terraform cross-object referencing for input variable and refactor the code Jan 27, 2025
@iamar7
Copy link
Member Author

iamar7 commented Jan 29, 2025

/run pipeline

@iamar7
Copy link
Member Author

iamar7 commented Jan 31, 2025

/run pipeline

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.

There seems to be some issues in your validation logic. Can you please check and test them? Can you also review the other variables - I would of expected to see more validation logic, especially since we have some many different combinations and permutations.


validation {
condition = !(var.existing_cos_kms_key_crn != null && !var.skip_cos_kms_auth_policy && var.existing_kms_instance_crn == null)
error_message = "The existing_kms_instance_crn is not provided and is required to configure the COS - KMS authorization policy."
Copy link
Member

Choose a reason for hiding this comment

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

It is not only required to configure the auth policy. Its also required to create a new key if user is not using an existing one

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this validation is working as expected. I pulled it locally and terraform plan passed with all the default values:

  • existing_kms_instance_crn = null
  • existing_cos_kms_key_crn = null
  • skip_cos_kms_auth_policy = false

Also the validation doesn't seem to be taking into consideration the case where user is proving their own buckets. In that case, there is no KMS details needed right?

Copy link
Member Author

Choose a reason for hiding this comment

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

When I was looking at the condition here, I found that it throws error only in one case which is when

  • existing_cos_kms_key_crn is not null & we set skip_cos_kms_key_auth_policy as false,
  • now if a user doesn't provide existing_kms_instance_crn it throws an error which technically is wrong since

we don't need an input for existing_kms_instance_crn when we are providing existing_cos_kms_key_crn.

Further investigating as to why we have done this....

solutions/instances/variables.tf Outdated Show resolved Hide resolved
solutions/instances/variables.tf Outdated Show resolved Hide resolved
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.

Observability DA code getting extremly complex to follow
2 participants