Skip to content
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

"Error: If individual is false, organization is required." unless known repo_owner org is supplied #63

Closed
nitrocode opened this issue Jul 30, 2020 · 1 comment · Fixed by #105
Labels
bug 🐛 An issue with the system

Comments

@nitrocode
Copy link
Member

nitrocode commented Jul 30, 2020

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

Here is my terraform code

module "ecs_web_app" {
  source = "git::https://github.com/cloudposse/terraform-aws-ecs-web-app.git?ref=tags/0.36.0"

  name                                            = local.name
  vpc_id                                          = local.vpc_id
  alb_ingress_unauthenticated_listener_arns       = [data.aws_lb_listener.selected.arn]
  alb_ingress_unauthenticated_listener_arns_count = 1
  aws_logs_region                                 = "us-east-2"
  region                                          = "us-east-2"
  ecs_cluster_arn                                 = data.aws_ecs_cluster.selected.arn
  ecs_cluster_name                                = data.aws_ecs_cluster.selected.cluster_name
  ecs_security_group_ids                          = [data.aws_security_group.selected.id]
  ecs_private_subnet_ids                          = local.subnet_ids
  alb_ingress_healthcheck_path                    = "/healthz"
  alb_ingress_unauthenticated_paths               = ["/*"]
  codepipeline_enabled                            = false
  cloudwatch_log_group_enabled                    = false
  webhook_enabled                                 = false
  alb_security_group                              = "sg-11112222"
  #repo_owner                                      = "hashicorp" # adding this will fix it
}

And the error

Error: If `individual` is false, `organization` is required.

  on .terraform/modules/ecs_web_app.ecs_codepipeline.github_webhooks/main.tf line 7, in provider "github":
   7: provider "github" {

This repo uses the terraform-aws-ecs-codepipeline.git?ref=tags/0.13.0 module

github_oauth_token = var.github_oauth_token
github_anonymous = var.github_webhooks_anonymous
github_webhooks_token = var.github_webhooks_token
github_webhook_events = var.github_webhook_events
repo_owner = var.repo_owner
repo_name = var.repo_name

The terraform-aws-ecs-codepipeline?ref=tags/0.13.0 module uses the terraform-github-repository-webhooks.git?ref=tags/0.8.0 module

https://github.com/cloudposse/terraform-aws-ecs-codepipeline/blob/3232eec2fbb8c39c1d55b1f24b09fa237c09d063/main.tf#L437-L443

module "github_webhooks" {
  source               = "git::https://github.com/cloudposse/terraform-github-repository-webhooks.git?ref=tags/0.8.0"
  enabled              = var.enabled && var.webhook_enabled ? true : false
  github_anonymous     = var.github_anonymous
  github_organization  = var.repo_owner
  github_repositories  = [var.repo_name]
  github_token         = var.github_webhooks_token

And finally the terraform-github-repository-webhooks.git?ref=tags/0.8.0 module uses the provider code

https://github.com/cloudposse/terraform-github-repository-webhooks/blob/0.8.0/main.tf#L8-L11

provider "github" {
  token        = var.github_token != "" ? var.github_token : null
  organization = var.github_organization
  anonymous    = var.github_anonymous
  base_url     = var.github_base_url
}

Looks like the following values are passed to it

var.github_token        = "" (`github_webhooks_token=""` from terraform-aws-ecs-web-app)
var.github_organization = "" (`repo_owner=""` from terraform-aws-ecs-web-app)
var.github_anonymous    = false (`github_webhooks_anonymous=false` from terraform-aws-ecs-web-app)
var.github_base_url     = "https://api.github.com/" (default from terraform-github-repository-webhooks)

Expected Behavior

That it won't throw an error

Steps to Reproduce

  1. Use my terraform code
  2. Plan it and see the error
  3. Then add repo_owner = hashicorp
  4. Plan it again and no error

Screenshots

N/A

Environment (please complete the following information):

N/A

Workaround

Use the child modules used by this module: alb ingress and ecs service task.

@nitrocode nitrocode added the bug 🐛 An issue with the system label Jul 30, 2020
@stepan-romankov
Copy link

same for me (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants