Skip to content

Commit

Permalink
Merge pull request #20 from ConseilsTI/v0.0.20
Browse files Browse the repository at this point in the history
v0.0.20
  • Loading branch information
benyboy84 authored Feb 5, 2024
2 parents b016db9 + f280b91 commit 3355118
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 66 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ Source: ./modules/tfe_notification

Version:

### <a name="module_projects_factory_notifications"></a> [projects\_factory\_notifications](#module\_projects\_factory\_notifications)

Source: ./modules/tfe_notification

Version:

### <a name="module_repository"></a> [repository](#module\_repository)

Source: ./modules/github_repository
Expand Down Expand Up @@ -177,16 +171,13 @@ No optional inputs.

The following resources are used by this module:

- [github_branch_protection.projects_factory](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection) (resource)
- [github_repository.projects_factory](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository) (resource)
- [tfe_project.project](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/project) (resource)
- [tfe_project_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/project_variable_set) (resource)
- [tfe_variable.variable_set](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) (resource)
- [tfe_variable.variable_set_tfe_token](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) (resource)
- [tfe_variable.workspace](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) (resource)
- [tfe_variable.workspace_tfe_token](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable) (resource)
- [tfe_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/variable_set) (resource)
- [tfe_workspace.projects_factory](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace) (resource)
- [tfe_workspace_variable_set.this](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/resources/workspace_variable_set) (resource)
- [hcp_vault_secrets_secret.this](https://registry.terraform.io/providers/hashicorp/hcp/latest/docs/data-sources/vault_secrets_secret) (data source)
- [tfe_oauth_client.client](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/oauth_client) (data source)
Expand Down
117 changes: 60 additions & 57 deletions resources_projects_factory.tf
Original file line number Diff line number Diff line change
@@ -1,70 +1,73 @@
# The following code block is used to create GitHub repository resources.
# # The following code block is used to create GitHub repository resources.

resource "github_repository" "projects_factory" {
# resource "github_repository" "projects_factory" {

name = "TerraformCloud-ProjectOnboarding"
description = "Repository to provision and manage Terraform Cloud projects using Terraform code (IaC)."
visibility = "public"
delete_branch_on_merge = true
auto_init = true
# name = "TerraformCloud-ProjectsFactory"
# description = "Repository to provision and manage Terraform Cloud projects using Terraform code (IaC)."
# visibility = "public"
# has_issues = true
# has_projects = true
# has_wiki = true
# delete_branch_on_merge = true
# auto_init = true

security_and_analysis {
# advanced_security {
# status = "enabled"
# }
secret_scanning {
status = "enabled"
}
secret_scanning_push_protection {
status = "enabled"
}
}
# security_and_analysis {
# # advanced_security {
# # status = "enabled"
# # }
# secret_scanning {
# status = "enabled"
# }
# secret_scanning_push_protection {
# status = "enabled"
# }
# }

topics = ["terraform-workspace", "terraform", "terraform-managed", "foundation", "factory"]
vulnerability_alerts = true
allow_update_branch = false
}
# topics = ["terraform-workspace", "terraform", "terraform-managed", "foundation", "factory"]
# vulnerability_alerts = true
# allow_update_branch = false
# }

resource "github_branch_protection" "projects_factory" {
repository_id = github_repository.projects_factory.name
pattern = "main"
enforce_admins = true
require_conversation_resolution = true
# resource "github_branch_protection" "projects_factory" {
# repository_id = github_repository.projects_factory.name
# pattern = "main"
# enforce_admins = true
# require_conversation_resolution = true

required_pull_request_reviews {
dismiss_stale_reviews = true
require_code_owner_reviews = true
required_approving_review_count = "0"
}
}
# required_pull_request_reviews {
# dismiss_stale_reviews = true
# require_code_owner_reviews = true
# required_approving_review_count = "0"
# }
# }

# The following code block is used to create workspace resources in project.
# # The following code block is used to create workspace resources in project.

resource "tfe_workspace" "projects_factory" {
# resource "tfe_workspace" "projects_factory" {

name = github_repository.projects_factory.name
description = github_repository.projects_factory.description
organization = data.tfe_organization.this.name
project_id = tfe_project.project["Terraform Cloud"].id
tag_names = ["managed_by_terraform"]
terraform_version = "latest"
trigger_patterns = ["*.tf"]
vcs_repo {
identifier = "${local.git_organization_name}/TerraformCloud-ProjectOnboarding"
oauth_token_id = data.tfe_oauth_client.client.oauth_token_id
}
# name = github_repository.projects_factory.name
# description = github_repository.projects_factory.description
# organization = data.tfe_organization.this.name
# project_id = tfe_project.project["Terraform Cloud"].id
# tag_names = ["managed_by_terraform"]
# terraform_version = "latest"
# trigger_patterns = ["*.tf"]
# vcs_repo {
# identifier = "${local.git_organization_name}/TerraformCloud-ProjectOnboarding"
# oauth_token_id = data.tfe_oauth_client.client.oauth_token_id
# }

}
# }

# The following code block is used to create notification resources in project.
# # The following code block is used to create notification resources in project.

module "projects_factory_notifications" {
source = "./modules/tfe_notification"
# module "projects_factory_notifications" {
# source = "./modules/tfe_notification"

name = "Microsoft Teams"
destination_type = "microsoft-teams"
workspace_id = tfe_workspace.projects_factory.id
enabled = true
triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
url = "https://conseilsti.webhook.office.com/webhookb2/b1967add-a0bb-4f55-9508-280cefef4403@0f9829d3-a628-4f2b-a3ac-58e0740d27ae/IncomingWebhook/bd56b2570de84870b0529487428b9ccb/4c88f00c-bcb7-4867-823f-ce6d94fb1c06"
}
# name = "Microsoft Teams"
# destination_type = "microsoft-teams"
# workspace_id = tfe_workspace.projects_factory.id
# enabled = true
# triggers = ["run:created", "run:planning", "run:needs_attention", "run:applying", "run:completed", "run:errored", "assessment:check_failure", "assessment:drifted", "assessment:failed"]
# url = "https://conseilsti.webhook.office.com/webhookb2/b1967add-a0bb-4f55-9508-280cefef4403@0f9829d3-a628-4f2b-a3ac-58e0740d27ae/IncomingWebhook/bd56b2570de84870b0529487428b9ccb/4c88f00c-bcb7-4867-823f-ce6d94fb1c06"
# }

0 comments on commit 3355118

Please sign in to comment.