main.tf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #Base RHEL repository used for building XDR RPMs like syslog-ng in CodeBuild
  2. resource "aws_ecr_repository" "codebuild-rhel7" {
  3. name = "codebuild-rhel7"
  4. tags = merge(var.standard_tags, var.tags)
  5. image_scanning_configuration {
  6. scan_on_push = true
  7. }
  8. }
  9. #Allow codebuild to access the ECR Repository
  10. resource "aws_ecr_repository_policy" "codebuild-rhel7" {
  11. repository = aws_ecr_repository.codebuild-rhel7.name
  12. policy = <<EOF
  13. {
  14. "Version": "2008-10-17",
  15. "Statement": [
  16. {
  17. "Sid": "new statement",
  18. "Effect": "Allow",
  19. "Principal": {
  20. "Service": "codebuild.amazonaws.com"
  21. },
  22. "Action": [
  23. "ecr:GetDownloadUrlForLayer",
  24. "ecr:BatchGetImage",
  25. "ecr:BatchCheckLayerAvailability"
  26. ]
  27. }
  28. ]
  29. }
  30. EOF
  31. }
  32. # not needed, but leaving the code for possible future use.
  33. # #base centos7 image used for building portal
  34. # resource "aws_ecr_repository" "codebuild-centos7" {
  35. # name = "codebuild-centos7"
  36. # tags = merge(var.standard_tags, var.tags)
  37. # }
  38. # #Allow codebuild to access the ECR Repository
  39. # resource "aws_ecr_repository_policy" "codebuild-centos7" {
  40. # repository = aws_ecr_repository.codebuild-centos7.name
  41. # policy = <<EOF
  42. # {
  43. # "Version": "2008-10-17",
  44. # "Statement": [
  45. # {
  46. # "Sid": "new statement",
  47. # "Effect": "Allow",
  48. # "Principal": {
  49. # "Service": "codebuild.amazonaws.com"
  50. # },
  51. # "Action": [
  52. # "ecr:GetDownloadUrlForLayer",
  53. # "ecr:BatchGetImage",
  54. # "ecr:BatchCheckLayerAvailability"
  55. # ]
  56. # }
  57. # ]
  58. # }
  59. # EOF
  60. # }