mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
temp tf
This commit is contained in:
parent
a5e2fdc7a7
commit
ec505739c8
31 changed files with 1394 additions and 0 deletions
57
terraform/modules/tfc-workspace/main.tf
Normal file
57
terraform/modules/tfc-workspace/main.tf
Normal file
|
@ -0,0 +1,57 @@
|
|||
locals {
|
||||
dependentModulesPathed = formatlist("terraform/modules/%s", var.dependent_modules)
|
||||
variableDescription = "Terraform-owned variable"
|
||||
}
|
||||
|
||||
resource "tfe_workspace" "ws" {
|
||||
name = var.workspace-name
|
||||
organization = var.tfc_org
|
||||
auto_apply = var.auto_apply
|
||||
trigger_prefixes = concat([var.directory], local.dependentModulesPathed)
|
||||
working_directory = var.directory
|
||||
|
||||
vcs_repo {
|
||||
identifier = var.repo
|
||||
branch = var.branch
|
||||
oauth_token_id = var.tfc_oauth_token_id
|
||||
}
|
||||
}
|
||||
|
||||
resource "tfe_notification_configuration" "webhook" {
|
||||
name = "${var.workspace-name}-webhook"
|
||||
enabled = true
|
||||
destination_type = "slack"
|
||||
triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored"]
|
||||
url = var.tfc_webhook_url
|
||||
workspace_id = tfe_workspace.ws.id
|
||||
}
|
||||
|
||||
resource "tfe_variable" "vars" {
|
||||
for_each = var.vars
|
||||
|
||||
key = each.key
|
||||
value = each.value
|
||||
category = "terraform"
|
||||
workspace_id = tfe_workspace.ws.id
|
||||
sensitive = false
|
||||
}
|
||||
|
||||
resource "tfe_variable" "sensitive" {
|
||||
for_each = var.secret-vars
|
||||
|
||||
key = each.key
|
||||
value = each.value
|
||||
category = "terraform"
|
||||
workspace_id = tfe_workspace.ws.id
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
resource "tfe_variable" "env" {
|
||||
for_each = var.env-vars
|
||||
|
||||
key = each.key
|
||||
value = each.value
|
||||
category = "env"
|
||||
workspace_id = tfe_workspace.ws.id
|
||||
sensitive = true
|
||||
}
|
3
terraform/modules/tfc-workspace/outputs.tf
Normal file
3
terraform/modules/tfc-workspace/outputs.tf
Normal file
|
@ -0,0 +1,3 @@
|
|||
output "workspace" {
|
||||
value = tfe_workspace.ws[*]
|
||||
}
|
54
terraform/modules/tfc-workspace/variables.tf
Normal file
54
terraform/modules/tfc-workspace/variables.tf
Normal file
|
@ -0,0 +1,54 @@
|
|||
variable "workspace-name" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "secret-vars" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "vars" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "env-vars" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "repo" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "directory" {
|
||||
type = string
|
||||
default = "/"
|
||||
}
|
||||
|
||||
variable "branch" {
|
||||
type = string
|
||||
default = "master"
|
||||
}
|
||||
|
||||
variable "auto_apply" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "dependent_modules" {
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "tfc_oauth_token_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "tfc_org" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "tfc_webhook_url" {
|
||||
type = string
|
||||
}
|
7
terraform/modules/tfc-workspace/version.tf
Normal file
7
terraform/modules/tfc-workspace/version.tf
Normal file
|
@ -0,0 +1,7 @@
|
|||
terraform {
|
||||
required_version = ">=0.12.6"
|
||||
}
|
||||
|
||||
provider "tfe" {
|
||||
version = ">=0.15.0"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue