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

Defer initialisation of kubectl provider #145

Closed
ddelange opened this issue Dec 21, 2021 · 2 comments
Closed

Defer initialisation of kubectl provider #145

ddelange opened this issue Dec 21, 2021 · 2 comments

Comments

@ddelange
Copy link

ddelange commented Dec 21, 2021

Scenario

Provision a kubernetes cluster - and apply some default configuration to it using kubectl - in the same terraform module

Example use-case: eddycharly/terraform-provider-kops#438 (comment)

Problem

Supplying dynamic (computed during apply) values to a provider is currently not supported (ref hashicorp/terraform#27934), AKA "provision a thing, then provision another thing inside the thing you just provisioned" ref hashicorp/terraform#2430 (comment)

Workaround

Expected behaviour

kubectl provider only initialises once the first kubectl_manifest is applied (at this point in time, the kubernetes cluster is running and the kubeconfig file now exists/is updated on disk)

Actual behaviour

kubectl_manifest resources will fail to apply on the first run:

failed to create kubernetes rest client for update of resource: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused

Related issues

@stevehipwell
Copy link

@ddelange you need to use the exec plugin authentication for Kubernetes or other kubernetes based providers such as helm or kubectl, AFAIK this is the only really reliable way to authenticate against Kubernetes.

@ddelange
Copy link
Author

Thanks for the info, will close with that 💥

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

No branches or pull requests

2 participants