sparse-intern-71089
12/19/2019, 8:50 PMgorgeous-egg-16927
12/19/2019, 9:17 PM[namespace/]name
e.g., to import a Deployment in the foo namespace:
import: "foo/my-deployment"bitter-dentist-28132
12/19/2019, 9:19 PMgorgeous-egg-16927
12/19/2019, 9:20 PMgorgeous-egg-16927
12/19/2019, 9:20 PM.metadata.name rather than the name you picked for the pulumi resourcebitter-dentist-28132
12/19/2019, 9:22 PMconst clusterIssuer = new k8s.yaml.ConfigGroup('cluster-issuer', {yaml: CLUSTER_ISSUER_YAML}, {provider, dependsOn, transformations: [asdf]});
function asdf(args: any) {
return {
props: args.props,
opts: pulumi.mergeOptions(args.opts, {import: 'letsencrypt-prod'}),
};
}
This is just a test resource to see if i could import a single resource.bitter-dentist-28132
12/19/2019, 9:22 PMCLUSTER_ISSUER_YAML is my cert-manager cluster issuergorgeous-egg-16927
12/19/2019, 9:35 PMConfigGroup directly; import currently only works with the underlying resources, so the import name has to map correctlygorgeous-egg-16927
12/19/2019, 9:36 PMbitter-dentist-28132
12/19/2019, 9:41 PMgorgeous-egg-16927
12/19/2019, 9:42 PMletsencrypt-prodbitter-dentist-28132
12/19/2019, 9:42 PMimport: whatever to ConfigGroup fails because of the type mismatch (expected), and the transform applies to the cluster issuer (it's a config group but there's only one yaml element), but the import fails with Preview failed: resource 'letsencrypt-prod' does not existgorgeous-egg-16927
12/19/2019, 9:43 PMbitter-dentist-28132
12/19/2019, 9:43 PMbitter-dentist-28132
12/19/2019, 9:43 PMgorgeous-egg-16927
12/19/2019, 9:44 PMgorgeous-egg-16927
12/19/2019, 9:44 PMgorgeous-egg-16927
12/19/2019, 9:45 PMbitter-dentist-28132
12/19/2019, 9:46 PMgorgeous-egg-16927
12/19/2019, 9:47 PMfunction addImportForHelmChart() {
return (obj: any, opts: pulumi.CustomResourceOptions): void => {
if (obj != null && obj.metadata != null && obj.metadata.name) {
opts.import = obj.metadata.namespace
? `${obj.metadata.namespace}/${obj.metadata.name}`
: obj.metadata.name;
}
};
}bitter-dentist-28132
12/19/2019, 9:47 PMany, and the docs say something different nowbitter-dentist-28132
12/19/2019, 9:48 PMbitter-dentist-28132
12/19/2019, 9:48 PMgorgeous-egg-16927
12/19/2019, 9:49 PMgorgeous-egg-16927
12/19/2019, 9:49 PMgorgeous-egg-16927
12/19/2019, 9:51 PMbitter-dentist-28132
12/19/2019, 9:52 PMsrc/cluster-bits.ts:99:99 - error TS2345: Argument of type '{ provider: Provider; dependsOn: Output<any>; transformations: (() => (obj: any, opts: CustomResourceOptions) => void)[]; }' is not assignable to parameter of type 'ComponentResourceOptions'.
Types of property 'transformations' are incompatible.
Type '(() => (obj: any, opts: CustomResourceOptions) => void)[]' is not assignable to type 'ResourceTransformation[]'.
Type '() => (obj: any, opts: CustomResourceOptions) => void' is not assignable to type 'ResourceTransformation'.
Type '(obj: any, opts: CustomResourceOptions) => void' is missing the following properties from type 'ResourceTransformationResult': props, opts
99 const clusterIssuer = new k8s.yaml.ConfigGroup('cluster-issuer', {yaml: CLUSTER_ISSUER_YAML}, {provider, dependsOn, transformations: [addImportForYaml]});bitter-dentist-28132
12/19/2019, 9:52 PM{props, opts})gorgeous-egg-16927
12/19/2019, 9:54 PMgorgeous-egg-16927
12/19/2019, 10:04 PMnew k8s.yaml.ConfigGroup("test",
{
yaml: `
apiVersion: v1
kind: Namespace
metadata:
annotations: {}
name: foo`,
transformations: [
(obj: any, opts: pulumi.CustomResourceOptions) => {
opts.import = obj.metadata.name
}
]
}
);gorgeous-egg-16927
12/19/2019, 10:04 PMbitter-dentist-28132
12/19/2019, 10:05 PMgorgeous-egg-16927
12/19/2019, 10:06 PMpulumi-kubernetesbitter-dentist-28132
12/19/2019, 10:06 PMpulumi-kubernetes is pretty old, let me try bumping it...bitter-dentist-28132
12/19/2019, 10:31 PMbitter-dentist-28132
12/19/2019, 10:32 PMbitter-dentist-28132
12/19/2019, 10:32 PMtsc so i can then import the code in the actual pulumi stack code)bitter-dentist-28132
12/19/2019, 10:37 PMtsc ?gorgeous-egg-16927
12/19/2019, 10:39 PMtsc. pulumi will run it as part of the pulumi up processbitter-dentist-28132
12/19/2019, 10:40 PMgorgeous-egg-16927
12/19/2019, 10:42 PMgorgeous-egg-16927
12/19/2019, 10:43 PMbitter-dentist-28132
12/19/2019, 10:43 PMbitter-dentist-28132
12/19/2019, 10:44 PMgorgeous-egg-16927
12/19/2019, 10:56 PMbitter-dentist-28132
12/19/2019, 11:49 PMprehistoric-account-60014
12/20/2019, 4:22 AMbitter-dentist-28132
12/20/2019, 3:21 PMnpm ls | grep pulumi shows the same pulumi version for everything. but it is something i'll have to watch out for.prehistoric-account-60014
12/20/2019, 3:36 PMyarn why @pulumi/pulumi and making sure there was only one instance. Also keep in mind there are two transformation properties and each have different signatures. You might be mixing the two. One is in the second positional argument in the constructor, together with other options and the other one is in the third, together with the provider, etc.