-
-
Notifications
You must be signed in to change notification settings - Fork 355
Examples using atlantis_repo_allowlist output don't work #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bodgit thanks for mentioning it. Yes, it seems that this example is misleading. I agree, major version bump would be better. The reason why On the other hand - module "atlantis" {
...
# Allow all repositories in my account
atlantis_repo_allowlist = ["github.com/someuser/*"]
...
}
module "github_repository_webhook" {
...
# Create webhooks only for specific repositories
atlantis_repo_allowlist = ["repo1", "repo2"]
...
} But in some cases they could intersect: locals {
owner = "someuser"
repositories = ["repo1", "repo2"]
allow_filter = [ for r in loca.repositories : "github.com/${owner}/${r}" ]
}
module "atlantis" {
...
# Allow list repositories in my account
atlantis_repo_allowlist = local.allow_filter
...
}
module "github_repository_webhook" {
...
# Create webhooks only for specific repositories
atlantis_repo_allowlist = local.repositories
...
} Generally speaking in some cases it is easy to use wildcard, but in some cases - a fixed list. I also think we should rethink names for those parameters in the future, as they are misleading. |
I believe this is what I pointed out here, no? https://github.com/terraform-aws-modules/terraform-aws-atlantis/pull/221/files#r779863857 the webhook sub-module needs to know each repository so it can create the webhook, it can't take a glob pattern |
@bryantbiggs correct. But you need it only for submodules. We have to distiguish those to paramters:
Maybe rename those input paramters according to their usage to avoid confusion? e.g.
|
I don't follow. Your PR made the change in the example which is doing the opposite of what you are saying https://github.com/terraform-aws-modules/terraform-aws-atlantis/pull/221/files#diff-f876b6951de7de1c9c2d51b48b33502787d5b450d3dff6f740f5e2ce47043e19R104 The webhook sub-modules are not used in the root module - correct; but they need to take in a list of repositories. So why did you take the glob pattern syntax from the root and push it down to the webhook sub-modules which brakes the functionality? Your PR should have only touched the root module and not the sub-modules |
atlantis_repo_allowlist = ["repo1","repo2","repo3"] locals {
repositories = flatten([
for repo in var.atlantis_repo_allowlist:
["github.com/${var.github_owner}/${repo}"]
])
} output "atlantis_repo_allowlist" {
description = "Git repositories where webhook should be created"
// value = var.atlantis_repo_allowlist
value = local.repositories
} module "atlantis" {
...
atlantis_repo_allowlist = local.repositories
...
module "github_repository_webhook" {
...
atlantis_repo_allowlist = module.atlantis.atlantis_repo_allowlist
...
} we still use module.atlantis.atlantis_repo_allowlist on github_repository_webhook module. |
Using "*" doesn't cause Atlantis to monitor all repositories. AIUI it's just used as a whitelist for which repositories are allowed to trigger the payload URL. The webhook is what determines if a repository is using Atlantis or not, which needs to be created per repository; it's not a valid API call to pass "*". The change you've proposed doesn't fix anything as you still end up passing to the webhook module repository names of the form "github.com/.../...", which doesn't work. |
The GitHub Complete example(https://github.com/terraform-aws-modules/terraform-aws-atlantis/tree/master/examples/github-complete) is not working because of terraform-aws-modules#253. This PR fixes it.
@bodgit, @bryantbiggs I think we can close this issue, as @skalinets was kind and have fixed it in #277. |
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. |
Description
Since #221 was merged, the examples of using the
atlantis_repo_allowlist
output as an input to the GitHub webhook submodule don't work. Consider the following stripped down example:This code is basically what is in the complete GitHub example in this repo. However, it generates this error:
Initially I thought it was just the wildcard causing the problem, but it's passing in the whole "github.com/.../..." string. You need to pass the short repository name, which will be owned by the account that owns the credentials configured in the GitHub provider.
This used to work as it was using the
atlantis_allowed_repo_names
variable which would've been configured like["repo1", "repo2"]
, etc.IMHO, removing an input parameter from the module should've been a major version bump here as it breaks backwards compatibility.
Versions
Reproduction
See above.
Code Snippet to Reproduce
See above.
Expected behavior
Webhook should be created.
Actual behavior
GitHub API error.
The text was updated successfully, but these errors were encountered: