Skip to content

Commit

Permalink
feat: Add new module to pull variable set
Browse files Browse the repository at this point in the history
  • Loading branch information
aramkarapetian committed Sep 20, 2023
1 parent 89133d1 commit bf2b56d
Show file tree
Hide file tree
Showing 16 changed files with 280 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ After another apply is run from local and resulting code is comitted to git repo

| Name | Version |
|------|---------|
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.47.0 |
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | ~> 0.40 |

## Modules

Expand All @@ -106,11 +106,12 @@ After another apply is run from local and resulting code is comitted to git repo

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_auto_apply"></a> [auto\_apply](#input\_auto\_apply) | To have workspaces automatically apply after plan is done successfully. | `bool` | `false` | no |
| <a name="input_aws"></a> [aws](#input\_aws) | Cloud Access (goes to shared variable set, should be adjusted) | `map(any)` | <pre>{<br> "access_key_id": "",<br> "default_region": "",<br> "secret_access_key": ""<br>}</pre> | no |
| <a name="input_git_org"></a> [git\_org](#input\_git\_org) | The github org/owner name | `string` | n/a | yes |
| <a name="input_git_provider"></a> [git\_provider](#input\_git\_provider) | The vsc(github, gitlab, ...) provider id | `string` | `"gitlab"` | no |
| <a name="input_git_repo"></a> [git\_repo](#input\_git\_repo) | The github repo name without org prefix | `string` | n/a | yes |
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | The vsc(github, gitlab, ...) personal access token | `string` | n/a | yes |
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | The vsc(github, gitlab, ...) personal access token. TFC oauth token can be created manually or externally and oken supplied via this variable. | `string` | n/a | yes |
| <a name="input_org"></a> [org](#input\_org) | The terraform cloud org name | `string` | n/a | yes |
| <a name="input_rootdir"></a> [rootdir](#input\_rootdir) | The directory on git repo where the workspaces creator main.tf file located | `string` | `"./_terraform/"` | no |
| <a name="input_targetdir"></a> [targetdir](#input\_targetdir) | The directory where tf cloud workspace corresponding workspaces will be created | `string` | `"./../_terraform/"` | no |
Expand Down
40 changes: 40 additions & 0 deletions modules/variable-set-reader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# variable-set-reader

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | ~> 0.40 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | ~> 0.40 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [tfe_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/variable_set) | data source |
| [tfe_variables.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/variables) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_name"></a> [name](#input\_name) | Terraform cloud variable set name | `string` | n/a | yes |
| <a name="input_org"></a> [org](#input\_org) | The terraform cloud organization name where variable set and variables will be created | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_values"></a> [values](#output\_values) | n/a |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8 changes: 8 additions & 0 deletions modules/variable-set-reader/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data "tfe_variable_set" "this" {
name = var.name
organization = var.org
}

data "tfe_variables" "this" {
variable_set_id = data.tfe_variable_set.this.id
}
4 changes: 4 additions & 0 deletions modules/variable-set-reader/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "values" {
value = data.tfe_variables.this.variables
sensitive = true
}
13 changes: 13 additions & 0 deletions modules/variable-set-reader/tests/basic/0-setup.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
test = {
source = "terraform.io/builtin/test"
}

tfe = {
version = "~> 0.40"
}
}

required_version = ">= 1.3.0"
}
5 changes: 5 additions & 0 deletions modules/variable-set-reader/tests/basic/1-example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "basic" {
source = "../.."
name = "some-test-variable-set"
org = "dasmeta-testing"
}
32 changes: 32 additions & 0 deletions modules/variable-set-reader/tests/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# basic

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | ~> 0.40 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_basic"></a> [basic](#module\_basic) | ../.. | n/a |

## Resources

No resources.

## Inputs

No inputs.

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
9 changes: 9 additions & 0 deletions modules/variable-set-reader/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "name" {
type = string
description = "Terraform cloud variable set name"
}

variable "org" {
type = string
description = "The terraform cloud organization name where variable set and variables will be created"
}
9 changes: 9 additions & 0 deletions modules/variable-set-reader/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.3.0"

required_providers {
tfe = {
version = "~> 0.40"
}
}
}
1 change: 1 addition & 0 deletions modules/workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ git config core.hooksPath githooks

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_auto_apply"></a> [auto\_apply](#input\_auto\_apply) | To have workspaces automatically apply after plan is done successfully. | `bool` | `false` | no |
| <a name="input_linked_workspaces"></a> [linked\_workspaces](#input\_linked\_workspaces) | The list of workspaces from where we can pull outputs and use in our module variables | `list(string)` | `null` | no |
| <a name="input_module_providers"></a> [module\_providers](#input\_module\_providers) | The list of providers to add in providers.tf | `any` | `[]` | no |
| <a name="input_module_source"></a> [module\_source](#input\_module\_source) | The module source | `string` | n/a | yes |
Expand Down
27 changes: 27 additions & 0 deletions modules/workspace/playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# playground

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

No modules.

## Resources

No resources.

## Inputs

No inputs.

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32 changes: 32 additions & 0 deletions tests/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# basic

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_basic"></a> [basic](#module\_basic) | ../.. | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | n/a | `any` | n/a | yes |
| <a name="input_tfc_token"></a> [tfc\_token](#input\_tfc\_token) | n/a | `any` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32 changes: 32 additions & 0 deletions tests/bitbucket/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# bitbucket

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_basic"></a> [basic](#module\_basic) | ../.. | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | n/a | `any` | n/a | yes |
| <a name="input_tfc_token"></a> [tfc\_token](#input\_tfc\_token) | n/a | `any` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32 changes: 32 additions & 0 deletions tests/debug-escape-issue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# debug-escape-issue

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_basic"></a> [basic](#module\_basic) | ../.. | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | n/a | `any` | n/a | yes |
| <a name="input_tfc_token"></a> [tfc\_token](#input\_tfc\_token) | n/a | `any` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32 changes: 32 additions & 0 deletions tests/kube-helm-provider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# kube-helm-provider

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_basic"></a> [basic](#module\_basic) | ../.. | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_git_token"></a> [git\_token](#input\_git\_token) | n/a | `any` | n/a | yes |
| <a name="input_tfc_token"></a> [tfc\_token](#input\_tfc\_token) | n/a | `any` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2 changes: 1 addition & 1 deletion tests/kube-helm-provider/eks-data.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source: dasmeta/eks/aws//modules/eks-data
version: 2.7.2
variables:
cluster_name: stage-6
cluster_name: stage-6
providers:
- name: aws
version: ">= 4.0"
Expand Down

0 comments on commit bf2b56d

Please sign in to comment.