tfvarser

module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0

README ΒΆ

tfvarser πŸ‘‹

Generate tfvars file by mapping live cloud resources (query via SDK) to a tfvars template

A quick hack to reduce toils in importing hundreds of scaling groups by hand

Disclaimer: the templates are curated to specific needs and not really for general use, at least for now as this is only a quick hack to help current task. So keeping the source close by will come in handy every now and then (modifying, rebuilding, etc.)

Installation

$ make go-build will build the tfvarser binary in ./bin/tfvarser according to your machine's OS and arch.

You can also build it yourself using simple gotools

Usage & Examples

Requires some form of authentication to interact with cloud provider's API

Aliyun

export ALICLOUD_ACCESS_KEY=
export ALICLOUD_SECRET_KEY=
export ALICLOUD_REGION_ID=ap-southeast-1 # default
# example generate by names
$ tfvarser -provider ali -obj ess -limit-names testapp,node-qwertyapp,go-asdfapp

# or just import by ID
$ tfvarser -provider ali -obj ess -limit-ids asdf1234

# or just import one at a time
$ tfvarser -provider ali -obj ess -limit-names testapp

Command above will generate the following structure:

β”œβ”€β”€ testapp
β”‚Β Β  β”œβ”€β”€ autoscale
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ess-alarms
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ go-testapp-downscale
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── go-testapp-upscale
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ess-lifecycle-hooks
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ autoscaledown-event-mns-queue
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── autoscaleup-event-mns-queue
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ess-scaling-configurations
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ go-testapp-1c-1gb
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── go-testapp-1c-500mb
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── terraform.tfvars
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ess-scaling-group
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── terraform.tfvars
β”‚Β Β  β”‚Β Β  └── ess-scaling-rules
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ auto-downscale
β”‚Β Β  β”‚Β Β      β”‚Β Β  └── terraform.tfvars
β”‚Β Β  β”‚Β Β      └── auto-upscale
β”‚Β Β  β”‚Β Β          └── terraform.tfvars

Every provider objects e.g. ESS or ECS in Aliyun may decide what limit-names and limit-ids correspond to.

For example, in Aliyun ESS object limit-names and limit-ids will limit by scaling group's name and ID.

Directories ΒΆ

Path Synopsis
ecs
ess
cmd
log

Jump to

Keyboard shortcuts

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