https://pulumi.com logo
Title
t

tall-scientist-89115

05/27/2021, 8:17 PM
Hey is there a way to tell certain libraries (e.g. kubernetes) to ALWAYS require I pass it a provider. Often times I will forget one and it'll default to my environment then fail when I get to the CI
l

little-cartoon-10569

05/27/2021, 8:34 PM
Not as a built-in feature, but stack and resource transformations have access to the opts parameter, so you could throw an exception from there.
t

tall-scientist-89115

05/28/2021, 4:36 AM
Thank you! For others who are curious this seems to work:
pulumi.runtime.registerStackTransformation((args) => {
  if (
    args.type.includes("kubernetes") &&
    !args.type.includes("provider") &&
    !args.opts.provider
  ) {
    throw `Please specify provider for ${args.name}`;
  }
  return undefined;
});
👍 1