terraform-redhat / terraform-provider-rhcs

Terraform provider for Red Hat Cloud Services
Apache License 2.0
45 stars 78 forks source link

ROSA Cluster Creation when more than 1 vpc exists #713

Closed shriyo101 closed 2 months ago

shriyo101 commented 4 months ago

Issue

When there are more than 1 vpc exists in AWS in the same region. ROSA is unable to decide where to deploy and throws below error.

Error

Error: Can't build cluster with module.rosa.rhcs_cluster_rosa_classic.rosa_sts_cluster on rosa/cluster.tf line 17, in resource "rhcs_cluster_rosa_classic" "rosa_sts_cluster": resource "rhcs_cluster_rosa_classic" "rosa_sts_cluster" { Can't create cluster with name 'test-rosa': status is 400, identifier is '400', code is 'CLUSTERS-MGMT-400' and operation identifier is 'a7781385-3762-4d01-8ea5-d3ccd35286ac': PrivateLink is only supported on existing VPCs

Expected feature:

Able to provide vpc id in the resource so we can point to the correct vpc to deploy the cluster.

gdbranco commented 3 months ago

@shriyo101 You may supply the subnets from a specific VPC via the subnet_ids attribute

shriyo101 commented 3 months ago

Even when subnets are specified, this is an issue with Terraform.

aws_subnet_ids = var.multi_az ? data.aws_subnets.app_subnet.ids : data.aws_subnets.app_subnet_singleaz.ids

radtriste commented 3 months ago

@shriyo101 Would you be able to share a reproducer ?

How do you get the aws_subnets Data Source ? From one VPC or all the AWS subnets ?

Also the error message PrivateLink is only supported on existing VPCs does not seem to correspond to the problem you mention here ...

shriyo101 commented 3 months ago

Am fetching the subnets from the data source for the Subnets created. But when there are two VPCs and with same subnet name for example. since my filter is based on the filter name, its creating an issue. But VPC names & CIDRs are different. Hence, I thought having a VPC ID to refer to would be useful in this case.

as a work around, I modified the subnet names of the 2nd vpc and that resolved the issues.

radtriste commented 3 months ago

Thank you for the clarification. Btw, having 2 subnet ids with the same name on one account seems a bit dangerous, even if different VPC ids, because of conflicts (like you have on RHCS provider) If it is fixed on your side, could you please close this issue ?