Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions .github/workflows/njsscan.yaml

This file was deleted.

52 changes: 52 additions & 0 deletions src/commands/aws-cld/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Command, Flags } from '@oclif/core';
import fs from 'node:fs';
import { render } from 'template-file';

const bootstrapTemplate = `module "bootstrap" {
source = "github.com/markcallen/aws-cld//bootstrap/"
project = "{{ project }}"
}

output "project" {
value = module.bootstrap.project_name
}
`;

export default class Bootstrap extends Command {
static description = 'AWS quick utilities';

static examples = [
`$ <%= config.bin %> <%= command.id %>
`
];

static flags = {
directory: Flags.string({ char: 'd', required: true }),
project: Flags.string({ char: 'p', required: true })
};

async run(): Promise<void> {
const { flags } = await this.parse(Bootstrap);

const { directory, project } = flags;

if (fs.existsSync(directory)) {
this.error(`${directory} exists`);
}

fs.mkdirSync(directory);

// Make the boostrap, infra and env directories
fs.mkdirSync(`${directory}/bootstrap`);
fs.mkdirSync(`${directory}/infra`);
fs.mkdirSync(`${directory}/env`);

const bootstrapData = { project };
fs.writeFileSync(
`${directory}/bootstrap/main.tf`,
render(bootstrapTemplate, bootstrapData)
);

// TODO: add in terraform init, plan and apply
}
}
17 changes: 17 additions & 0 deletions src/commands/aws-cld/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Command } from '@oclif/core';

export default class AwsCld extends Command {
static description = 'AWS quick utilities';

static examples = [
`$ <%= config.bin %> <%= command.id %>
aws-cld
`
];

async run(): Promise<void> {
await this.parse(AwsCld);

this.log('aws-cld');
}
}