aiac

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

AIAC AIAC

Artificial Intelligence Infrastructure-as-Code Generator.

demo

Description

aiac is a command line tool to generate IaC (Infrastructure as Code) templates via OpenAI's API. The CLI allows you to ask the model to generate templates for different scenarios (e.g. "get terraform for AWS EC2"). It will make the request, and store the resulting code to a file, or simply print it to standard output.

Quick Start

First, install aiac:

go generate github.com/gofireflyio/aiac

Alternatively, clone the repository and build from source:

git clone https://github.com/gofireflyio/aiac.git
go build
Instructions
  1. Create your OpenAI API key here.
  2. Click “Create new secret key” and copy it.
  3. Provide the API key via the OPENAI_API_KEY environment variable or via the --api-key command line flag.

By default, aiac prints the extracted code to standard output and asks if it should save or re-generate the code

aiac get terraform for AWS EC2

To store the resulting code to a file:

aiac -o="aws_ec2.tf" \
     get terraform for AWS EC2

Example Prompts

The following prompts are known to work:

  • aiac get terraform for a highly available eks
  • aiac get pulumi golang for an s3 with sns notification
  • aiac get dockerfile for a secured nginx
  • aiac get cloudformaion for a neptondb
  • aiac get k8s manifest for a mongodb deployment
  • aiac get github action which plan and apply terraform and send slack notification

Example Output

Command line prompt:

aiac get dockerfile for nodejs with comments

Output:

FROM node:latest

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "node", "index.js" ]

License

This code is published under the terms of the Apache License 2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL