generated from aws-ia/terraform-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from oleksiimorozenko/main
Make VCS repo settings and variable sets configurable by workspace
- Loading branch information
Showing
13 changed files
with
177 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ terraform { | |
|
||
required_providers { | ||
tfe = { | ||
version = "~> 0.48" | ||
version = "~> 0.51" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This example shows how to change default VCS setting behavior | ||
By default, if `vcs_repo` variable is set, VCS is enabled across all the workspaces | ||
In case if it needs to be customized, there are two options: | ||
- set `vcs_repo_enable` to `false` to not enable VCS at all | ||
- set `vcs_repo` within particular workspace to enable VCS with custom settings (e.g. repository, branch, token etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
This example shows how to change default VCS setting behavior | ||
By default, if `vcs_repo` variable is set, VCS is enabled across all the workspaces | ||
In case if it needs to be customized, there are two options: | ||
- set `vcs_repo_enable` to `false` to not enable VCS at all | ||
- set `vcs_repo` within particular workspace to enable VCS with custom settings (e.g. repository, branch, token etc.) | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.2.2 | | ||
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | ~> 0.51 | | ||
|
||
## Providers | ||
|
||
No providers. | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_multi_region_deployment"></a> [multi\_region\_deployment](#module\_multi\_region\_deployment) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
No resources. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_organization"></a> [organization](#input\_organization) | n/a | `any` | n/a | yes | | ||
| <a name="input_vcs_repo"></a> [vcs\_repo](#input\_vcs\_repo) | Definition of the VCS repo to attach to every workspace. | <pre>object({<br> branch = optional(string)<br> github_app_installation_id = optional(string)<br> identifier = string<br> ingress_submodules = optional(bool)<br> oauth_token_id = optional(string)<br> })</pre> | `null` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_workspace_attrributes"></a> [workspace\_attrributes](#output\_workspace\_attrributes) | n/a | | ||
| <a name="output_workspace_ids"></a> [workspace\_ids](#output\_workspace\_ids) | n/a | | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
##################################################################################### | ||
# Terraform module examples are meant to show an _example_ on how to use a module | ||
# per use-case. The code below should not be copied directly but referenced in order | ||
# to build your own root module that invokes this module | ||
##################################################################################### | ||
|
||
module "multi_region_deployment" { | ||
source = "../.." | ||
|
||
organization = var.organization | ||
|
||
vcs_repo = { | ||
identifier = "orgname/repo" | ||
oauth_token_id = "ot-0AuTH_T0kEn_1D" | ||
branch = "some_branch" # Can be omitted, the default branch will be used (https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace#branch) | ||
} | ||
|
||
workspaces = { | ||
eastcoast = { | ||
vars = { | ||
AWS_REGION = { | ||
value = "us-east-1" | ||
} | ||
} | ||
} | ||
westcoast = {} | ||
# This workspace will not enable VCS | ||
disabled_vcs = { | ||
vcs_repo_enable = false | ||
} | ||
# This workspace will enable VCS but not inherit VCS general settings | ||
custom_vcs = { | ||
vcs_repo = { | ||
identifier = "orgname/other_repo" | ||
oauth_token_id = "ot-0AuTH_T0kEn_1D" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "workspace_ids" { | ||
value = [for ws in module.multi_region_deployment.workspaces_attributes : | ||
ws.id | ||
] | ||
} | ||
|
||
output "workspace_attrributes" { | ||
value = module.multi_region_deployment.workspaces_attributes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = ">= 1.2.2" | ||
|
||
required_providers { | ||
tfe = { | ||
version = "~> 0.51" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# variable "workspace_name" { | ||
# default = { | ||
# value = "test" | ||
# category = "terraform" | ||
# } | ||
# } | ||
|
||
variable "vcs_repo" { | ||
description = "Definition of the VCS repo to attach to every workspace." | ||
default = null | ||
|
||
type = object({ | ||
branch = optional(string) | ||
github_app_installation_id = optional(string) | ||
identifier = string | ||
ingress_submodules = optional(bool) | ||
oauth_token_id = optional(string) | ||
}) | ||
} | ||
|
||
variable "organization" {} | ||
# variable "creds_variable_set_name" {} | ||
# variable "shared_variable_set" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ terraform { | |
} | ||
tfe = { | ||
source = "hashicorp/tfe" | ||
version = ">= 0.44.0" | ||
version = ">= 0.51.1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters