sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 126 forks source link

Unable to use azure-native provider (or any provider with a dash in the provider alias) #535

Closed Liamandrew closed 5 days ago

Liamandrew commented 2 weeks ago

Following the documentation to add the azure-native provider by running:

sst add azure-native

Will generate config.d.ts file like:

import "./src/global.d.ts"
import "../types.generated"
import { AppInput, App, Config } from "./src/config"
import * as _azure-native from "@pulumi/azure-native";

declare global {
  // @ts-expect-error
  export import azure-native = _azure-native
  interface Providers {
    providers?: {
      "azure-native"?:  (_azure-native.ProviderArgs & { version?: string }) | boolean;
    }
  }
  export const $config: (
    input: Omit<Config, "app"> & {
      app(input: AppInput): Omit<App, "providers"> & Providers;
    },
  ) => Config;
}

The issue with this is that the import/export statements are not valid javascript syntax due to the -.

install.go uses the provider alias without any conversion to generate this code. However it needs to convert the kebab case alias to either camel case or snake case to be valid syntax for javascript in order to handle any pulumi provider that has a - in the alias name.

jayair commented 2 weeks ago

Interesting, not sure if this is on our immediate roadmap yet but we'll take a look after our next major release.

rollemira commented 1 week ago

SST Ion targeting Azure would be a huge help for our team in the near future as we're starting a brown field project and the company's assets are hosted entirely inside of Azure ❤️

thdxr commented 5 days ago

this is fixed in v0.0.463