|
| 1 | +# Github Foundations CLI |
| 2 | +A command-line tool for the Github Foundations framework. |
| 3 | + |
| 4 | +## Table of Contents |
| 5 | + |
| 6 | +- [Usage](#usage) |
| 7 | + - [Generate](#generate) |
| 8 | + - [Import](#import) |
| 9 | + - [Check](#check) |
| 10 | + - [List](#list) |
| 11 | + - [Help](#help) |
| 12 | +- [Installation](#installation) |
| 13 | + - [From releases](#from-releases) |
| 14 | + - [Linux](#linux) |
| 15 | + - [MacOS](#macos) |
| 16 | + - [Windows](#windows) |
| 17 | + - [From source](#from-source) |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +There are a few main tools provided by the Github Foundations CLI: |
| 22 | + |
| 23 | +``` |
| 24 | +Usage: |
| 25 | + github-foundations-cli [command] |
| 26 | +
|
| 27 | +Available Commands: |
| 28 | + gen Generate HCL input for GitHub Foundations. |
| 29 | + import Starts an interactive import process for resources in a Terraform plan. |
| 30 | + check Perform checks against a Github configuration. |
| 31 | + list List various resources managed by the tool. |
| 32 | + help Help about any command. |
| 33 | +
|
| 34 | +Flags: |
| 35 | + -h, -- help help for github-foundations-cli |
| 36 | +``` |
| 37 | + |
| 38 | +### Generate |
| 39 | + |
| 40 | +#### Generate using the Interactive mode |
| 41 | + |
| 42 | +This command is used to generate HCL input for GitHub Foundations. This tool is used to generate HCL input for GitHub Foundations from state files output by terraformer. |
| 43 | + |
| 44 | +``` |
| 45 | +Usage: |
| 46 | + github-foundations-cli gen <resource> |
| 47 | +``` |
| 48 | + |
| 49 | +Where `<resource>` is one of the following: |
| 50 | +- `repository_set` |
| 51 | + |
| 52 | +Use `Shift + →` (right arrow) and `Shift + ←` (left arrow) to navigate through the questions. |
| 53 | + |
| 54 | +Click on `Submit` to generate the HCL file. |
| 55 | + |
| 56 | +### Import |
| 57 | + |
| 58 | +This command will start an interactive process to import resources into Terraform state. It uses the results of a terraform plan to determine which resources are available for import. |
| 59 | + |
| 60 | +``` |
| 61 | +Usage: |
| 62 | + github-foundations-cli import [module_path] |
| 63 | +
|
| 64 | +``` |
| 65 | + |
| 66 | +Where `<module_path>` is the path to the Terragrunt module to import. |
| 67 | + |
| 68 | +### Check |
| 69 | + |
| 70 | +Perform checks against a Github configuration and generate reports. This is used to validate the compliance stance of your GitHub configuration. |
| 71 | + |
| 72 | +``` |
| 73 | + Usage: |
| 74 | + github-foundations-cli check <org-slug> |
| 75 | +
|
| 76 | +``` |
| 77 | + |
| 78 | +Where `<org-slug>` is the organization slug to check. |
| 79 | + |
| 80 | +### List |
| 81 | + |
| 82 | +list various resources managed by the tool. |
| 83 | + |
| 84 | + |
| 85 | +``` |
| 86 | + Usage: |
| 87 | + github-foundations-cli list <resource> [options] [ProjectsDirectory|OrganzationsDirectory] |
| 88 | +
|
| 89 | +``` |
| 90 | + |
| 91 | +Where `<resource>` is one of the following: |
| 92 | +- repos |
| 93 | +- orgs |
| 94 | + |
| 95 | + |
| 96 | +`[ProjectsDirectory]` is the path to the Terragrunt `Projects` directory when listing `repos`. |
| 97 | + |
| 98 | +`[OrganzationsDirectory]` is the path to the Terragrunt `OrganzationsDirectory` directory when listing `orgs`. |
| 99 | + |
| 100 | +`[options]` is a list of options to filter the list of resources. The options are: |
| 101 | +- repos: |
| 102 | + - `--ghas`, `-g` List repositories with GHAS enabled. |
| 103 | + |
| 104 | +### Help |
| 105 | + |
| 106 | +Display help for the tool. |
| 107 | + |
| 108 | +## Installation |
| 109 | + |
| 110 | +### From releases |
| 111 | +Download the latest release from the [releases page](http:github.com/canada-ca/fondations-github-foundations/releases) and run the following commands: |
| 112 | + |
| 113 | + |
| 114 | +#### Linux |
| 115 | + |
| 116 | +**ADM64** |
| 117 | +``` |
| 118 | +curl -LO https://github.com/canada-ca/fondations-github-foundations/releases/latest/download/github-foundations-cli_Linux_x86_64.tar.gz |
| 119 | +tar -xzf github-foundations-cli_Linux_x86_64.tar.gz |
| 120 | +chmod +x github-foundations-cli |
| 121 | +sudo mv github-foundations-cli /usr/local/bin |
| 122 | +``` |
| 123 | + |
| 124 | +**ARM64** |
| 125 | +``` |
| 126 | +curl -LO https://github.com/canada-ca/fondations-github-foundations/releases/latest/download/github-foundations-cli_Linux_arm64.tar.gz |
| 127 | +tar -xzf github-foundations-cli_Linux_arm64.tar.gz |
| 128 | +chmod +x github-foundations-cli |
| 129 | +sudo mv github-foundations-cli /usr/local/bin |
| 130 | +``` |
| 131 | + |
| 132 | +#### MacOS |
| 133 | + |
| 134 | +**ADM64** |
| 135 | +``` |
| 136 | +curl -LO https://github.com/canada-ca/fondations-github-foundations/releases/latest/download/github-foundations-cli_Darwin_x86_64.tar.gz |
| 137 | +tar -xzf github-foundations-cli_Darwin_x86_64.tar.gz |
| 138 | +chmod +x github-foundations-cli |
| 139 | +sudo mv github-foundations-cli /usr/local/bin |
| 140 | +``` |
| 141 | + |
| 142 | +**ARM64** |
| 143 | +``` |
| 144 | +curl -LO https://github.com/canada-ca/fondations-github-foundations/releases/latest/download/github-foundations-cli_Darwin_arm64.tar.gz |
| 145 | +tar -xzf github-foundations-cli_Darwin_arm64.tar.gz |
| 146 | +chmod +x github-foundations-cli |
| 147 | +sudo mv github-foundations-cli /usr/local/bin |
| 148 | +``` |
| 149 | + |
| 150 | +#### Windows |
| 151 | + |
| 152 | +--- |
| 153 | +**i386** |
| 154 | + |
| 155 | +1. Download the [latest release here](https://github.com/canada-ca/fondations-github-foundations/releases/download/v0.0.5/github-foundations-cli_Windows_i386.zip) |
| 156 | + |
| 157 | +**ADM64** |
| 158 | +1. Download the [latest release here](https://github.com/canada-ca/fondations-github-foundations/releases/download/v0.0.5/github-foundations-cli_Windows_i386.zip) |
| 159 | + |
| 160 | +**ARM64** |
| 161 | +1. Download the [latest release here](https://github.com/canada-ca/fondations-github-foundations/releases/download/v0.0.5/github-foundations-cli_Windows_i386.zip) |
| 162 | +--- |
| 163 | + |
| 164 | +2. Unzip the package |
| 165 | +3. Place the `github-foundations-cli.exe` executable in a directory of your choice, for example: `%USERPROFILE%\gh-foundations` |
| 166 | + |
| 167 | +* **Add to Path (Optional):** |
| 168 | +4. Right-click on "This PC" and select "Properties". |
| 169 | +5. Click on "Advanced system settings". |
| 170 | +6. Click on the "Environment Variables" button. |
| 171 | +7. Under "System variables", find the "Path" variable and click "Edit". |
| 172 | +8. Click "New" and add the following path: `%USERPROFILE%\gh-foundations` (replace with your chosen directory) |
| 173 | +9. Click "OK" on all open windows to save the changes. |
| 174 | + |
| 175 | +### From source |
| 176 | +1. Run `git clone git@github.com:canada-ca/fondations-github-foundations && cd github-foundations-cli/` |
| 177 | +2. Run `go mod download` |
| 178 | +3. Run `go build -v` for all providers OR build with one provider |
0 commit comments