terraform-aws-modules / terraform-aws-atlantis

Terraform module to deploy Atlantis on AWS Fargate 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/atlantis/aws
Apache License 2.0
520 stars 351 forks source link

(re-open #384) atlantis_repo_allowlist format for Atlantis and the github_repository_webhooks #394

Closed fmudhir closed 9 months ago

fmudhir commented 9 months ago

Description

Issue #384 still exists and should not have been closed (the problem cost me many valuable hours). I understand the text by the original poster was hard to decipher but he captured most of whats needed.

⚠️ Note

Versions

Reproduction Code [Required]

NOTE: using terraform-aws-atlantis as example repo name

atlantis_repo_allowlist = ["terraform-aws-atlantis"] # from https://github.com/terraform-aws-modules/terraform-aws-atlantis

Steps to reproduce the behavior:

You only need to start from scratch and populate terraform.tfvars in the github-complete example to reproduce, the documentation is misleading and there's an underlying problem with forwarding atlantis_repo_allowlist to the webhook module.

The env var for the instance needs to be reworked to something like this (sorry I hardcoded the hostname):

 # ECS
  atlantis = {
    environment = [
      {
        name  = "ATLANTIS_GH_USER"
        value = var.atlantis_github_user
      },
      {
        name  = "ATLANTIS_REPO_ALLOWLIST"

        # because this module expects a format like:
        #    "github.com/terraform-aws-modules/terraform-aws-atlantis"
        # but the webhook repo module expects only "terraform-aws-atlantis"
        # terraform.tfvars need to have this value: atlantis_repo_allowlist = ["terraform-aws-atlantis"]

       # this sort of fixes it, probably need dynamic hostname
       value = join(",", formatlist("github.com/${var.github_owner}/%s", var.atlantis_repo_allowlist)) 
      },

What makes this problem extra challenging is debugger needs to do terraform destroy to re-apply changes since containers are immutable. So please address this for future developers.

bryantbiggs commented 9 months ago

again, what do we need to change here? this looks like users just need to read the documentation for Atlantis, nothing related to this module

fmudhir commented 9 months ago

Again this is requesting code change on this repo to the example provided: terraform-aws-modules/terraform-aws-atlantis/tree/master/examples/github-complete

To change the env var line for allowlist to be as follows.

value = join(",", formatlist("github.com/${var.github_owner}/%s", var.atlantis_repo_allowlist))

Or (better) changing the module itself to take allowlist in consistent manner to the webhook module.

I can raise a PR draft if you need more explanation of whats the requested change here.

github-actions[bot] commented 8 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

antonbabenko commented 8 months ago

This issue has been resolved in version 4.2.1 :tada: