main.tf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. terraform {
  2. required_providers {
  3. aws = {
  4. source = "hashicorp/aws"
  5. version = "~> 4.16"
  6. }
  7. }
  8. required_version = ">= 1.2.0"
  9. }
  10. provider "aws" {
  11. profile = "weseek"
  12. region = "ap-northeast-1"
  13. }
  14. resource "aws_iam_role" "growi-official-image-builder" {
  15. name = "growi-official-image-builder"
  16. assume_role_policy = <<EOF
  17. {
  18. "Version": "2012-10-17",
  19. "Statement": [
  20. {
  21. "Effect": "Allow",
  22. "Principal": {
  23. "Service": "codebuild.amazonaws.com"
  24. },
  25. "Action": "sts:AssumeRole"
  26. }
  27. ]
  28. }
  29. EOF
  30. }
  31. resource "aws_codebuild_project" "growi-official-image-builder" {
  32. name = "growi-official-image-builder"
  33. description = "The CodeBuild Project for GROWI official docker image"
  34. service_role = aws_iam_role.growi-official-image-builder.arn
  35. artifacts {
  36. type = "NO_ARTIFACTS"
  37. }
  38. environment {
  39. compute_type = "BUILD_GENERAL1_LARGE"
  40. image = "aws/codebuild/standard:6.0"
  41. type = "LINUX_CONTAINER"
  42. privileged_mode = true
  43. }
  44. source {
  45. # type = "NO_SOURCE"
  46. type = "GITHUB"
  47. location = "https://github.com/weseek/growi.git"
  48. git_clone_depth = 1
  49. }
  50. source_version = "refs/heads/support/build-with-codebuild"
  51. build_batch_config {
  52. service_role = aws_iam_role.growi-official-image-builder.arn
  53. }
  54. }