From 46d3d8e4238c0749cf712ab44094c2b80fbf8f4b Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Tue, 6 Aug 2024 15:51:14 +0100 Subject: [PATCH 1/8] feat(ENG-872): adding basic folder structure --- .github/workflows | 0 .vscode/settings.json | 5 +++++ actions/terraform/action.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 .github/workflows create mode 100644 .vscode/settings.json create mode 100644 actions/terraform/action.yml diff --git a/.github/workflows b/.github/workflows new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7dd1560 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "yaml.schemas": { + "https://json.schemastore.org/github-action.json": "file:///Users/triwats/src/oak/oak-actions/actions/terraform/action.yml" + } +} \ No newline at end of file diff --git a/actions/terraform/action.yml b/actions/terraform/action.yml new file mode 100644 index 0000000..e02f2ea --- /dev/null +++ b/actions/terraform/action.yml @@ -0,0 +1,31 @@ +name: Common Terraform Checks +run-name: πŸ” Terraform Checks - triggered by @${{ github.actor }} +on: [push] +jobs: + terraform-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hashicorp/setup-terraform@v2 + with: + terraform_version: 1.5.7 # See upgrading docs regarding tfenv: https://www.notion.so/oaknationalacademy/Terraform-The-Oak-Guide-to-b3930c13433f48fa890968636f495098?pvs=4#4dee54a2e4714f55957b047c1d94c62a + - name: "INFO: Acertain Terraform Version" + shell: bash + run: terraform --version + - name: "INFO: Linting Terraform Files" + shell: bash + run: | + cd infrastructure + terraform fmt -check $(find . -name '*tf') + - name: "INFO: Validate terraform configs" + shell: bash + run: | + cd infrastructure + for d in $(find . -type d -mindepth 1 -maxdepth 1) + do + echo "Validating the $d config" + cd $d + terraform init -backend=false + terraform validate + cd .. + done From f50d44f006472821948b9f9dee043acce655c993 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Tue, 6 Aug 2024 16:31:07 +0100 Subject: [PATCH 2/8] chore(docs): adding documentation --- .github/pull_request_template.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..723087a --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +## Description + +- List of changes related to this PR + +## Issue(s) + +[ENG-###]() + +## How to test + +1. .... + +## Checklist + +- [ ] Something that needs doing From e1cc90ff9af24a6d351f51e6879bfe18f037327f Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Tue, 6 Aug 2024 16:38:05 +0100 Subject: [PATCH 3/8] Adding and populating the example --- README.md | 1 + examples/terraform/README.md | 36 +++++++++++++++++++++++++++++++++++ examples/terraform/action.yml | 19 ++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 examples/terraform/README.md create mode 100644 examples/terraform/action.yml diff --git a/README.md b/README.md index 0ed68aa..07822cc 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # oak-actions + diff --git a/examples/terraform/README.md b/examples/terraform/README.md new file mode 100644 index 0000000..6fd1768 --- /dev/null +++ b/examples/terraform/README.md @@ -0,0 +1,36 @@ +### Using the Terraform Action from `oaknational/oak-actions` + +To use the Terraform action from the `oaknational/oak-actions` repository in your GitHub workflows, follow these steps: + +1. **Create a Workflow File**: In your target repository, create a `.github/workflows` directory if it doesn't exist. + +2. **Add Workflow Configuration**: Create a workflow file (e.g., `main.yml`) with the following content: + +```yaml +name: oak-terraform-action + +on: + push: + branches: + - main + +jobs: + example-job: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run Terraform Action from oak-actions + uses: oaknational/oak-actions/actions/terraform@main + with: + example_input: "value" +``` + +### Explanation + +- **uses: oaknational/oak-actions/actions/terraform@main**: Specifies the action from the `oak-actions` repository. +- **example_input**: Replace this with the actual input parameters required by the Terraform action πŸ˜‰. + +This setup allows you to incorporate the reusable Terraform action in your CI/CD workflows. For more details, visit the [oaknational/oak-actions repository](https://github.com/oaknational/oak-actions). diff --git a/examples/terraform/action.yml b/examples/terraform/action.yml new file mode 100644 index 0000000..1596ebe --- /dev/null +++ b/examples/terraform/action.yml @@ -0,0 +1,19 @@ +name: Example Workflow + +on: + push: + branches: + - main + +jobs: + example-job: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run Terraform Action from oak-actions + uses: oaknational/oak-actions/actions/terraform@main + with: + example_input: "value" From c9528a0f30b5b2ec5fd1be6d86c923d4da230c22 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Tue, 6 Aug 2024 16:44:28 +0100 Subject: [PATCH 4/8] chore(docs): adding contributing and updating README --- CONTRIBUTING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3cfa04d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +### Contributing to Oak Actions + +Thank you for your interest in contributing to the Oak Actions repository! We welcome and appreciate your contributions. Here’s how you can get started: + +## How to Contribute + +1. **Fork the Repository**: Click on the fork button to create your copy of the repository. +2. **Clone Your Fork**: Clone the forked repository to your local machine. + ```bash + git clone https://github.com/your-username/oak-actions.git + ``` +3. **Create a Branch**: Create a new branch for your feature or bug fix. + ```bash + git checkout -b feature/your-feature-name + ``` +4. **Make Changes**: Implement your changes in the new branch. +5. **Commit Changes**: Commit your changes with a meaningful message. + ```bash + git commit -m "Add feature: description of feature" + ``` +6. **Push Changes**: Push your branch to your fork. + ```bash + git push origin feature/your-feature-name + ``` +7. **Open a Pull Request**: Go to the original repository and open a pull request from your forked repository. Use the [PR template](#pull-request-template) provided below. + +## Contribution Guidelines + +- **Code Style**: Follow the existing coding style and conventions. +- **Documentation**: Update documentation for any changes or new features. +- **Testing**: Ensure that your code passes all tests and adds new tests if necessary. +- **Review**: Be open to feedback and make changes as requested during the review process. + +## Pull Request Template + +When submitting a pull request, you will be presented with our Pull Request Template. + +### How to Use the Template + +1. **Description**: Clearly list and describe the changes made in this PR. +2. **Issue(s)**: Link any related issues using the `[ENG-###]()` format. +3. **How to test**: Provide step-by-step instructions on how to test the changes. +4. **Checklist**: Ensure all tasks and checks are completed before submitting the PR. + +## Code of Conduct + +Please adhere to the [Code of Conduct](https://github.com/oaknational/oak-actions/blob/main/CODE_OF_CONDUCT.md) to ensure a welcoming and respectful environment for all contributors. + +## Getting Help + +If you need help, feel free to open an issue or ask for assistance in your pull request. + +> **Tip:** Check out the existing issues for any features or bug fixes you can help with! + +We appreciate your contributions and look forward to collaborating with you! πŸš€ + +For more details, visit the [Oak Actions repository](https://github.com/oaknational/oak-actions). diff --git a/README.md b/README.md index 07822cc..ed9a1ab 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,45 @@ # oak-actions +The `actions` folder is designed to house reusable GitHub Actions, making it easy to manage and share automation across different repositories. Each subfolder within `actions` contains a specific action with all necessary files and documentation. + +#### Structure + +```plaintext +actions/ +β”œβ”€β”€ terraform/ +β”‚ β”œβ”€β”€ action.yml +β”‚ β”œβ”€β”€ Dockerfile (if applicable) +β”‚ β”œβ”€β”€ scripts/ (if any) +β”‚ └── README.md +``` + +### Terraform Action 🌍 + +**Location:** `actions/terraform` + +**Purpose:** The Terraform action automates Terraform workflows, including applying infrastructure as code configurations. + +#### Key Features + +- **Infrastructure Management:** Streamlines Terraform commands in CI/CD pipelines. +- **Ease of Use:** Integrates seamlessly with your GitHub workflows. +- **Customizable:** Accepts input parameters for flexible operation. + +### How to Use + +```yaml +jobs: + terraform-job: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Run Terraform Action + uses: oaknational/oak-actions/actions/terraform@main + with: + example_input: "value" +``` + +> **Note:** Replace `example_input` with the required parameters as specified in the action's `README.md`. + +For more details, visit the [oaknational/oak-actions repository](https://github.com/oaknational/oak-actions). From 8964264ba3cfdb96fd5e443381315578aefc9b1f Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Tue, 6 Aug 2024 16:45:10 +0100 Subject: [PATCH 5/8] chore(docs):removing Docker reference --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ed9a1ab..7d3d046 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ The `actions` folder is designed to house reusable GitHub Actions, making it eas actions/ β”œβ”€β”€ terraform/ β”‚ β”œβ”€β”€ action.yml -β”‚ β”œβ”€β”€ Dockerfile (if applicable) β”‚ β”œβ”€β”€ scripts/ (if any) β”‚ └── README.md ``` From cd0010be5d6b0ab9b83c773b6906ba9196f6e688 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Thu, 8 Aug 2024 10:41:43 +0100 Subject: [PATCH 6/8] chore(ENG-872): re-writing docs slightly to make more focused to Terraform --- .github/workflows | 24 +++++++ README.md | 17 +++-- actions/terraform/action.yml | 71 +++++++++++-------- examples/define-version/action.yml | 12 ++++ examples/{terraform => general-use}/README.md | 0 examples/general-use/action.yml | 13 ++++ examples/terraform/action.yml | 19 ----- 7 files changed, 97 insertions(+), 59 deletions(-) create mode 100644 examples/define-version/action.yml rename examples/{terraform => general-use}/README.md (100%) create mode 100644 examples/general-use/action.yml delete mode 100644 examples/terraform/action.yml diff --git a/.github/workflows b/.github/workflows index e69de29..f2ea17e 100644 --- a/.github/workflows +++ b/.github/workflows @@ -0,0 +1,24 @@ +name: YAML Syntax Check + +on: [push, pull_request] + +jobs: + lint-yaml: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Install yamllint + run: | + python -m pip install --upgrade pip + pip install yamllint + + - name: Run yamllint + run: yamllint . diff --git a/README.md b/README.md index 7d3d046..2530392 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ actions/ β”‚ └── README.md ``` -### Terraform Action 🌍 +### Terraform Actions 🌍 **Location:** `actions/terraform` @@ -27,18 +27,17 @@ actions/ ### How to Use ```yaml +name: Terraform Check + +on: [push, pull_request] + jobs: - terraform-job: + example-job: runs-on: ubuntu-latest + steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Run Terraform Action + - name: Run Terraform Action from oak-terraform-actions uses: oaknational/oak-actions/actions/terraform@main - with: - example_input: "value" ``` -> **Note:** Replace `example_input` with the required parameters as specified in the action's `README.md`. - For more details, visit the [oaknational/oak-actions repository](https://github.com/oaknational/oak-actions). diff --git a/actions/terraform/action.yml b/actions/terraform/action.yml index e02f2ea..f5d040a 100644 --- a/actions/terraform/action.yml +++ b/actions/terraform/action.yml @@ -1,31 +1,40 @@ -name: Common Terraform Checks -run-name: πŸ” Terraform Checks - triggered by @${{ github.actor }} -on: [push] -jobs: - terraform-checks: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: hashicorp/setup-terraform@v2 - with: - terraform_version: 1.5.7 # See upgrading docs regarding tfenv: https://www.notion.so/oaknationalacademy/Terraform-The-Oak-Guide-to-b3930c13433f48fa890968636f495098?pvs=4#4dee54a2e4714f55957b047c1d94c62a - - name: "INFO: Acertain Terraform Version" - shell: bash - run: terraform --version - - name: "INFO: Linting Terraform Files" - shell: bash - run: | - cd infrastructure - terraform fmt -check $(find . -name '*tf') - - name: "INFO: Validate terraform configs" - shell: bash - run: | - cd infrastructure - for d in $(find . -type d -mindepth 1 -maxdepth 1) - do - echo "Validating the $d config" - cd $d - terraform init -backend=false - terraform validate - cd .. - done +name: "Terraform Checks" +description: "Perform common Terraform checks" +inputs: + terraform_version: + description: "Terraform version to use" + required: false + default: "1.5.7" +runs: + using: "composite" + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: ${{ inputs.terraform_version }} + + - name: "INFO: Ascertain Terraform Version" + shell: bash + run: terraform --version + + - name: "INFO: Linting Terraform Files" + shell: bash + run: | + cd infrastructure + terraform fmt -check $(find . -name '*tf') + + - name: "INFO: Validate Terraform Configs" + shell: bash + run: | + cd infrastructure + for d in $(find . -type d -mindepth 1 -maxdepth 1) + do + echo "Validating the $d config" + cd $d + terraform init -backend=false + terraform validate + cd .. + done diff --git a/examples/define-version/action.yml b/examples/define-version/action.yml new file mode 100644 index 0000000..5b594c8 --- /dev/null +++ b/examples/define-version/action.yml @@ -0,0 +1,12 @@ +name: Terraform Check - With Defined Version + +on: [push, pull_request] + +jobs: + terraform-checks: + runs-on: ubuntu-latest + steps: + - name: Run Terraform Checks Action from oak-terraform-actions + uses: oaknational/oak-actions/actions/terraform-checks@main + with: + terraform_version: 1.5.7 # or any other version as needed diff --git a/examples/terraform/README.md b/examples/general-use/README.md similarity index 100% rename from examples/terraform/README.md rename to examples/general-use/README.md diff --git a/examples/general-use/action.yml b/examples/general-use/action.yml new file mode 100644 index 0000000..818b502 --- /dev/null +++ b/examples/general-use/action.yml @@ -0,0 +1,13 @@ +name: Terraform Check + +on: [push, pull_request] + +jobs: + example-job: + runs-on: ubuntu-latest + + steps: + - name: Run Terraform Action from oak-terraform-actions + uses: oaknational/oak-actions/actions/terraform@main + with: + example_input: "value" diff --git a/examples/terraform/action.yml b/examples/terraform/action.yml deleted file mode 100644 index 1596ebe..0000000 --- a/examples/terraform/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Example Workflow - -on: - push: - branches: - - main - -jobs: - example-job: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Run Terraform Action from oak-actions - uses: oaknational/oak-actions/actions/terraform@main - with: - example_input: "value" From 7762ea1339bffaaf89b6300f3be1fd86583762f3 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Thu, 8 Aug 2024 10:49:31 +0100 Subject: [PATCH 7/8] chore(docs): updating to reflect rename of actions for ENG-872 --- .vscode/settings.json | 2 +- CONTRIBUTING.md | 10 +++++----- README.md | 6 +++--- examples/define-version/action.yml | 2 +- examples/general-use/README.md | 12 ++++++------ examples/general-use/action.yml | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7dd1560..8dc9484 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "yaml.schemas": { - "https://json.schemastore.org/github-action.json": "file:///Users/triwats/src/oak/oak-actions/actions/terraform/action.yml" + "https://json.schemastore.org/github-action.json": "/actions/terraform/action.yml" } } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3cfa04d..35f617d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,13 @@ -### Contributing to Oak Actions +### Contributing to Oak Terraform Actions -Thank you for your interest in contributing to the Oak Actions repository! We welcome and appreciate your contributions. Here’s how you can get started: +Thank you for your interest in contributing to the Oak Terrafor Actions repository! We welcome and appreciate your contributions. Here’s how you can get started: ## How to Contribute 1. **Fork the Repository**: Click on the fork button to create your copy of the repository. 2. **Clone Your Fork**: Clone the forked repository to your local machine. ```bash - git clone https://github.com/your-username/oak-actions.git + git clone https://github.com/your-username/oak-terraform-actions.git ``` 3. **Create a Branch**: Create a new branch for your feature or bug fix. ```bash @@ -44,7 +44,7 @@ When submitting a pull request, you will be presented with our Pull Request Temp ## Code of Conduct -Please adhere to the [Code of Conduct](https://github.com/oaknational/oak-actions/blob/main/CODE_OF_CONDUCT.md) to ensure a welcoming and respectful environment for all contributors. +Please adhere to the [Code of Conduct](https://github.com/oaknational/oak-terraform-actions/blob/main/CODE_OF_CONDUCT.md) to ensure a welcoming and respectful environment for all contributors. ## Getting Help @@ -54,4 +54,4 @@ If you need help, feel free to open an issue or ask for assistance in your pull We appreciate your contributions and look forward to collaborating with you! πŸš€ -For more details, visit the [Oak Actions repository](https://github.com/oaknational/oak-actions). +For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions). diff --git a/README.md b/README.md index 2530392..f206178 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# oak-actions +# oak-terraform-actions The `actions` folder is designed to house reusable GitHub Actions, making it easy to manage and share automation across different repositories. Each subfolder within `actions` contains a specific action with all necessary files and documentation. @@ -37,7 +37,7 @@ jobs: steps: - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-actions/actions/terraform@main + uses: oaknational/oak-terraform-actions/actions/terraform@main ``` -For more details, visit the [oaknational/oak-actions repository](https://github.com/oaknational/oak-actions). +For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions). diff --git a/examples/define-version/action.yml b/examples/define-version/action.yml index 5b594c8..04facff 100644 --- a/examples/define-version/action.yml +++ b/examples/define-version/action.yml @@ -7,6 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Run Terraform Checks Action from oak-terraform-actions - uses: oaknational/oak-actions/actions/terraform-checks@main + uses: oaknational/oak-terraform-actions/actions/terraform-checks@main with: terraform_version: 1.5.7 # or any other version as needed diff --git a/examples/general-use/README.md b/examples/general-use/README.md index 6fd1768..b2198fe 100644 --- a/examples/general-use/README.md +++ b/examples/general-use/README.md @@ -1,6 +1,6 @@ -### Using the Terraform Action from `oaknational/oak-actions` +### Using the Terraform Action from `oaknational/oak-terraform-actions` -To use the Terraform action from the `oaknational/oak-actions` repository in your GitHub workflows, follow these steps: +To use the Terraform action from the `oaknational/oak-terraform-actions` repository in your GitHub workflows, follow these steps: 1. **Create a Workflow File**: In your target repository, create a `.github/workflows` directory if it doesn't exist. @@ -22,15 +22,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Run Terraform Action from oak-actions - uses: oaknational/oak-actions/actions/terraform@main + - name: Run Terraform Action from oak-terraform-actions + uses: oaknational/oak-terraform-actions/actions/terraform@main with: example_input: "value" ``` ### Explanation -- **uses: oaknational/oak-actions/actions/terraform@main**: Specifies the action from the `oak-actions` repository. +- **uses: oaknational/oak-terraform-actions/actions/terraform@main**: Specifies the action from the `oak-terraform-actions` repository. - **example_input**: Replace this with the actual input parameters required by the Terraform action πŸ˜‰. -This setup allows you to incorporate the reusable Terraform action in your CI/CD workflows. For more details, visit the [oaknational/oak-actions repository](https://github.com/oaknational/oak-actions). +This setup allows you to incorporate the reusable Terraform action in your CI/CD workflows. For more details, visit the [oaknational/oak-terraform-actions repository](https://github.com/oaknational/oak-terraform-actions). diff --git a/examples/general-use/action.yml b/examples/general-use/action.yml index 818b502..0634c8c 100644 --- a/examples/general-use/action.yml +++ b/examples/general-use/action.yml @@ -8,6 +8,6 @@ jobs: steps: - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-actions/actions/terraform@main + uses: oaknational/oak-terrform-actions/actions/terraform@main with: example_input: "value" From 53266c7b5fa2981680b912ff0b991303e27d3ef3 Mon Sep 17 00:00:00 2001 From: Tristan Watson Date: Thu, 8 Aug 2024 15:59:07 +0100 Subject: [PATCH 8/8] fix(actions, docs): Fixing action to be action - not workflow syntax, improving docs, removing versioning as this is done via setup --- .github/{workflows => workflows/yaml-lint.yml} | 2 +- README.md | 18 +++++++++++------- .../{terraform => terraform-checks}/action.yml | 11 ++--------- examples/define-version/action.yml | 12 ------------ examples/general-use/README.md | 2 +- .../{action.yml => terraform-checks.yml} | 9 +++++---- 6 files changed, 20 insertions(+), 34 deletions(-) rename .github/{workflows => workflows/yaml-lint.yml} (92%) rename actions/{terraform => terraform-checks}/action.yml (78%) delete mode 100644 examples/define-version/action.yml rename examples/general-use/{action.yml => terraform-checks.yml} (56%) diff --git a/.github/workflows b/.github/workflows/yaml-lint.yml similarity index 92% rename from .github/workflows rename to .github/workflows/yaml-lint.yml index f2ea17e..ea0464d 100644 --- a/.github/workflows +++ b/.github/workflows/yaml-lint.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v2 diff --git a/README.md b/README.md index f206178..6edfee1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # oak-terraform-actions -The `actions` folder is designed to house reusable GitHub Actions, making it easy to manage and share automation across different repositories. Each subfolder within `actions` contains a specific action with all necessary files and documentation. +The `actions` folder is designed to house reusable GitHub Actions for **Terraform**, making it easy to manage and share automation across different repositories. See the Example folder to get started. #### Structure ```plaintext actions/ -β”œβ”€β”€ terraform/ +β”œβ”€β”€ terraform-checks/ β”‚ β”œβ”€β”€ action.yml β”‚ β”œβ”€β”€ scripts/ (if any) β”‚ └── README.md @@ -14,20 +14,22 @@ actions/ ### Terraform Actions 🌍 -**Location:** `actions/terraform` +#### Terraform Checks -**Purpose:** The Terraform action automates Terraform workflows, including applying infrastructure as code configurations. +**Location:** `actions/terraform-checks` + +**Purpose:** The Terraform Github Action checks your code fits the Oak standards. #### Key Features - **Infrastructure Management:** Streamlines Terraform commands in CI/CD pipelines. - **Ease of Use:** Integrates seamlessly with your GitHub workflows. -- **Customizable:** Accepts input parameters for flexible operation. ### How to Use ```yaml -name: Terraform Check +# Example Github Workflow file to run Terraform Check action +name: Terraform Checks on: [push, pull_request] @@ -36,8 +38,10 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-terraform-actions/actions/terraform@main + uses: oaknational/oak-terrform-actions/actions/terraform-checks@main ``` For more details, visit the [Oak Terraform Actions repository](https://github.com/oaknational/oak-terraform-actions). diff --git a/actions/terraform/action.yml b/actions/terraform-checks/action.yml similarity index 78% rename from actions/terraform/action.yml rename to actions/terraform-checks/action.yml index f5d040a..196d43f 100644 --- a/actions/terraform/action.yml +++ b/actions/terraform-checks/action.yml @@ -1,18 +1,11 @@ name: "Terraform Checks" description: "Perform common Terraform checks" -inputs: - terraform_version: - description: "Terraform version to use" - required: false - default: "1.5.7" + runs: using: "composite" steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 + uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ inputs.terraform_version }} diff --git a/examples/define-version/action.yml b/examples/define-version/action.yml deleted file mode 100644 index 04facff..0000000 --- a/examples/define-version/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Terraform Check - With Defined Version - -on: [push, pull_request] - -jobs: - terraform-checks: - runs-on: ubuntu-latest - steps: - - name: Run Terraform Checks Action from oak-terraform-actions - uses: oaknational/oak-terraform-actions/actions/terraform-checks@main - with: - terraform_version: 1.5.7 # or any other version as needed diff --git a/examples/general-use/README.md b/examples/general-use/README.md index b2198fe..4bbc318 100644 --- a/examples/general-use/README.md +++ b/examples/general-use/README.md @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions uses: oaknational/oak-terraform-actions/actions/terraform@main diff --git a/examples/general-use/action.yml b/examples/general-use/terraform-checks.yml similarity index 56% rename from examples/general-use/action.yml rename to examples/general-use/terraform-checks.yml index 0634c8c..42fa80a 100644 --- a/examples/general-use/action.yml +++ b/examples/general-use/terraform-checks.yml @@ -1,4 +1,5 @@ -name: Terraform Check +# Example Github Workflow file to run Terraform Check action +name: Terraform Checks on: [push, pull_request] @@ -7,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 - name: Run Terraform Action from oak-terraform-actions - uses: oaknational/oak-terrform-actions/actions/terraform@main - with: - example_input: "value" + uses: oaknational/oak-terrform-actions/actions/terraform-checks@main