Hello All,
We are using the AWS datasync service and for the creation of datasync agent I am using the data block :-
data “aws_vpc_endpoint” “datasync_vpc_endpoint” {
service_name = “com.amazonaws.eu-west-1.datasync”
vpc_id = var.vpc_id
}
data “aws_network_interface” “datasync_private_link_endpoint_ip” {
id = tolist(data.aws_vpc_endpoint.datasync_vpc_endpoint.network_interface_ids)[0]
}
In, resource “aws_datasync_agent”, for private_link_endpoint , I am using the below block,
private_link_endpoint = data.aws_network_interface.datasync_private_link_endpoint_ip.private_ip
So, when we are running the plan,TF plan shows agent recreation due to forces replacement of private_link_endpoint.
When I check the AWS console, I found that there are three aws_network_interface which will come as in output of the below block :-
data “aws_network_interface” “datasync_private_link_endpoint_ip” {
id = tolist(data.aws_vpc_endpoint.datasync_vpc_endpoint.network_interface_ids)[0]
How can I make the changes so that it would take only 1 private_link_endpoint?
Can anybody please let me know the correct function or changes required?