|
1 | | -# Complete Atlantis example with GitHub App and Webhooks |
| 1 | +# Complete GitHub example |
2 | 2 |
|
3 | | -Configuration in this directory creates the necessary infrastructure and resources for running Atlantis on Fargate plus GitHub repository webhooks configured to Atlantis URL. |
4 | | - |
5 | | -An existing Route53 hosted zone and domain is required to deploy this example. |
| 3 | +Configuration in this directory provisions Atlantis on ECS with EFS storage, ALB, Route53 record and GitHub repository webhooks. |
6 | 4 |
|
7 | 5 | ## Usage |
8 | 6 |
|
9 | 7 | To run this code you need to copy `terraform.tfvars.sample` into `terraform.tfvars` and update the values locally or specify them using environment variables (`TF_VAR_github_app_id=xxx`, `TF_VAR_github_owner=xxx`, etc.). Ensure that `bootstrap_github_app` is `true`. Once ready, execute: |
10 | 8 |
|
11 | 9 | ```bash |
12 | | -$ terraform init |
13 | | -$ terraform plan |
14 | | -$ terraform apply |
| 10 | +terraform init |
| 11 | +terraform plan |
| 12 | +terraform apply |
15 | 13 | ``` |
16 | 14 |
|
17 | | -Terraform will output a URL to setup a new Github App via Atlantis, which should look something like https://$ATLANTIS_HOST/github-app/setup. Open that URL and go through the setup process. Before closing the window, click the link to install the new GitHub App on you repositories and copy the values `github_app_id`, `github_app_key`, and `github_webhook_secret` into `terraform.tfvars`. You should also set `bootstrap_github_app` to `false` . Now execute: |
18 | | - |
19 | | -```bash |
20 | | -$ terraform plan |
21 | | -$ terraform apply |
22 | | - |
23 | | -``` |
24 | | - |
25 | | -Note - if you receive the following error when running apply: |
26 | | - |
27 | | -`Error: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again. "atlantiscomplete"` |
28 | | - |
29 | | -Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settings (update for your region of use) and change `Container instance`, `Service`, and `Task` to `Enabled`. |
30 | | - |
31 | | -⚠️ This example will create resources which cost money. Run `terraform destroy` when you don't need these resources. ⚠️ |
| 15 | +Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. |
32 | 16 |
|
33 | 17 | <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
34 | 18 | ## Requirements |
35 | 19 |
|
36 | 20 | | Name | Version | |
37 | 21 | |------|---------| |
38 | | -| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 | |
39 | | -| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.69 | |
40 | | -| <a name="requirement_github"></a> [github](#requirement\_github) | >= 4.8 | |
| 22 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 | |
| 23 | +| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 | |
| 24 | +| <a name="requirement_github"></a> [github](#requirement\_github) | >= 5.0 | |
| 25 | +| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 | |
41 | 26 |
|
42 | 27 | ## Providers |
43 | 28 |
|
44 | 29 | | Name | Version | |
45 | 30 | |------|---------| |
46 | | -| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.69 | |
| 31 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 | |
| 32 | +| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 | |
47 | 33 |
|
48 | 34 | ## Modules |
49 | 35 |
|
50 | 36 | | Name | Source | Version | |
51 | 37 | |------|--------|---------| |
52 | 38 | | <a name="module_atlantis"></a> [atlantis](#module\_atlantis) | ../../ | n/a | |
53 | | -| <a name="module_atlantis_access_log_bucket"></a> [atlantis\_access\_log\_bucket](#module\_atlantis\_access\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 | |
| 39 | +| <a name="module_github_repository_webhooks"></a> [github\_repository\_webhooks](#module\_github\_repository\_webhooks) | ../../modules/github-repository-webhook | n/a | |
| 40 | +| <a name="module_secrets_manager"></a> [secrets\_manager](#module\_secrets\_manager) | terraform-aws-modules/secrets-manager/aws | ~> 1.0 | |
| 41 | +| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 | |
54 | 42 |
|
55 | 43 | ## Resources |
56 | 44 |
|
57 | 45 | | Name | Type | |
58 | 46 | |------|------| |
59 | | -| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | |
60 | | -| [aws_elb_service_account.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/elb_service_account) | data source | |
61 | | -| [aws_iam_policy_document.atlantis_access_log_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | |
62 | | -| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | |
| 47 | +| [random_password.webhook_secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource | |
| 48 | +| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source | |
| 49 | +| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | |
63 | 50 |
|
64 | 51 | ## Inputs |
65 | 52 |
|
66 | 53 | | Name | Description | Type | Default | Required | |
67 | 54 | |------|-------------|------|---------|:--------:| |
68 | | -| <a name="input_alb_ingress_cidr_blocks"></a> [alb\_ingress\_cidr\_blocks](#input\_alb\_ingress\_cidr\_blocks) | List of IPv4 CIDR ranges to use on all ingress rules of the ALB - use your personal IP in the form of `x.x.x.x/32` for restricted testing | `list(string)` | n/a | yes | |
69 | | -| <a name="input_bootstrap_github_app"></a> [bootstrap\_github\_app](#input\_bootstrap\_github\_app) | Flag to configure Atlantis to bootstrap a new Github App | `bool` | n/a | yes | |
| 55 | +| <a name="input_atlantis_github_user"></a> [atlantis\_github\_user](#input\_atlantis\_github\_user) | GitHub user or organization name | `string` | n/a | yes | |
| 56 | +| <a name="input_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#input\_atlantis\_repo\_allowlist) | List of GitHub repositories that Atlantis will be allowed to access | `list(string)` | n/a | yes | |
70 | 57 | | <a name="input_domain"></a> [domain](#input\_domain) | Route53 domain name to use for ACM certificate. Route53 zone for this domain should be created in advance | `string` | n/a | yes | |
71 | | -| <a name="input_github_app_id"></a> [github\_app\_id](#input\_github\_app\_id) | GitHub App ID that is running the Atlantis command | `string` | n/a | yes | |
72 | | -| <a name="input_github_app_key"></a> [github\_app\_key](#input\_github\_app\_key) | The PEM encoded private key for the GitHub App | `string` | n/a | yes | |
73 | | -| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner | `string` | n/a | yes | |
74 | | -| <a name="input_github_repo_names"></a> [github\_repo\_names](#input\_github\_repo\_names) | List of Github repositories that should be monitored by Atlantis | `list(string)` | n/a | yes | |
75 | | -| <a name="input_github_webhook_secret"></a> [github\_webhook\_secret](#input\_github\_webhook\_secret) | Webhook secret | `string` | n/a | yes | |
| 58 | +| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner to use when creating webhook | `string` | n/a | yes | |
| 59 | +| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | Github token to use when creating webhook | `string` | n/a | yes | |
76 | 60 |
|
77 | 61 | ## Outputs |
78 | 62 |
|
79 | 63 | | Name | Description | |
80 | 64 | |------|-------------| |
81 | | -| <a name="output_atlantis_github_app_setup_url"></a> [atlantis\_github\_app\_setup\_url](#output\_atlantis\_github\_app\_setup\_url) | URL to create a new Github App with Atlantis | |
82 | | -| <a name="output_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#output\_atlantis\_repo\_allowlist) | Git repositories where webhook should be created | |
| 65 | +| <a name="output_alb"></a> [alb](#output\_alb) | ALB created and all of its associated outputs | |
83 | 66 | | <a name="output_atlantis_url"></a> [atlantis\_url](#output\_atlantis\_url) | URL of Atlantis | |
84 | | -| <a name="output_ecs_task_definition"></a> [ecs\_task\_definition](#output\_ecs\_task\_definition) | Task definition for ECS service (used for external triggers) | |
85 | | -| <a name="output_task_role_arn"></a> [task\_role\_arn](#output\_task\_role\_arn) | The Atlantis ECS task role arn | |
| 67 | +| <a name="output_cluster"></a> [cluster](#output\_cluster) | ECS cluster created and all of its associated outputs | |
| 68 | +| <a name="output_efs"></a> [efs](#output\_efs) | EFS created and all of its associated outputs | |
| 69 | +| <a name="output_service"></a> [service](#output\_service) | ECS service created and all of its associated | |
86 | 70 | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
0 commit comments