-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
169 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# project | ||
|
||
This module creates following resources. | ||
|
||
- `tfe_project` | ||
- `tfe_project_policy_set` (optional) | ||
- `tfe_project_variable_set` (optional) | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 | | ||
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | >= 0.53 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_tfe"></a> [tfe](#provider\_tfe) | 0.54.0 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [tfe_project.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/project) | resource | | ||
| [tfe_project_policy_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/project_policy_set) | resource | | ||
| [tfe_project_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/project_variable_set) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the project. | `string` | n/a | yes | | ||
| <a name="input_description"></a> [description](#input\_description) | (Optional) A description to help you identify the project. | `string` | `"Managed by Terraform."` | no | | ||
| <a name="input_organization"></a> [organization](#input\_organization) | (Optional) A name of the organization. If omitted, organization must be defined in the provider config. | `string` | `null` | no | | ||
| <a name="input_policy_set"></a> [policy\_set](#input\_policy\_set) | (Optional) The ID of the policy set to configure. | `string` | `null` | no | | ||
| <a name="input_variable_set"></a> [variable\_set](#input\_variable\_set) | (Optional) A name of the variable set to configure. | `string` | `null` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_description"></a> [description](#output\_description) | The description of the project. | | ||
| <a name="output_id"></a> [id](#output\_id) | The ID of the project. | | ||
| <a name="output_name"></a> [name](#output\_name) | The name of the project. | | ||
| <a name="output_organization"></a> [organization](#output\_organization) | The name of the organization. | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
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,34 @@ | ||
################################################### | ||
# Project in Terraform Enterprise | ||
################################################### | ||
|
||
resource "tfe_project" "this" { | ||
organization = var.organization | ||
|
||
name = var.name | ||
description = var.description | ||
} | ||
|
||
|
||
################################################### | ||
# Policy Set for Project | ||
################################################### | ||
|
||
resource "tfe_project_policy_set" "this" { | ||
count = var.policy_set != null ? 1 : 0 | ||
|
||
project_id = tfe_project.this.id | ||
policy_set_id = var.policy_set | ||
} | ||
|
||
|
||
################################################### | ||
# Variable Set for Project | ||
################################################### | ||
|
||
resource "tfe_project_variable_set" "this" { | ||
count = var.variable_set != null ? 1 : 0 | ||
|
||
project_id = tfe_project.this.id | ||
variable_set_id = var.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
output "id" { | ||
description = "The ID of the project." | ||
value = tfe_project.this.id | ||
} | ||
|
||
output "organization" { | ||
description = "The name of the organization." | ||
value = tfe_project.this.organization | ||
} | ||
|
||
output "name" { | ||
description = "The name of the project." | ||
value = tfe_project.this.name | ||
} | ||
|
||
output "description" { | ||
description = "The description of the project." | ||
value = tfe_project.this.description | ||
} | ||
|
||
# output "debug" { | ||
# value = { | ||
# for k, v in tfe_project.this : | ||
# k => v | ||
# if !contains(["name", "id", "organization", "description"], k) | ||
# } | ||
# } | ||
|
||
# output "debug2" { | ||
# value = tfe_project_policy_set.this | ||
# } | ||
# | ||
# output "debug3" { | ||
# value = tfe_project_variable_set.this | ||
# } |
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,37 @@ | ||
variable "organization" { | ||
description = "(Optional) A name of the organization. If omitted, organization must be defined in the provider config." | ||
type = string | ||
default = null | ||
nullable = true | ||
} | ||
|
||
variable "name" { | ||
description = "(Required) The name of the project." | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "description" { | ||
description = "(Optional) A description to help you identify the project." | ||
type = string | ||
default = "Managed by Terraform." | ||
nullable = false | ||
} | ||
|
||
variable "policy_set" { | ||
description = <<EOF | ||
(Optional) The ID of the policy set to configure. | ||
EOF | ||
type = string | ||
default = null | ||
nullable = true | ||
} | ||
|
||
variable "variable_set" { | ||
description = <<EOF | ||
(Optional) A name of the variable set to configure. | ||
EOF | ||
type = string | ||
default = null | ||
nullable = true | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = ">= 1.6" | ||
|
||
required_providers { | ||
tfe = { | ||
source = "hashicorp/tfe" | ||
version = ">= 0.53" | ||
} | ||
} | ||
} |