diff --git a/environment/cluster-applications/index.ts b/environment/cluster-applications/index.ts index 8e8f48a..ee26a73 100644 --- a/environment/cluster-applications/index.ts +++ b/environment/cluster-applications/index.ts @@ -5,6 +5,8 @@ type Options = { cluster: Awaited>, } -export = async ( { cluster }: Options ) => { +const clusterApplicationsModule = async ( { cluster }: Options ) => { traefik( { cluster } ) } + +export default clusterApplicationsModule diff --git a/environment/cluster-applications/traefik.ts b/environment/cluster-applications/traefik.ts index 7e7fb1c..f48af59 100644 --- a/environment/cluster-applications/traefik.ts +++ b/environment/cluster-applications/traefik.ts @@ -21,7 +21,7 @@ const certificateResolvers = [ const config = new Config() -export = ( { cluster: { provider } }: Options ) => { +const traefik = ( { cluster: { provider } }: Options ) => { new helm.v3.Chart( 'traefik-ingress', { chart: 'traefik', version: '10.19.4', @@ -50,3 +50,5 @@ export = ( { cluster: { provider } }: Options ) => { }, }, { provider } ) } + +export default traefik diff --git a/environment/cluster.ts b/environment/cluster.ts index 7aa5ae6..4986b3f 100644 --- a/environment/cluster.ts +++ b/environment/cluster.ts @@ -1,8 +1,7 @@ import { listManagedClusterUserCredentialsOutput, ManagedCluster } from '@pulumi/azure-native/containerservice' import { Provider } from '@pulumi/kubernetes' -import identity from '~/shared/identity' - +import identity from '../shared/identity' import logging from './logging' import network from './network' @@ -12,7 +11,7 @@ type Options = { logging: Awaited>, } -export = async ( { +const clusterModule = async ( { identity: { application, resourceGroup, servicePrincipalPassword }, network: { subnet }, logging: { logAnalyticsWorkspace }, @@ -57,3 +56,5 @@ export = async ( { return { cluster, kubeconfig, provider } } + +export default clusterModule diff --git a/environment/github-secrets.ts b/environment/github-secrets.ts index 83c8646..4e3a278 100644 --- a/environment/github-secrets.ts +++ b/environment/github-secrets.ts @@ -1,17 +1,18 @@ import { ActionsOrganizationSecret } from '@pulumi/github' -import * as environment from '~/shared/environment' - +import * as environment from '../shared/environment' import cluster from './cluster' type Options = { cluster: Awaited>, } -export = async ( { cluster: { kubeconfig } }: Options ) => { +const githubSecretsModule = async ( { cluster: { kubeconfig } }: Options ) => { new ActionsOrganizationSecret( 'kubeconfig-github-secret', { secretName: `${environment.name.toUpperCase()}__KUBECONFIG`, visibility: 'all', plaintextValue: kubeconfig, } ) } + +export default githubSecretsModule diff --git a/environment/index.ts b/environment/index.ts index 5580628..67d1956 100644 --- a/environment/index.ts +++ b/environment/index.ts @@ -1,13 +1,12 @@ -import azureModule from '~/shared/azure' -import identityModule from '~/shared/identity' - +import azureModule from '../shared/azure' +import identityModule from '../shared/identity' import clusterModule from './cluster' import clusterApplications from './cluster-applications' import githubSecretsModule from './github-secrets' import loggingModule from './logging' import networkModule from './network' -export = async () => { +const stack = async () => { const azure = await azureModule() const identity = await identityModule() @@ -23,3 +22,5 @@ export = async () => { logAnalyticsWorkspaceId: logging.logAnalyticsWorkspace.id, } } + +export = stack diff --git a/environment/logging.ts b/environment/logging.ts index a455b71..1c2bf76 100644 --- a/environment/logging.ts +++ b/environment/logging.ts @@ -1,12 +1,12 @@ import { Workspace } from '@pulumi/azure-native/operationalinsights' -import identity from '~/shared/identity' +import identity from '../shared/identity' type Options = { identity: Awaited>, } -export = async ( { identity: { resourceGroup } }: Options ) => { +const loggingModule = async ( { identity: { resourceGroup } }: Options ) => { const logAnalyticsWorkspace = new Workspace( 'default-workspace', { resourceGroupName: resourceGroup.name, location: resourceGroup.location, @@ -15,3 +15,5 @@ export = async ( { identity: { resourceGroup } }: Options ) => { return { logAnalyticsWorkspace } } + +export default loggingModule diff --git a/environment/network.ts b/environment/network.ts index cf7b2b5..e01084c 100644 --- a/environment/network.ts +++ b/environment/network.ts @@ -1,15 +1,15 @@ import { PrincipalType, RoleAssignment } from '@pulumi/azure-native/authorization' import { Subnet, VirtualNetwork } from '@pulumi/azure-native/network' -import azure from '~/shared/azure' -import identity from '~/shared/identity' +import azure from '../shared/azure' +import identity from '../shared/identity' type Options = { azure: Awaited>, identity: Awaited>, } -export = async ( { +const networkModule = async ( { azure: { subscriptionId }, identity: { resourceGroup, servicePrincipal }, }: Options ) => { @@ -33,3 +33,5 @@ export = async ( { return { virtualNetwork, subnet, subnetAssignment } } + +export default networkModule diff --git a/shared/azure.ts b/shared/azure.ts index 8d7abb4..fedcdb3 100644 --- a/shared/azure.ts +++ b/shared/azure.ts @@ -1,7 +1,9 @@ import { getClientConfig } from '@pulumi/azure-native/authorization' -export = async () => { +const azureModule = async () => { const { subscriptionId, tenantId } = await getClientConfig() return { subscriptionId, tenantId } } + +export default azureModule diff --git a/shared/identity.ts b/shared/identity.ts index e1854ec..0bca970 100644 --- a/shared/identity.ts +++ b/shared/identity.ts @@ -1,9 +1,9 @@ import { ResourceGroup } from '@pulumi/azure-native/resources' import { Application, ServicePrincipal, ServicePrincipalPassword } from '@pulumi/azuread' -import * as environment from '~/shared/environment' +import * as environment from './environment' -export = async () => { +const identityModule = async () => { const application = new Application( `${environment.name}-environment-app`, { displayName: `${environment.name}-environment-app` } ) const servicePrincipal = new ServicePrincipal( `${environment.name}-environment-service-principal`, { @@ -21,3 +21,5 @@ export = async () => { return { application, servicePrincipal, servicePrincipalPassword, resourceGroup } } + +export default identityModule diff --git a/tools/index.ts b/tools/index.ts index 0c782cd..3256ec9 100644 --- a/tools/index.ts +++ b/tools/index.ts @@ -1,12 +1,13 @@ -import azureModule from '~/shared/azure' -import identityModule from '~/shared/identity' - +import azureModule from '../shared/azure' +import identityModule from '../shared/identity' import keyVaultModule from './key-vault' -export = async () => { +const stack = async () => { const azure = await azureModule() const identity = await identityModule() await keyVaultModule( { azure, identity } ) } + +export = stack diff --git a/tools/key-vault.ts b/tools/key-vault.ts index 6d4c49a..45ebc83 100644 --- a/tools/key-vault.ts +++ b/tools/key-vault.ts @@ -1,14 +1,14 @@ import { keyvault } from '@pulumi/azure-native' -import azure from '~/shared/azure' -import identity from '~/shared/identity' +import azure from '../shared/azure' +import identity from '../shared/identity' type Options = { azure: Awaited>, identity: Awaited>, } -export = async ( { +const keyVaultModule = async ( { azure: { tenantId }, identity: { resourceGroup, servicePrincipal }, }: Options ) => new keyvault.Vault( 'shabad-os-tools', { @@ -31,3 +31,5 @@ export = async ( { } ], }, } ) + +export default keyVaultModule diff --git a/tsconfig.json b/tsconfig.json index 998ba5c..d12831b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,9 +7,6 @@ "noEmit": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "skipLibCheck": true, - "paths": { - "~/*": ["./*"] - } + "skipLibCheck": true } }