rubrikinc / terraform-provider-polaris

Terraform provider for the Polaris platform
MIT License
2 stars 9 forks source link

The provided customer-managed cluster 'Rubrik-Exocompute-Customer-Managed' is not in the expected 'ACTIVE' state #125

Open DamaniN opened 4 months ago

DamaniN commented 4 months ago

Expected Behavior

When attaching a customer managed Exocompute cluster to RSC, the command should complete successfully.

Current Behavior

When running this code:

data "aws_region" "current" {}

# Temporary fix until this error is resolved:
# │ Error: failed to lookup exocompute config: failed to get vpcs: failed to 
# | request allVpcsByRegionFromAws: graphql response body is an error (status code 200): Objects 
# | are not authorized (code: 403, traceId: x9TBQt14uQpe5tSLU2BDEQ==) | error is

resource "time_sleep" "wait_for_polaris_sync" {
  create_duration = "60s"
}

# Create an Exocompute configuration using the specified VPC and subnets.
resource "polaris_aws_exocompute" "customer_managed" {
  account_id              = var.rsc_aws_cnp_account_id
  region                  = data.aws_region.current.name

  depends_on = [time_sleep.wait_for_polaris_sync]
}

resource "polaris_aws_exocompute_cluster_attachment" "cluster" {
  exocompute_id = polaris_aws_exocompute.customer_managed.id
  cluster_name  = var.aws_eks_cluster_name
}

The following error occurs:

│ Error: failed to connect exocompute cluster: failed to request connectAwsExocomputeCluster: graphql response body is an error (status code 200): INVALID_ARGUMENT: Error RBK30200017: The customer-managed cluster 'Rubrik-Exocompute-Customer-Managed' is not ready for Exocompute. Possible cause: The provided customer-managed cluster 'Rubrik-Exocompute-Customer-Managed' is not in the expected 'ACTIVE' state. Possible remedy: Ensure the provided cluster is in the 'ACTIVE' state for Exocompute. (code: 400, traceId: 8xmlXkATpZcjVEfo3JXd4A==)
│
│   with module.polaris-aws-cloud-native-customer-managed-exocompute-us-east-1.polaris_aws_exocompute_cluster_attachment.cluster,
│   on ../../terraform-aws-polaris-cloud-native-customer-managed-exocompute/main.tf line 20, in resource "polaris_aws_exocompute_cluster_attachment" "cluster":
│   20: resource "polaris_aws_exocompute_cluster_attachment" "cluster" {
│

Rerunning the plan some time later resolves the issue.

I suspect that after running polaris_aws_exocompute that some time is needed for the cluster to become active. TF should not return until the cluster is active. Alternatively, polaris_aws_exocompute_cluster_attachment should wait longer for the cluster to become active.