Skip to content

Chore: Refactor Authen#7

Merged
guyzsarun merged 6 commits intomasterfrom
chore/refactor-authen
Jun 21, 2025
Merged

Chore: Refactor Authen#7
guyzsarun merged 6 commits intomasterfrom
chore/refactor-authen

Conversation

@guyzsarun
Copy link
Copy Markdown
Member

No description provided.

@guyzsarun guyzsarun requested a review from Copilot June 21, 2025 06:42
@guyzsarun guyzsarun self-assigned this Jun 21, 2025
@guyzsarun guyzsarun added the enhancement New feature or request label Jun 21, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the authentication configuration and policy management by removing the legacy policy module and consolidating policy definitions and user credentials within the authentication module. Key changes include the removal of the policy module, the introduction of dynamic user configuration via a JSON file in the userpass authentication configuration, and a new vault_policy resource that leverages a fileset for policy files.

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
policy/main.tf Removal of legacy policy resource to support refactored design
main.tf Removal of the policy module and focus on the authentication module
authentication/userpass.tf Dynamic user configuration via JSON and consolidated endpoint setup
authentication/templates/users.json.example Addition of a sample JSON file for user configuration
authentication/templates/policy/admin_policy.hcl Extension of policy content with updated certs capability
authentication/templates/default_template.tftpl Update to use dynamic password in the template
authentication/policy.tf New resource that dynamically loads policy files from a directory
Comments suppressed due to low confidence (1)

authentication/policy.tf:2

  • The use of split on a dot to derive the policy name may be brittle if the file name does not contain a dot; consider a more robust naming strategy or add validation for the file naming convention.
  name     = split(".", each.value)[0]


resource "vault_generic_endpoint" "devops_user" {
resource "vault_generic_endpoint" "users" {
for_each = { for user in local.users : user.username => user }
Copy link

Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

Ensure that the usernames in the users JSON are unique to prevent key collisions in the for_each mapping.

Suggested change
for_each = { for user in local.users : user.username => user }
for_each = local.unique_usernames

Copilot uses AI. Check for mistakes.
@guyzsarun guyzsarun merged commit 35155d5 into master Jun 21, 2025
2 checks passed
@guyzsarun guyzsarun deleted the chore/refactor-authen branch June 21, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants