The problem: You can’t create a Kubernetes cluster and then add resources to it in the same apply. Providers are configured at the root before resources exist, so you can’t use dynamic outputs (like a cluster endpoint) as provider config.

The workarounds all suck:

Two separate Terraform stacks (pain passing values across the boundary)

null_resource with local-exec kubectl hacks (no state tracking, no drift detection)

Manual two-phase applies (wait for cluster, then apply workloads)

After years of fighting this, I realized what we needed was inline per-resource connections that sidestep Terraform’s provider model entirely.

So I built a Terraform provider (k8sconnect) that does exactly that:

# Create cluster
resource "aws_eks_cluster" "main" {
...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help