You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
grumbulon 62bb02ef6d
Added code to read template.tf and output main.tf. Separated parser into it's own package. Readme updates
1 year ago
parser Added code to read template.tf and output main.tf. Separated parser into it's own package. Readme updates 1 year ago
templates Added code to read template.tf and output main.tf. Separated parser into it's own package. Readme updates 1 year ago
.gitignore added incoming request struct and parse positional args from the cli 1 year ago
README.md Added code to read template.tf and output main.tf. Separated parser into it's own package. Readme updates 1 year ago
go.mod Initial commit 1 year ago
go.sum Initial commit 1 year ago
main.go Added code to read template.tf and output main.tf. Separated parser into it's own package. Readme updates 1 year ago

README.md

tf-parser

This program will take incoming requests from an API and generate terraform templates based off them.

What is this

Prototype for a work project, nothing special to see here.

What does this do

The basic premise is that this program will handle incoming requests from a ticketing system and spit out a valid terraform template based off of what is fed to it.

The params are sparse on purpose as where this is to be deployed has a lot of predefined environments with well-known NSGs, resource groups, subscriptions, and all that. So in a real situation 90% of the corresponding template will be filled out already with so there is only a requirement to know how large the VM needs to be, which environment (production, staging, development, training etc.), which product the vms are for, and how many VMs to provision for the request.

With that information this can be used in a pipeline to generate a (hopefully) valid tf template quickly and then move on to more important stuff like

  1. build an image with packer
  2. terraform plan
  3. terraform apply
  4. whatever else is needed

Tested this and did indeed get a valid TF template filled in with variables defined in the struct by reading into memory then writing out to another file in the terraform directory.