Skip to content
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

[Feature] - Get the VPC that a VKE cluster creates #455

Open
jeffdeville opened this issue Jan 5, 2024 · 3 comments
Open

[Feature] - Get the VPC that a VKE cluster creates #455

jeffdeville opened this issue Jan 5, 2024 · 3 comments

Comments

@jeffdeville
Copy link

Is your feature request related to a problem? Please describe.

I would like to attach a managed db to my k8s cluster. But to do that, I need to know the VPC-ID created to house it. As it stands, I'll have to create the cluster, grab the VPCID manually from the dashboard, and build it in a separate step.

Describe the solution you'd like
Ideally, It would be possible to either specify a VPC_ID into which the VKE cluster would be installed, or obtain the VPC_ID for the cluster as an output. Both of course would provide maximum flexibility, but either would meet my needs.

Describe alternatives you've considered
👆

@optik-aper
Copy link
Member

optik-aper commented Jan 30, 2024

@jeffdeville Thanks for the request here, but since this functionality isn't supported by the API, we can't build it in to the provider. If you wanted to submit a ticket to the Vultr team to add that support it will get updated here once complete.

@PaulSonOfLars
Copy link

Alternatively, it might be a good solution to be able to pass in your own VPC ID (or VPC2) at kubernetes cluster creation. This would avoid the "magic" of having a new VPC being created in the background, which might be unexpected.

Even better would be the ability to provide custom IP ranges for the nodes, cluster, and service CIDRs. And maybe even to use non-RFC 1918 addresses for pods and services, such that the cluster resources don't overlap the VPC (Similar to what google suggest for GKE)

@tempusfrangit
Copy link

@jeffdeville The solution I came up with (which works) is:

data "vultr_vpc" "k8s_vpc" {
  filter {
    name   = "description"
    values = ["VKE-Network-${var.k8s_cluster_id}"]
  }
}

resource "vultr_database" "redis" {
  region                  = var.region
  label                   = var.label
  plan                    = var.plan
  database_engine         = "redis"
  database_engine_version = 7
  vpc_id                  = data.vultr_vpc.k8s_vpc.id
}

The VPC ID can be referenced if you filter based upon the description, which is (as of the time of this writing) a known quantity. I did create the VKE Cluster with terraform, which might impact some behaviors.

I agree making this easier would be preferable, but there are some work-arounds (you could also just edit the VPC to a known/fixed value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants