calm-vr-6039
04/07/2023, 2:26 AMsteep-toddler-94095
04/07/2023, 2:43 AMimport { ProviderArgs } from '@pulumi/kubernetes'
import { Unwrap } from '@pulumi/pulumi'
const eksProvider = coreInfrastructureReference.requireOutput("eksProvider") as Unwrap<ProviderArgs>
calm-vr-6039
04/07/2023, 2:44 AMsteep-toddler-94095
04/07/2023, 2:45 AMcalm-vr-6039
04/07/2023, 2:48 AMsteep-toddler-94095
04/07/2023, 2:53 AMcalm-vr-6039
04/07/2023, 2:54 AMsteep-toddler-94095
04/07/2023, 2:54 AMcalm-vr-6039
04/07/2023, 2:55 AMimport * as pulumi from "@pulumi/pulumi";
import { ProviderArgs } from '@pulumi/kubernetes'
import * as k8s from '@pulumi/kubernetes';
const config = new pulumi.Config();
// Obtain the declared configs for the dev stack in api-gateway
const referrerOrganizationName = config.require("core-org");
const referrerProjectName = config.require("core-project-name");
const referrerStackName = config.require("core-stack");
// Create a stack reference to obtain resources from the referrer stack
const coreInfrastructureReference = new pulumi.StackReference(`${referrerOrganizationName}/${referrerProjectName}/${referrerStackName}`);
// Export any required outputs from the core-infrastructure
export const clusterProvider = coreInfrastructureReference.requireOutput("clusterProvider") as pulumi.Unwrap<ProviderArgs>
// Create secrets
export const secrets = new k8s.core.v1.Secret(
'hasura-secrets',
{
metadata: {
namespace: namespaceName,
},
data: {
hasuraGraphqlJWTSecret: HASURA_GRAPHQL_JWT_SECRET.apply(toBase64),
backendJWTPrivateKey: AuthJwtPrivateKey.privateKeyPem.apply(toBase64),
backendJWTPublicKey: AuthJwtPrivateKey.publicKeyPem.apply(toBase64),
dbConnectionUrl: connectionUrl.apply(toBase64),
},
},
{ provider: clusterProvider }
);
steep-toddler-94095
04/07/2023, 2:56 AM{ provider: clusterProvider }
can you try
{ provider: new Provider('whateveryouwanttonamethis', clusterProvider) }
new Provider
object with the same params as the outputted one. Since the output is a json serialized Provider, it's not an actual Provider objectcalm-vr-6039
04/07/2023, 3:00 AMsteep-toddler-94095
04/07/2023, 3:02 AMcalm-vr-6039
04/07/2023, 3:04 AMsteep-toddler-94095
04/07/2023, 3:09 AMcalm-vr-6039
04/07/2023, 3:11 AMimport * as eks from '@pulumi/eks';
import { Output } from '@pulumi/pulumi';
import * as config from '@project/infrastructure-config';
import { vpc } from './vpc';
const cluster = new eks.Cluster(config.CLUSTER_NAME, {
name: config.CLUSTER_NAME,
vpcId: vpc.id,
publicSubnetIds: vpc.publicSubnetIds,
privateSubnetIds: vpc.privateSubnetIds,
instanceType: config.CLUSTER_NODE_INSTANCE_TYPE,
createOidcProvider: true,
desiredCapacity: 2,
minSize: 1,
maxSize: 3,
});
const kubeconfig: Output<unknown> = cluster.kubeconfig;
const urn: Output<string> = cluster.urn;
const clusterProvider = cluster.provider
export { urn, kubeconfig, clusterProvider };
import { Provider } from '@pulumi/kubernetes';
import * as pulumi from "@pulumi/pulumi";
import { ProviderArgs } from '@pulumi/kubernetes'
import * as k8s from '@pulumi/kubernetes';
const config = new pulumi.Config();
// Obtain the declared configs for the dev stack in api-gateway
const referrerOrganizationName = config.require("core-org");
const referrerProjectName = config.require("core-project-name");
const referrerStackName = config.require("core-stack");
// Create a stack reference to obtain resources from the referrer stack
const coreInfrastructureReference = new pulumi.StackReference(`${referrerOrganizationName}/${referrerProjectName}/${referrerStackName}`);
// Export any required outputs from the core-infrastructure
export const clusterProvider = coreInfrastructureReference.requireOutput("clusterProvider") as pulumi.Unwrap<ProviderArgs>
// Create secrets
export const secrets = new k8s.core.v1.Secret(
'hasura-secrets',
{
metadata: {
namespace: "default",
},
data: {
secret: "test",
},
},
{ provider: new Provider('EksCluster', clusterProvider) }
);
steep-toddler-94095
04/07/2023, 3:18 AMOutput<Unwrap<ProviderArgs>>
since requireOutput returns an Output. my mistake. but then it means youd have to create your secret within an apply 😕calm-vr-6039
04/07/2023, 3:21 AMsteep-toddler-94095
04/07/2023, 3:22 AMk8s.Provider
calm-vr-6039
04/07/2023, 3:22 AMsteep-toddler-94095
04/07/2023, 3:23 AMas Unwrap<ProviderArgs>
is wrong though. it needs to be an Output<Unwrap<ProviderArgs>>
or a Promise<Unwrap<ProviderArgs>>
if you use requireOutputValue
requireOutput
is reading it in as a stringified json instead? Pulumi making it a Output<any> sort of masks the actual type.
if you coreInfrastructureReference.requireOutput("clusterProvider").apply(console.log)
you should have a better idea what you are importingcalm-vr-6039
04/07/2023, 3:28 AM{
id: '8079f57d-31b6-456a-8ad5-625f489a0db6',
kubeconfig: '....',
pkg: 'kubernetes',
urn: 'urn:pulumi:prod::core::eks:index:Cluster$pulumi:providers:kubernetes::core-k8-cluster-provider'
}
steep-toddler-94095
04/07/2023, 3:30 AMcalm-vr-6039
04/07/2023, 3:31 AMsteep-toddler-94095
04/07/2023, 3:31 AMcalm-vr-6039
04/07/2023, 3:32 AMsteep-toddler-94095
04/07/2023, 3:34 AMcalm-vr-6039
04/07/2023, 3:37 AMsteep-toddler-94095
04/07/2023, 3:49 AMpulumi up
when you are first creating the provider output is misleading..apply
or .then
thoughexport const eksProviderArgs = {
kubeconfig: cluster.kubeconfig,
context: ...,
...
}
calm-vr-6039
04/07/2023, 3:52 AM// Create secrets
export const secrets = new k8s.core.v1.Secret(
'hasura-secrets',
{
metadata: {
namespace: "default",
},
data: {
dbConnectionUrl: "test",
},
},
{
provider: new Provider('EksCluster',
{
...clusterProvider,
helmReleaseSettings: {
driver: "secret"
},
kubeClientSettings: {
burst: 10
}
}
)
}
);
steep-toddler-94095
04/07/2023, 4:00 AMapply
given that the clusterProvider
is an Output<T>
But glad you got it working!!calm-vr-6039
04/07/2023, 4:01 AMworried-rain-74420
04/10/2023, 3:04 PMcalm-vr-6039
04/10/2023, 4:17 PM