Coder Social home page Coder Social logo

terraformtest's Introduction

About Me

Apart from my 15+ years of experience in web applications, infrastructure, and high-performance backend development, I am keenly interested in always exploring the latest available tooling. I have extensive experience designing scalable solutions in AWS and GCP. I am currently deepening my knowledge and experience in Go, and I am also an active contributor to open source projects. Additionally, I worked as a tech reviewer for O'Reilly. Most of all, I am motivated by helping clients solve their toughest software engineering problems.

Please contact me if you are currently dealing with a challenge that matches my expertise.

terraformtest's People

Contributors

bitfield avatar saptarsi96 avatar thiagonache avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

terraformtest's Issues

Ability to unit test variables also

Currently we can only test values but we may want to test some variables.

{
  "variables": {

  }
}

The transform function should also store the values inside of this block into the type Resource which will need an extra field probably called Variables which is going to be a map[string]string.

The functions Contains and Equal should be modified to consider the new data.

Please, also add respective tests for the new function ๐Ÿ˜„

Change test ReadPlanFile function

Depends on #3.

The test function ReadPlanFile should Fatal instead of Error since nothing can be done if it cannot read the file.

Also, we should update from wantBiggerThan := 2000 to want := the exact number of bytes.

Add new function to do test paperwork

I want to reduce the paperwork required to run a test. Eg.:

        tfPlan, err := terraformtest.ReadPlan("./mymodule.plan.json")
	if err != nil {
		t.Fatalf("Cannot read plan file ./mymodule.plan.json: %v", err)
	}

	wantResource := terraformtest.Resource{
		Address: "module.vpc.aws_vpc.this[0]",
		Metadata: map[string]string{
			"type": "aws_vpc",
			"name": "this",
		},
		Values: map[string]string{
			"enable_dns_hostnames":             "true",
			"enable_dns_support":               "true",
			"assign_generated_ipv6_cidr_block": "false",
			"cidr_block":                       "10.0.0.0/16",
			"instance_tenancy":                 "default",
		},
	}

	gotRS := tfPlan.Resources
	if !gotRS.Contains(wantResource) {
		t.Error(gotRS.Diff())
	}

Could be simplified to

	wantResource := terraformtest.Resource{
		Address: "module.vpc.aws_vpc.this[0]",
		Metadata: map[string]string{
			"type": "aws_vpc",
			"name": "this",
		},
		Values: map[string]string{
			"enable_dns_hostnames":             "true",
			"enable_dns_support":               "true",
			"assign_generated_ipv6_cidr_block": "false",
			"cidr_block":                       "10.0.0.0/16",
			"instance_tenancy":                 "default",
		},
	}

        r := terraformtest.New(
                terraformtest.WithPlanFile("./mymodule.plan.json")
        )
	terraformtest.Contains(wantResource)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.