Giter Club home page Giter Club logo

terraform-provider-gitfile's Introduction

terraform-provider-gitfile

Build Status

Synopsis

A Terraform plugin to manage files in git repositories.

This allows you to export terraform managed state into other systems which are controlled by git repositories - for example commit server IPs to DNS config repositories, or write out hiera data into your puppet configuration.

Example:

resource "gitfile_checkout" "example" {
    repo = "[email protected]:example"
    branch = "master"
    path = "${path.root}/../other_git_checkouts/example"
}

resource "aws_instance" "importantbox" {
    ....
    count = 5
}

resource "gitfile_file" "importantbox" {
    count = 5
    checkout_dir = "${gitfile_checkout.example.path}"
    path = "directory_of_ips/${element(aws_instance.importantbox.*.private_ip, count.index)}"
    contents = "this is a super important box"
}

resource "gitfile_commit" "importantboxes" {
    checkout_dir = "${gitfile_checkout.example.path}"
    commit_message = "Added example IP files for some important boxes"
    handles = ["${gitfile_file.importantbox.*.id}"]
}

Resources

gitfile_checkout

Checks out a git repository onto your local filesystem from within a terraform provider.

This is mostly used to ensure that a checkout is present, before using the gitfile_commit resource to commit some Terraform generated data.

Inputs:

  • repo - The git path to the repository, this can be anything you can feed to 'git clone'
  • branch - The branch to checkout, defaults to 'master'
  • path - The file path on filesystem for where to put the checkout

Outputs:

  • path - The file path on filesystem where the repository has been checked out

gitfile_file

Creates a file within a git repository with some content from terraform

Inputs:

  • checkout_dir - The path to a git checkout, this can have been made by gitfile_checkout or any other mechanism.
  • count - The number of files to create (so you can create one file per resource for other sets of resources)
  • path - The path within the checkout to create the file at
  • contents - The contents of the file

Outputs:

  • id - The id of the created file. This is usually passed to gitfile_commit

gitfile_symlink

Creates a symlink within a git repository from terraform

Inputs:

  • checkout_dir - The path to a git checkout, this can have been made by gitfile_checkout or any other mechanism.
  • count - The number of symlinks to create (so you can create one symlink per resource for other sets of resources)
  • path - The path within the checkout to create the symlink at
  • target - The place the symlink should point to. Can be an absolute or relative path.

Outputs:

    • id - The id of the created symlink. This is usually passed to gitfile_commit

gitfile_commit

Makes a git commit of a set of gitfile_commit and gitfile_file resources in a git repository, and pushes it to origin.

Note that even if the a file with the same contents Terraform creates already exists, Terraform will create an empty commit with the specified commit message.

Inputs:

  • checkout_dir - The path to a git checkout, this can have been made by gitfile_checkout or any other mechanism.
  • commit_message - The commit message to use for the commit
  • handles - An array of ids from gitfile_file or gitfile_symlink resources which should be included in this commit

Outputs:

  • commit_message - The commit message for the commit that will be made
  • checkout_dir - The path to the git checkout input
  • file - The file(s) committed to.

License

Apache2 - See the included LICENSE file for more details.

terraform-provider-gitfile's People

Contributors

bobtfish avatar evankrall avatar

Watchers

Chet Luther avatar Mike Lunt avatar James Cloos avatar William Gerber avatar Justin Kerr avatar Rama Vykunta avatar Serhii Kyrychenko avatar  avatar  avatar

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.