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

Breaking behavior in 2.9.0 release: terraform validate fails because of missing token #503

Closed
mariux opened this issue Jun 30, 2020 · 8 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone thinking Type: Breaking change Used to note any change that requires a major version bump
Milestone

Comments

@mariux
Copy link

mariux commented Jun 30, 2020

Hi there,

As mentioned here https://github.com/terraform-providers/terraform-provider-github/pull/464#issuecomment-651254293, we are facing breaking behavior in a minor release.

We applied the workaround mentioned below and are fine for now, but I want to raise the issue anyway as we faced this in our automated testing of the github open-source modules we provide at @mineiros-io to make managing github configuration easy.

Terraform & Provider Version

Terraform v0.12.28
+ provider.github v2.9.0

Affected Resource(s)

  • github provider config

Terraform Configuration Files

N/A

Debug Output

With 2.8.1 terraform validate in our module code validates just fine. With 2.9.0 we get the following breaking error now:

$ terraform-0.12.28 validate

Error: Missing required argument

The argument "token" is required, but was not set.

Expected Behavior

  • terraform validate just run fine without carping about a missing token.

Actual Behavior

  • terraform validate fails with The argument "token" is required, but was not set.
  • current workaround: Setting GITHUB_TOKEN environment to a random string fixes the behavior.

Steps to Reproduce

  • run terraform validate without specifying a token configuration with 2.8.1 and 2.9.0

References

The issue was raised before in the introducing PR introducing the breaking change:

@glenwinters
Copy link

I'd say this is related to https://github.com/terraform-providers/terraform-provider-github/issues/502 since the token was required unless anonymous was true according to the docs.

The fix for now is to pin the provider to the previous release, 2.8.1.

@mariux
Copy link
Author

mariux commented Jun 30, 2020

@mariux what could you do with anonymous GitHub provider before?

We provide a module and run automated tests for static analysis and unit testing. The static analysis runs tools like tflint and terraform validate. terraform validate started failing with 2.9.0 if no token is provided. As this is a module we do not configure the provider at all but just have a version constraint defined:

terraform {
  required_version = "~> 0.12.9"

  required_providers {
    github = "~> 2.4"
  }
}

(crossposted from #464) to clarify the details.

@mariux
Copy link
Author

mariux commented Jun 30, 2020

I'd say this is related to #502 since the token was required unless anonymous was true according to the docs.
The fix for now is to pin the provider to the previous release, 2.8.1.

Added #502 to the list of references, thanks. For this specific issue, we worked around by setting the TOKEN via environment variables also for the validation step.

@glenwinters
Copy link

Here's how I'm using the anonymous attribute:

provider "github" {
  anonymous  = true
  individual = true
}

data "github_ip_ranges" "default" {}

I'm using the ip ranges returned by that data block to give GitHub hooks access to my API.

I'm not setting the token using an environment variable.

@jcudit jcudit added this to the v2.9.1 milestone Jul 1, 2020
@jcudit jcudit added Type: Breaking change Used to note any change that requires a major version bump Status: Up for grabs Issues that are ready to be worked on by anyone regression thinking labels Jul 1, 2020
@jcudit jcudit modified the milestones: v2.9.1, v3.0.0 Jul 21, 2020
@jcudit
Copy link
Contributor

jcudit commented Sep 4, 2020

Changes to unblock this are now merged into the default branch. With the v3.0.0 release likely landing mid next week.

@marco-m-pix4d
Copy link

Hello, the v3.0.0 release is out, does it mean that this bug is fixed ?

@jcudit
Copy link
Contributor

jcudit commented Sep 15, 2020

Yes, this should be resolved in the latest release. Please re-open if there are further issues.

@jcudit jcudit closed this as completed Sep 15, 2020
@lyhoanglong
Copy link

Thi bug is not fix. I still see the bug

Error: Missing required argument

The argument "token" is required, but was not set.
provider "gitlab" {
  token = "something"
}
terraform {
  required_providers {
    gitlab = {
      source = "gitlabhq/gitlab"
    }
  }
  required_version = ">= 0.13"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone thinking Type: Breaking change Used to note any change that requires a major version bump
Projects
None yet
Development

No branches or pull requests

5 participants