diff --git a/03-k8s-infra/index.ts b/03-k8s-infra/index.ts index c59195f..d2fbd54 100644 --- a/03-k8s-infra/index.ts +++ b/03-k8s-infra/index.ts @@ -23,7 +23,13 @@ const domain = config.requireSecret("domain"); const longhornUiUser = config.requireSecret("longhornUiUser"); const longhornUiPassword = config.requireSecret("longhornUiPassword"); -const k8sProvider = new k8s.Provider("k3s", { kubeconfig }); +// Keep the kubeconfig stored in state. A changed API address would otherwise +// make Pulumi replace the provider and every resource in this stack. +const k8sProvider = new k8s.Provider( + "k3s", + { kubeconfig }, + { ignoreChanges: ["kubeconfig"] }, +); const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({ provider: k8sProvider, ...extras, diff --git a/04-k8s-apps/index.ts b/04-k8s-apps/index.ts index 1440aac..8827752 100644 --- a/04-k8s-apps/index.ts +++ b/04-k8s-apps/index.ts @@ -10,7 +10,13 @@ const bootstrapRef = new pulumi.StackReference( const kubeconfig = bootstrapRef.requireOutput("kubeconfig"); export const domain = config.requireSecret("domain"); -const k8sProvider = new k8s.Provider("k3s", { kubeconfig }); +// Keep the kubeconfig stored in state. A changed API address would otherwise +// make Pulumi replace the provider and every resource in this stack. +const k8sProvider = new k8s.Provider( + "k3s", + { kubeconfig }, + { ignoreChanges: ["kubeconfig"] }, +); const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({ provider: k8sProvider, ...extras, diff --git a/05-monitoring/index.ts b/05-monitoring/index.ts index eb92e90..23c0173 100644 --- a/05-monitoring/index.ts +++ b/05-monitoring/index.ts @@ -18,7 +18,13 @@ const grafanaDbPassword = config.requireSecret("grafanaDbPassword"); const grafanaDbHost = config.requireSecret("grafanaDbHost"); const grafanaDbName = config.require("grafanaDbName"); -const k8sProvider = new k8s.Provider("k3s", { kubeconfig }); +// Keep the kubeconfig stored in state. A changed API address would otherwise +// make Pulumi replace the provider and every resource in this stack. +const k8sProvider = new k8s.Provider( + "k3s", + { kubeconfig }, + { ignoreChanges: ["kubeconfig"] }, +); const monitoringNs = new k8s.core.v1.Namespace( "monitoring",