Skip to content

Feature/update private endpoint #3

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

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

Conversation

payasam-raghuramakrishna-nttd

No description provided.

@payasam-raghuramakrishna-nttd payasam-raghuramakrishna-nttd requested a review from a team as a code owner August 14, 2025 18:27
Copilot

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: payasam-raghuramakrishna-nttd <340229@nttdata.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: payasam-raghuramakrishna-nttd <340229@nttdata.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: payasam-raghuramakrishna-nttd <340229@nttdata.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: payasam-raghuramakrishna-nttd <340229@nttdata.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: payasam-raghuramakrishna-nttd <340229@nttdata.com>
Copy link

@Copilot 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 adds private endpoint functionality to a PostgreSQL module, allowing the service to be accessed through private connectivity instead of public endpoints.

  • Introduces new variables for configuring private endpoint settings including subnet ID, DNS zones, and connection parameters
  • Adds a new private endpoint module instance that conditionally creates when public network access is disabled
  • Creates a locals.tf file to manage resource naming and tagging for private endpoint resources

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 7 comments.

File Description
variables.tf Adds variables for private endpoint configuration including subnet, DNS zones, and connection settings
main.tf Implements private endpoint module instantiation with conditional creation logic
locals.tf Defines local values for private endpoint resource naming and tagging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The endpoint name is hardcoded. This should be generated dynamically or made configurable to avoid conflicts when the module is used multiple times or in different environments.

Suggested change
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
endpoint_name = var.endpoint_name
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "${local.endpoint_name}-psc"
default_tags = {
"provisioner" = "terraform"
}

Copilot uses AI. Check for mistakes.

"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

This line is duplicated and will cause a Terraform configuration error. The same local value 'private_endpoint_tags' is defined multiple times.

Suggested change
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
endpoint_name = var.endpoint_name
default_tags = {
"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "${local.endpoint_name}-psc"

Copilot uses AI. Check for mistakes.

"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

This line redefines 'endpoint_name' but references 'var.endpoint_name' which doesn't exist in the variables.tf file. This will cause a Terraform validation error.

Suggested change
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
default_tags = {
"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "${local.endpoint_name}-psc"

Copilot uses AI. Check for mistakes.

"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The 'default_tags' local value definition is malformed and duplicated, missing proper block structure. This will cause a syntax error.

Suggested change
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
default_tags = {
provisioner = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "${local.endpoint_name}-psc"

Copilot uses AI. Check for mistakes.

"provisioner" = "terraform"
}
private_endpoint_tags = merge({ resource_name = local.endpoint_name }, local.default_tags, var.tags)
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The private service connection name is hardcoded. This should be generated dynamically based on the endpoint name to maintain consistency and avoid conflicts.

Suggested change
private_service_connection_name = "hygtmp-sandbox-004-neu-postgresql-001-psc"
private_service_connection_name = "${local.endpoint_name}-psc"

Copilot uses AI. Check for mistakes.

variable "private_dns_zone_group_name" {
description = "Specifies the Name of the Private DNS Zone Group."
type = string
default = "vault"
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The default value 'vault' is incorrect for a PostgreSQL private endpoint. It should be 'postgresqlServer' according to Azure documentation for PostgreSQL subresources.

Suggested change
default = "vault"
default = "postgresqlServer"

Copilot uses AI. Check for mistakes.

https://docs.microsoft.com/azure/private-link/private-endpoint-overview#private-link-resource
EOT
type = list(string)
default = ["vault"]
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The default subresource name 'vault' is incorrect for PostgreSQL. It should be 'postgresqlServer' for Azure Database for PostgreSQL.

Suggested change
default = ["vault"]
default = ["postgresqlServer"]

Copilot uses AI. Check for mistakes.

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.

1 participant