Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 1d0543f

Browse files
authored
Merge pull request #3 from BCDevOps/add-gha-workflows
add gha workflows
2 parents f9441a0 + 3efe921 commit 1d0543f

File tree

7 files changed

+119
-26
lines changed

7 files changed

+119
-26
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Generate terraform docs
2+
on:
3+
- pull_request
4+
jobs:
5+
docs:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
with:
10+
ref: ${{ github.event.pull_request.head.ref }}
11+
12+
- name: Render terraform docs inside the README.md and push changes back to PR branch
13+
uses: terraform-docs/gh-actions@v1.0.0
14+
with:
15+
working-dir: .
16+
output-file: README.md
17+
output-method: inject
18+
git-push: "true"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: terraform format check
2+
on:
3+
- pull_request
4+
jobs:
5+
format:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- uses: hashicorp/setup-terraform@v2
10+
11+
- name: terraform fmt
12+
run: terraform fmt -check -recursive -diff
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: terraform validate
2+
on:
3+
- pull_request
4+
jobs:
5+
validate:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- uses: hashicorp/setup-terraform@v2
10+
11+
- name: terraform init
12+
run: terraform init -input=false -backend=false
13+
14+
- name: terraform validate
15+
run: terraform validate

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,56 @@ This repo provides a starting point for users who want to create valid Terraform
1414
- [x] Development
1515
- [ ] Production/Maintenance
1616

17-
## Documentation
18-
<!--- Point to another readme or create a GitHub Pages (https://guides.github.com/features/pages/) --->
17+
# Documentation
18+
19+
<!-- BEGIN_TF_DOCS -->
20+
## Requirements
21+
22+
| Name | Version |
23+
|------|---------|
24+
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | ~> 0.23.0 |
25+
26+
## Providers
27+
28+
| Name | Version |
29+
|------|---------|
30+
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | ~> 0.23.0 |
31+
32+
## Modules
33+
34+
No modules.
35+
36+
## Resources
37+
38+
| Name | Type |
39+
|------|------|
40+
| [tfe_team.team](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/team) | resource |
41+
| [tfe_team_access.team_access](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/team_access) | resource |
42+
| [tfe_team_token.team_token](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/team_token) | resource |
43+
| [tfe_variable.aws_access_key_id](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
44+
| [tfe_variable.aws_secret_access_key](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
45+
| [tfe_variable.aws_target_account_id](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
46+
| [tfe_variable.aws_target_env](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) | resource |
47+
| [tfe_workspace.extra_workspaces](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace) | resource |
48+
| [tfe_workspace.workspaces](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace) | resource |
49+
50+
## Inputs
51+
52+
| Name | Description | Type | Default | Required |
53+
|------|-------------|------|---------|:--------:|
54+
| <a name="input_access_key_id"></a> [access\_key\_id](#input\_access\_key\_id) | An AWS access key id. | `string` | `null` | no |
55+
| <a name="input_execution_mode"></a> [execution\_mode](#input\_execution\_mode) | Terraform 'execution mode' - either 'remote' or 'local'. See TFC docs for description of each. | `string` | `"remote"` | no |
56+
| <a name="input_organization"></a> [organization](#input\_organization) | The name of the Terraform Cloud / Enterprise organization in which the workspace and other resources should be created. | `string` | n/a | yes |
57+
| <a name="input_project_accounts"></a> [project\_accounts](#input\_project\_accounts) | The set of AWS project accounts for which we want to create TFC workspaces. | `any` | `null` | no |
58+
| <a name="input_project_definition_file_path"></a> [project\_definition\_file\_path](#input\_project\_definition\_file\_path) | Full path to JSON file containing project definition structure. (project.json by convention) | `string` | `"project.json"` | no |
59+
| <a name="input_secret_access_key"></a> [secret\_access\_key](#input\_secret\_access\_key) | An AWS secret access key. | `string` | `null` | no |
60+
| <a name="input_team_access_level"></a> [team\_access\_level](#input\_team\_access\_level) | The value indicating the level of access (permission set) that the TF Cloud team being created should have in the workspace being created. | `string` | `"plan"` | no |
61+
| <a name="input_tfc_token"></a> [tfc\_token](#input\_tfc\_token) | Token with administrative access to Terraform cloud organization targeted by the module. | `string` | n/a | yes |
62+
63+
## Outputs
64+
65+
No outputs.
66+
<!-- END_TF_DOCS -->
1967

2068
## Getting Started
2169
<!--- setup env vars, secrets, instructions... --->

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
provider "tfe" {
2-
token = var.tfc_token
2+
token = var.tfc_token
33
}
44
locals {
55
project = jsondecode(file(var.project_definition_file_path))

variables.tf

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11

22
variable "project_definition_file_path" {
3-
default = "project.json"
4-
description = "Full path to JSON file containing project definition structure. (project.json by convention)"
5-
type = string
3+
default = "project.json"
4+
description = "Full path to JSON file containing project definition structure. (project.json by convention)"
5+
type = string
66
}
77

88
variable "organization" {
9-
type = string
10-
description = "The name of the Terraform Cloud / Enterprise organization in which the workspace and other resources should be created."
9+
type = string
10+
description = "The name of the Terraform Cloud / Enterprise organization in which the workspace and other resources should be created."
1111
}
1212

1313
variable "tfc_token" {
14-
type = string
15-
description = "Token with administrative access to Terraform cloud organization targeted by the module."
14+
type = string
15+
description = "Token with administrative access to Terraform cloud organization targeted by the module."
1616
}
1717

1818
variable "team_access_level" {
19-
type = string
20-
default = "plan"
21-
description = "The value indicating the level of access (permission set) that the TF Cloud team being created should have in the workspace being created."
19+
type = string
20+
default = "plan"
21+
description = "The value indicating the level of access (permission set) that the TF Cloud team being created should have in the workspace being created."
2222
}
2323

2424
variable "secret_access_key" {
25-
description = "An AWS secret access key."
26-
type = string
27-
default = null
25+
description = "An AWS secret access key."
26+
type = string
27+
default = null
2828
}
2929

3030
variable "access_key_id" {
31-
description = "An AWS access key id."
32-
type = string
33-
default = null
31+
description = "An AWS access key id."
32+
type = string
33+
default = null
3434
}
3535

3636
variable "execution_mode" {
37-
description = "Terraform 'execution mode' - either 'remote' or 'local'. See TFC docs for description of each."
38-
type = string
39-
default = "remote"
37+
description = "Terraform 'execution mode' - either 'remote' or 'local'. See TFC docs for description of each."
38+
type = string
39+
default = "remote"
4040
}
4141

4242
variable "project_accounts" {
43-
description = "The set of AWS project accounts for which we want to create TFC workspaces."
44-
type = any
45-
default = null
43+
description = "The set of AWS project accounts for which we want to create TFC workspaces."
44+
type = any
45+
default = null
4646
}
4747

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
tfe = {
4-
source = "hashicorp/tfe"
4+
source = "hashicorp/tfe"
55
version = "~> 0.23.0"
66
}
77
}

0 commit comments

Comments
 (0)