-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Allow azurerm_private_endpoint without request-message #23763
Comments
@cmergenthaler Thanks for raising this issue. I've give it a try and I think the limitation is from the Azure REST API we are using here.
I shall communicate with Azure CLI team and comment on this thread later. |
Hi @cmergenthaler , I did some further digging about this issue. Since I create a private endpoint using following CLI command.
And I successfully import it by
with adding following template to .tf file
Running
Full .tf config file I use provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "yunliu" {
name = "yunliu-resources"
location = "West Europe"
}
resource "azurerm_virtual_network" "yunliu" {
name = "yunliu-network"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.yunliu.location
resource_group_name = azurerm_resource_group.yunliu.name
}
resource "azurerm_subnet" "yunliu_service" {
name = "yunliu-service"
resource_group_name = azurerm_resource_group.yunliu.name
virtual_network_name = azurerm_virtual_network.yunliu.name
address_prefixes = ["10.0.1.0/24"]
enforce_private_link_service_network_policies = true
}
resource "azurerm_subnet" "yunliu_endpoint" {
name = "yunliu-endpoint"
resource_group_name = azurerm_resource_group.yunliu.name
virtual_network_name = azurerm_virtual_network.yunliu.name
address_prefixes = ["10.0.2.0/24"]
enforce_private_link_endpoint_network_policies = true
}
resource "azurerm_public_ip" "yunliu" {
name = "yunliu-pip"
sku = "Standard"
location = azurerm_resource_group.yunliu.location
resource_group_name = azurerm_resource_group.yunliu.name
allocation_method = "Static"
}
resource "azurerm_lb" "yunliu" {
name = "yunliu-lb"
sku = "Standard"
location = azurerm_resource_group.yunliu.location
resource_group_name = azurerm_resource_group.yunliu.name
frontend_ip_configuration {
name = azurerm_public_ip.yunliu.name
public_ip_address_id = azurerm_public_ip.yunliu.id
}
}
resource "azurerm_private_link_service" "yunliu" {
name = "yunliu-privatelink"
location = azurerm_resource_group.yunliu.location
resource_group_name = azurerm_resource_group.yunliu.name
nat_ip_configuration {
name = azurerm_public_ip.yunliu.name
primary = true
subnet_id = azurerm_subnet.yunliu_service.id
}
load_balancer_frontend_ip_configuration_ids = [
azurerm_lb.yunliu.frontend_ip_configuration.0.id,
]
}
resource "azurerm_private_endpoint" "yunliu" {
name = "yunliu-endpoint"
location = azurerm_resource_group.yunliu.location
resource_group_name = azurerm_resource_group.yunliu.name
subnet_id = azurerm_subnet.yunliu_service.id
private_service_connection {
name = "yunliu-privateserviceconnection"
private_connection_resource_id = azurerm_private_link_service.yunliu.id
is_manual_connection = true
}
} |
Hey @liuwuliuyun, |
Hi @cmergenthaler, in general, if you would like to manage your infra using Terraform, it is not recommended to change managed infra using other tools. |
As of 2024-06-12 (v3.107.0) this issue still happens; the issue arises in my case for manual private endpoints that I lack permission to approve and where I can't even see the resource group that they ultimately link to, which not an atypical scenario. In the Azure portal, I find I must create such endpoints by resource ID. I can't specify the resource group and navigate in. |
Is there an existing issue for this?
Community Note
Description
The current azurerm provider implementation forbids creating a private endpoint without a
request_message
specified when settingis_manual_connection
to true . The fact that this is actually possible using the azure cli makes it hard to import an already existing resource as the provider does not allow applying the pe-resource again:private_service_connection:private-link is invalid, the "request_message" attribute must not be empty
New or Affected Resource(s)/Data Source(s)
azurerm_private_endpoint
Potential Terraform Configuration
References
No response
The text was updated successfully, but these errors were encountered: