terraform-provider-astra icon indicating copy to clipboard operation
terraform-provider-astra copied to clipboard

TERRA-95 ⁃ Terraform astra_private_link and astra_private_link_endpoint failing

Open atrilok opened this issue 2 years ago • 3 comments

Terraform Version

Terraform v1.2.8

Affected Resource(s)

  • astra_private_link
  • astra_private_link_endpoint

Terraform Configuration Files

Link to terraform scripts as a zipped file: 
https://drive.google.com/drive/folders/1VNbs8DCGkP6-3HbzmZw4wOa8rGDtdswF?usp=sharing

Expected Behavior

The resource 'astra_private_link' should create a private link successfully on the console. In addition, the link 'astra_private_link_endpoint' should create the endpoint successfully on Astra.

The corresponding private link endpoint on AWS was created successfully: Screen Shot 2023-01-04 at 1 42 30 PM

Actual Behavior

The resource 'astra_private_link_endpoint' is throwing the following error:

│ Error: creating EC2 VPC Endpoint (com.amazonaws.vpce.us-east-1.vpce-svc-0228650ceacbd2889): InvalidServiceName: The Vpc Endpoint Service 'com.amazonaws.vpce.us-east-1.vpce-svc-0228650ceacbd2889' does not exist
│ 	status code: 400, request id: 79704ad5-52b8-4b33-bcc6-9879b68b5c6d
│ 
│   with aws_vpc_endpoint.online_shopping_vpc_endpoint,
│   on main.tf line 63, in resource "aws_vpc_endpoint" "online_shopping_vpc_endpoint":
│   63: resource "aws_vpc_endpoint" "online_shopping_vpc_endpoint" {

Steps to Reproduce

  1. Create a VPC in AWS using UI
  2. Create an endpoint in AWS using UI
  3. Run the terraform resources related to 'astra_private_link' and 'astra_private_link_endpoint'
  4. Notice the error described above on the tf side despite having a VPC and an endpoint in AWS

Important Factoids

This is the code I am running for your reference:

#Creation of a private link on Astra DB
resource "astra_private_link" "online_shopping_privatelink" {
  allowed_principals = ["arn:aws:iam::111708290731:role/aditya.trilok"]
  database_id        = "016114a8-431f-47db-95e1-14c0e2180c52"
  datacenter_id      = "016114a8-431f-47db-95e1-14c0e2180c52-1"
}

#Create a VPC endpoint on AWS
resource "aws_vpc_endpoint" "online_shopping_vpc_endpoint" {
  vpc_id             = "vpc-0ed0543943cdaa4a4"
  service_name       = astra_private_link.online_shopping_privatelink.service_name
  vpc_endpoint_type  = "Interface"
  subnet_ids         = ["subnet-0538fcea9f74c9bc9","subnet-0cd081c0072226c9b"]
  security_group_ids = ["sg-09e3a526e286ce753"]
}

┆Issue is synchronized with this Jira Task by Unito ┆Issue Number: TERRA-95 ┆Priority: Major

atrilok avatar Jan 04 '23 18:01 atrilok

I'm seeing similar issues with GCP:

resource "astra_private_link" "main" {
  allowed_principals = [var.project_id]
  database_id        = astra_database.main.id
  datacenter_id      = local.datacenter_id
}
Error: json: cannot unmarshal string into Go value of type astra.Errors
│
│   with module.infrastructure.module.astra-db.astra_private_link.main,
│   on ../../../../modules/astra-db/network.tf line 1, in resource "astra_private_link" "main":
│    1: resource "astra_private_link" "main" {

oscar-b avatar Jan 05 '23 16:01 oscar-b

@oscar-b although they are both related to private link these look like different issues to me, may be worth opening your own issue and providing more details there.

phact avatar Jan 06 '23 07:01 phact

@phact https://github.com/datastax/terraform-provider-astra/issues/198

oscar-b avatar Jan 06 '23 09:01 oscar-b