Skip to content

Commit

Permalink
Merge pull request #1 from dhoppeIT/add_resources
Browse files Browse the repository at this point in the history
Manage the following Terraform resources
  • Loading branch information
dhoppe authored Nov 30, 2021
2 parents 1dd6f2a + ceaaa62 commit 01bbc5c
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
repository:
name: terraform-root-module
description: Terraform module to manage the FIXME resources
homepage: https://github.com/dhoppeIT/terraform-FIXME-config
topics: terraform, FIXME
private: true
description: Terraform module to manage the Terraform Cloud/Enterprise resources
homepage: https://github.com/dhoppeIT/terraform-tfe-config
topics: terraform, tfe
private: false
has_issues: true
has_projects: false
has_wiki: false
Expand Down
21 changes: 21 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 96 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,112 @@
# FIXME
# terraform-tfe-config

Terraform module to manage the FIXME resources.
Terraform module to manage the Terraform Cloud/Enterprise resources.

## Graph

![Graph](https://github.com/dhoppeIT/FIXME/blob/main/rover.png)
![Graph](https://github.com/dhoppeIT/terraform-tfe-config/blob/main/rover.png)

## Usage

Copy and paste into your Terraform configuration, insert the variables and run ```terraform init```:

```hcl
module "FIXME" {
source = "dhoppeIT/FIXME/tfe"
...
module "tfe-organization" {
source = "dhoppeIT/organization/tfe"
name = "dhoppeIT"
email = "[email protected]"
}
module "tfe-oauth_client" {
source = "dhoppeIT/oauth_client/tfe"
organization = module.tfe-organization.name
api_url = "https://api.github.com"
http_url = "https://github.com"
oauth_token = "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"
service_provider = "github"
}
module "tfe-workspace" {
source = "dhoppeIT/workspace/tfe"
name = "terraform"
organization = module.tfe-organization.name
}
module "tfe-variable" {
source = "dhoppeIT/variable/tfe"
key = "TFE_TOKEN"
value = module.tfe-oauth_client.oauth_token_id
category = "env"
description = "The token used to authenticate with Terraform Cloud/Enterprise"
sensitive = true
workspace_id = module.tfe-workspace.id
}
module "tfe-notification" {
source = "dhoppeIT/notification/tfe"
name = "slack"
enabled = true
destination_type = "slack"
triggers = [
"run:needs_attention",
"run:errored"
]
url = "https://hooks.slack.com/services/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"
workspace_id = module.tfe-workspace.id
}
module "tfe-registry" {
source = "dhoppeIT/registry/tfe"
display_identifier = "dhoppeIT/terraform-tfe-registry"
identifier = "dhoppeIT/terraform-tfe-registry"
oauth_token_id = module.tfe-oauth_client.oauth_token_id
}
```

<!--- BEGIN_TF_DOCS --->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_tfe"></a> [tfe](#requirement\_tfe) | >= 0.26.1, < 1.0.0 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_tfe-notification"></a> [tfe-notification](#module\_tfe-notification) | dhoppeIT/notification/tfe | n/a |
| <a name="module_tfe-oauth_client"></a> [tfe-oauth\_client](#module\_tfe-oauth\_client) | dhoppeIT/oauth_client/tfe | n/a |
| <a name="module_tfe-organization"></a> [tfe-organization](#module\_tfe-organization) | dhoppeIT/organization/tfe | n/a |
| <a name="module_tfe-registry"></a> [tfe-registry](#module\_tfe-registry) | dhoppeIT/registry/tfe | n/a |
| <a name="module_tfe-variable"></a> [tfe-variable](#module\_tfe-variable) | dhoppeIT/variable/tfe | n/a |
| <a name="module_tfe-workspace"></a> [tfe-workspace](#module\_tfe-workspace) | dhoppeIT/workspace/tfe | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | The token used to authenticate with GitHub | `string` | `null` | no |
| <a name="input_slack_webhook_url"></a> [slack\_webhook\_url](#input\_slack\_webhook\_url) | The destination URL used to send Slack notifications | `string` | `null` | no |

## Outputs

No outputs.

<!--- END_TF_DOCS --->

## Authors
Expand All @@ -26,4 +115,4 @@ Created and maintained by [Dennis Hoppe](https://github.com/dhoppeIT/).

## License

Apache 2 licensed. See [LICENSE](https://github.com/dhoppeIT/FIXME/blob/main/LICENSE) for full details.
Apache 2 licensed. See [LICENSE](https://github.com/dhoppeIT/terraform-tfe-config/blob/main/LICENSE) for full details.
2 changes: 1 addition & 1 deletion backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
organization = "dhoppeIT"

workspaces {
name = "FIXME"
name = "terraform"
}
}
}
45 changes: 45 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
locals {
modules = {
"tfe-notification" = {
display_identifier = "dhoppeIT/terraform-tfe-notification"
identifier = "dhoppeIT/terraform-tfe-notification"
},
"tfe-oauth_client" = {
display_identifier = "dhoppeIT/terraform-tfe-oauth_client"
identifier = "dhoppeIT/terraform-tfe-oauth_client"
},
"tfe-organization" = {
display_identifier = "dhoppeIT/terraform-tfe-organization"
identifier = "dhoppeIT/terraform-tfe-organization"
},
"tfe-registry" = {
display_identifier = "dhoppeIT/terraform-tfe-registry"
identifier = "dhoppeIT/terraform-tfe-registry"
},
"tfe-variable" = {
display_identifier = "dhoppeIT/terraform-tfe-variable"
identifier = "dhoppeIT/terraform-tfe-variable"
},
"tfe-workspace" = {
display_identifier = "dhoppeIT/terraform-tfe-workspace"
identifier = "dhoppeIT/terraform-tfe-workspace"
}
}

variables = {
"github_token" = {
key = "github_token"
value = var.github_token
category = "terraform"
description = "The token used to authenticate with GitHub"
sensitive = true
},
"slack_webhook_url" = {
key = "slack_webhook_url"
value = var.slack_webhook_url
category = "terraform"
description = "The destination URL used to send Slack notifications"
sensitive = true
}
}
}
68 changes: 68 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module "tfe-organization" {
source = "dhoppeIT/organization/tfe"

name = "dhoppeIT"
email = "[email protected]"
collaborator_auth_policy = "two_factor_mandatory"
}

module "tfe-oauth_client" {
source = "dhoppeIT/oauth_client/tfe"

organization = module.tfe-organization.name
api_url = "https://api.github.com"
http_url = "https://github.com"
oauth_token = var.github_token
service_provider = "github"
}

module "tfe-workspace" {
source = "dhoppeIT/workspace/tfe"

name = "terraform"
organization = module.tfe-organization.name
description = "Provision of Terraform Cloud/Enterprise resources"
queue_all_runs = false
terraform_version = "1.0.11"
tag_names = ["terraform"]
identifier = "dhoppeIT/terraform-tfe-config"
branch = "main"
oauth_token_id = module.tfe-oauth_client.oauth_token_id
}

module "tfe-variable" {
source = "dhoppeIT/variable/tfe"

for_each = local.variables

key = each.value["key"]
value = each.value["value"]
category = each.value["category"]
description = each.value["description"]
sensitive = each.value["sensitive"]
workspace_id = module.tfe-workspace.id
}

module "tfe-notification" {
source = "dhoppeIT/notification/tfe"

name = "slack"
enabled = true
destination_type = "slack"
triggers = [
"run:needs_attention",
"run:errored"
]
url = var.slack_webhook_url
workspace_id = module.tfe-workspace.id
}

module "tfe-registry" {
source = "dhoppeIT/registry/tfe"

for_each = local.modules

display_identifier = each.value["display_identifier"]
identifier = each.value["identifier"]
oauth_token_id = module.tfe-oauth_client.oauth_token_id
}
Binary file added rover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "github_token" {
type = string
default = null
description = "The token used to authenticate with GitHub"
}

variable "slack_webhook_url" {
type = string
default = null
description = "The destination URL used to send Slack notifications"
}

0 comments on commit 01bbc5c

Please sign in to comment.