GithubHelp home page GithubHelp logo

tfaction_template's Introduction

tfaction-getting-started

Getting Started with tfaction.

In this getting started, you create a repository from the template repository and set up tfaction and manage GitHub Issue Label with Terraform.

You would know how to set up tfaction and how tfaction works.

Steps

Set up.

  1. Create a repository from this template repository
  2. Create required resources with Terraform
  3. Create Personal Access Token
  4. Fix the template and tfaction-root.yaml

Let's tfaction.

  1. Scaffold a working directory
  2. Create a pull request

Create required resources with Terraform

Create the following resources.

  • IAM OpenID Connect provider
  • S3 Buckets
  • IAM Roles
$ cd aws/github-terraform-ci
$ vi main.tf # Change local values
$ terraform init
$ terraform plan
$ terraform apply

After this getting started, clean up resources.

$ terraform destroy

Create Personal Access Token

We recommend using GitHub App instead of Personal Access Token, but in this getting started let's use a personal access token. Create a Personal Access Token and set it as GitHub Actions Secret.

https://github.com/settings/tokens/new

Secret Name: GH_PERSONAL_ACCESS_TOKEN

https://docs.github.com/en/actions/security-guides/encrypted-secrets

Required permission: https://suzuki-shunsuke.github.io/tfaction/docs/config/github-token

Fix the template and tfaction-root.yaml

$ vi tfaction-root.yaml
$ vi templates/github/main.tf
$ git add tfaction-root.yaml templates/github
$ git checkout -b update-template
$ git commit -m "update template"
$ git push origin update-template
$ gh pr create -t "update template" -b "update template"

Please merge the pull request.

Scaffold a working directory

Please run GitHub Actions Workflow scaffold-working-directory.

$ gh workflow run scaffold-working-directory.yaml -f target=github/foo

Then a pull request would be created.

Please merge the pull request.

Create a pull request

The working directory github/foo was created. Let's add an issue request label with Terraform.

$ git fetch origin main
$ git checkout -b add-issue-label origin/main
$ vi github/foo/label.tf

label.tf

resource "github_issue_label" "bar" {
  repository  = "tfaction-getting-started" # CHANGE
  name        = "bar"
  color       = "FF0000"
  description = "bar"
}
$ git add github/foo/label.tf
$ git commit -m "add an issue label"
$ git push origin add-issue-label
$ gh pr create -t "add an issue label" -b "add an issue label"

image

Please confirm the result of terraform plan and merge the pull request. Then terraform apply would be run in the main branch.

image

LICENSE

MIT

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.