Skip to content

Dev to qa#97

Merged
fpittelo merged 5 commits intoqafrom
dev
Nov 29, 2025
Merged

Dev to qa#97
fpittelo merged 5 commits intoqafrom
dev

Conversation

@fpittelo
Copy link
Owner

Dev to qa

@fpittelo fpittelo self-assigned this Nov 29, 2025
@fpittelo fpittelo added bug Something isn't working enhancement New feature or request labels Nov 29, 2025
@github-actions
Copy link

🤖 Hi @fpittelo, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@gemini-code-assist
Copy link

Summary of Changes

Hello @fpittelo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the security and access management of the Azure Key Vault within the infrastructure. It introduces mechanisms to dynamically configure Key Vault firewall rules based on the deployment runner's IP and assigns administrative access to a designated user. These changes are crucial for establishing a secure and functional Key Vault setup, likely in preparation for a QA environment.

Highlights

  • Key Vault IP Firewall Configuration: The Key Vault is now configured with IP firewall rules, dynamically retrieving the public IP address of the runner and adding it to the allowed IP ranges. This enhances security by restricting access to the Key Vault.
  • Firewall Rule Propagation Delay: A 60-second delay has been introduced after Key Vault creation to allow firewall rules to propagate effectively before subsequent operations, ensuring proper access for secret management.
  • Key Vault Administrator Role Assignment: A specific Azure AD user (frederic.pitteloud@fpittelo.ch) is now assigned the 'Key Vault Administrator' role, granting them necessary permissions for managing the Key Vault.
  • New Terraform Providers: The http and time Terraform providers have been added to support the new functionality for IP retrieval and time-based delays, respectively.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/deploy-infra.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces changes to enhance the security of the Azure Key Vault by restricting network access and managing permissions. It adds the runner's IP to the Key Vault's firewall rules to allow access during deployment and assigns the 'Key Vault Administrator' role to a specific user.

My review has identified a few areas for improvement:

  • A hardcoded user principal name should be replaced with a variable to improve reusability.
  • The reliance on a single external service for IP detection could be a single point of failure.
  • The use of time_sleep for handling propagation delay is noted as a potentially brittle solution.

Overall, the changes are a good step towards securing the Key Vault, and with the suggested modifications, the implementation will be more robust and maintainable.

Comment on lines +61 to +63
data "azuread_user" "admin_user" {
user_principal_name = "frederic.pitteloud@fpittelo.ch"
}

Choose a reason for hiding this comment

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

high

The user principal name (UPN) is hardcoded. This is not a good practice as it makes the code less reusable and harder to maintain. If another user needs access, or if you deploy this to another environment, you'll need to change the code. This should be a variable.

You should add a new variable in variables.tf, for example:

variable "admin_user_principal_name" {
  description = "The User Principal Name of the admin user to grant Key Vault access."
  type        = string
}

Then, use that variable here.

data "azuread_user" "admin_user" {
  user_principal_name = var.admin_user_principal_name
}

Comment on lines +19 to +21
data "http" "ip" {
url = "https://api.ipify.org"
}

Choose a reason for hiding this comment

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

medium

Relying on a single external service like api.ipify.org to fetch the runner's IP address introduces a single point of failure. If this service is unavailable, your deployment pipeline will fail. Consider using a more robust solution, such as querying multiple services and using the first successful response, or using a service with higher availability guarantees if possible.

Comment on lines +42 to 46
resource "time_sleep" "wait_for_firewall" {
create_duration = "60s"

depends_on = [module.key_vault]
}

Choose a reason for hiding this comment

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

medium

Using time_sleep to handle propagation delays for Azure firewall rules is a common but brittle approach. The 60s duration is a magic number and may not be sufficient in all cases, leading to intermittent failures. Conversely, it might be unnecessarily long, slowing down your pipeline. While there isn't a perfect alternative in Terraform for this specific scenario, be aware of this potential flakiness. If you experience failures, you may need to increase this duration.

@github-actions
Copy link

🤖 I'm sorry @fpittelo, but I was unable to process your request. Please see the logs for more details.

@fpittelo fpittelo merged commit 01cfa46 into qa Nov 29, 2025
4 checks passed
@fpittelo fpittelo deleted the dev branch November 29, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant