Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
marwinbaumannsbp committed Mar 1, 2024
1 parent c7767ef commit f169e93
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
2 changes: 0 additions & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ provider "aws" {
region = "eu-west-1"
}

provider "github" {}

provider "mcaf" {
aws {}
}
Expand Down
10 changes: 5 additions & 5 deletions examples/basic/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ terraform {
source = "hashicorp/aws"
version = ">= 4.9.0"
}
github = {
source = "integrations/github"
version = ">= 4.0.0"
}
mcaf = {
source = "schubergphilis/mcaf"
version = ">= 0.4.2"
}
tfe = {
source = "hashicorp/tfe"
version = ">= 0.25.0"
version = ">= 0.51.0"
}
tls = {
source = "hashicorp/tls"
version = ">= 4.0.4"
}
}
required_version = ">= 1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ module "additional_tfe_workspaces" {
global_remote_state = each.value.global_remote_state
name = coalesce(each.value.name, each.key)
notification_configuration = each.value.notification_configuration
oidc_settings = coalesce(each.value.auth_method, var.tfe_workspace.auth_method) == "iam_role_oidc" ? { provider_arn = aws_iam_openid_connect_provider.tfc_provider[0].arn } : null
oauth_token_id = each.value.connect_vcs_repo != false ? coalesce(each.value.vcs_oauth_token_id, var.tfe_workspace.vcs_oauth_token_id) : null
oidc_settings = coalesce(each.value.auth_method, var.tfe_workspace.auth_method) == "iam_role_oidc" ? { provider_arn = aws_iam_openid_connect_provider.tfc_provider[0].arn } : null
path = var.path
permissions_boundary_arn = each.value.add_permissions_boundary == true ? aws_iam_policy.workspace_boundary[0].arn : null
policy = each.value.policy
Expand Down
22 changes: 17 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,26 @@ variable "additional_tfe_workspaces" {
sensitive_env_variables = optional(map(string), {})
sensitive_hcl_variables = optional(map(object({ sensitive = string })), {})
sensitive_terraform_variables = optional(map(string), {})
slack_notification_triggers = optional(list(string), null)
slack_notification_url = optional(string, null)
ssh_key_id = optional(string, null)
terraform_version = optional(string, null)
trigger_prefixes = optional(list(string), null)
username = optional(string, null)
vcs_oauth_token_id = optional(string, null)
working_directory = optional(string, null)
workspace_tags = optional(list(string), null)

notification_configuration = optional(list(object({
destination_type = string
enabled = optional(bool, true)
url = string
triggers = optional(list(string), null)
triggers = optional(list(string), [
"run:created",
"run:planning",
"run:needs_attention",
"run:applying",
"run:completed",
"run:errored",
])
})), [])

team_access = optional(map(object({
Expand Down Expand Up @@ -163,7 +168,14 @@ variable "tfe_workspace" {
destination_type = string
enabled = optional(bool, true)
url = string
triggers = optional(list(string), null)
triggers = optional(list(string), [
"run:created",
"run:planning",
"run:needs_attention",
"run:applying",
"run:completed",
"run:errored",
])
})), [])

team_access = optional(map(object({
Expand Down
6 changes: 1 addition & 5 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ terraform {
source = "hashicorp/aws"
version = ">= 4.9.0"
}
github = {
source = "integrations/github"
version = ">= 4.0.0"
}
mcaf = {
source = "schubergphilis/mcaf"
version = ">= 0.4.2"
}
tfe = {
source = "hashicorp/tfe"
version = ">= 0.25.0"
version = ">= 0.51.0"
}
tls = {
source = "hashicorp/tls"
Expand Down

0 comments on commit f169e93

Please sign in to comment.