main.tf 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. data "github_repository" "this" {
  2. name = "content_source"
  3. }
  4. resource "aws_codebuild_project" "this" {
  5. for_each = local.splunk_server_types
  6. name = "splunk_apps_${var.splunk_prefix}_${each.value}"
  7. description = "Splunk Application build for ${each.value}"
  8. service_role = aws_iam_role.codebuild_splunk_apps_role.arn
  9. encryption_key = aws_kms_key.s3_codebuild_splunk_apps_artifacts.arn
  10. badge_enabled = var.badge_enabled
  11. concurrent_build_limit = 1
  12. build_timeout = 60
  13. source {
  14. type = "GITHUB_ENTERPRISE"
  15. location = data.github_repository.this.http_clone_url
  16. report_build_status = true
  17. git_clone_depth = 1
  18. }
  19. source_version = var.source_version
  20. environment {
  21. compute_type = "BUILD_GENERAL1_SMALL"
  22. image = "${var.common_services_account}.dkr.ecr.us-gov-east-1.amazonaws.com/content_generator:latest"
  23. image_pull_credentials_type = "SERVICE_ROLE"
  24. type = "LINUX_CONTAINER"
  25. environment_variable {
  26. name = "TAG"
  27. type = "PLAINTEXT"
  28. value = "${var.splunk_prefix}:${each.value}"
  29. }
  30. }
  31. artifacts {
  32. type = "S3"
  33. location = "xdr-${var.splunk_prefix}-${var.environment}-splunk-apps"
  34. name = each.value
  35. #path = each.value
  36. namespace_type = "NONE"
  37. packaging = "NONE"
  38. }
  39. tags = merge(var.standard_tags, var.tags)
  40. }
  41. #resource "aws_codebuild_webhook" "this" {
  42. # project_name = var.name
  43. # branch_filter = var.webhook_branch_filter
  44. #
  45. # depends_on = [ aws_codebuild_project.this ]
  46. #}
  47. #resource "github_repository_webhook" "this" {
  48. # active = true
  49. # events = ["push"]
  50. # repository = data.github_repository.this.name
  51. #
  52. # configuration {
  53. # url = aws_codebuild_webhook.this.payload_url
  54. # secret = aws_codebuild_webhook.this.secret
  55. # content_type = "json"
  56. # insecure_ssl = false
  57. # }
  58. #}