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

Bad Credentials #117

Closed
ghost opened this issue Apr 27, 2018 · 14 comments
Closed

Bad Credentials #117

ghost opened this issue Apr 27, 2018 · 14 comments

Comments

@ghost
Copy link

ghost commented Apr 27, 2018

[ec2-user@ip-0-0-0-0 ~]$ atlantis bootstrap
Welcome to Atlantis bootstrap!

This mode walks you through setting up and using Atlantis. We will
- fork an example terraform project to your username
- install terraform (if not already in your PATH)
- install ngrok so we can expose Atlantis to GitHub
- start Atlantis

Press Ctrl-c at any time to exit


GitHub username: xxxx

To continue, we need you to create a GitHub personal access token
with “repo” scope so we can fork an example terraform project.

Follow these instructions to create a token (we don’t store any tokens):
https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token
- use “atlantis” for the token description
- add “repo” scope
- copy the access token

GitHub access token (will be hidden):
=> forking repo
⠹ Error: forking repo runatlantis/atlantis-example: POST https://api.github.com/repos/runatlantis/atlantis-example/forks: 401 Bad credentials []

Usage:
 atlantis bootstrap [flags]

Flags:
 -h, --help   help for bootstrap

[ec2-user@ip-0-0-0-0 ~]$
@lkysow
Copy link
Member

lkysow commented Apr 29, 2018

I think the credentials you generated are wrong or you didn't paste them correctly. Does your token look like:
image

@michaeljeffrey
Copy link

Hi @lkysow -- I get the same thing too. Srikanth and I are both using our GitHub Enterprise accounts. Do you think that could be a factor here?

@lkysow
Copy link
Member

lkysow commented Apr 30, 2018 via email

@ghost
Copy link
Author

ghost commented Apr 30, 2018

Hi @lkysow so, we have to run bootstrap using github.com credentials and start Atlantis using enterprise token?

@lkysow
Copy link
Member

lkysow commented Apr 30, 2018

No sorry for the confusion.

atlantis bootstrap is only needed if you want to "try out" Atlantis. Basically just to see how it works. It doesn't actually set up anything for you so bootstrap is a bad name I realize. It only works with github.com.

If you want to try out Atlantis on your GitHub enterprise instance, you need to start it yourself using atlantis server and add all the needed options like gh-hostname and gh-user and gh-password for your GitHub Enterprise instance. You'll need to add a webhook manually like listed in the first link above and then you can test it out with your own repo or you could fork our repo: https://github.com/runatlantis/atlantis-example and do a pull request from example into master which just adds a terraform null_resource as an example.

@lkysow
Copy link
Member

lkysow commented May 1, 2018 via email

@ghost
Copy link
Author

ghost commented May 7, 2018

@lkysow I didn't install ngrok
running following command
sudo nohup ./atlantis server --gh-user ssoma --gh-token --gh-hostname <github.org.com> --repo-whitelist=* --gh-webhook-secret --require-approval --port 443 &

When I make any PR I see events delivering to atlantis server. However, when I comment on PR before I merge plan is not working. What am I missing? Do I've to write any atlantis.yml file in root directory just like circle CI?

@lkysow
Copy link
Member

lkysow commented May 7, 2018

what are the logs from the atlantis server? Run it with --log-level debug to get the most logs.

@ghost
Copy link
Author

ghost commented May 7, 2018

@lkysow 2018/05/04 00:52:15 [WARN] server: Atlantis started - listening on port 443
2018/05/04 00:52:36 [INFO] server: 200 | POST /events
2018/05/04 00:52:37 [INFO] server: 200 | POST /events
2018/05/04 00:53:11 [INFO] server: 200 | POST /events
2018/05/04 01:03:07 [WARN] server: Received interrupt. Safely shutting down
2018/05/04 01:03:32 [WARN] server: Atlantis started - listening on port 443
2018/05/04 01:03:52 [INFO] server: 200 | POST /events
2018/05/04 01:03:52 [INFO] server: 200 | POST /events
2018/05/04 01:05:29 [INFO] server: Deleted locks and workspace for repo NDE-Platform-Operations/terraform-scripts, pull 9
2018/05/04 01:05:29 [INFO] server: 200 | POST /events
2018/05/04 01:05:29 [INFO] server: 200 | POST /events
2018/05/04 01:05:30 [INFO] server: 200 | POST /events
2018/05/04 01:05:44 [INFO] server: Deleted locks and workspace for repo NDE-Platform-Operations/terraform-scripts, pull 8
2018/05/04 01:05:44 [INFO] server: 200 | POST /events
2018/05/04 01:05:45 [INFO] server: 200 | POST /events
2018/05/04 01:06:24 [INFO] server: 200 | POST /events
2018/05/04 01:06:43 [INFO] server: 200 | POST /events
2018/05/04 01:17:10 [INFO] server: 200 | GET /
2018/05/04 01:21:25 [INFO] server: Deleted locks and workspace for repo NDE-Platform-Operations/terraform-scripts, pull 10
2018/05/04 01:21:25 [INFO] server: 200 | POST /events
2018/05/04 01:21:26 [INFO] server: 200 | POST /events
2018/05/04 01:22:16 [INFO] server: 200 | POST /events
2018/05/04 01:24:40 [INFO] server: 200 | POST /events
2018/05/04 18:02:14 [INFO] server: 200 | POST /events

Logs seems fine

@lkysow
Copy link
Member

lkysow commented May 8, 2018

Hmm, you should be seeing a lot more output in the logs. Something like:

2018/05/08 08:18:14 middleware.go:40: [INFO] server: 200 | POST /events
2018/05/08 08:18:15 atlantis_workspace.go:59: [INFO] lkysow/atlantis-example#1: Cleaning clone directory "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:15 atlantis_workspace.go:65: [INFO] lkysow/atlantis-example#1: Creating dir "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:15 atlantis_workspace.go:70: [INFO] lkysow/atlantis-example#1: Git cloning "https://github.com/lkysow/atlantis-example.git" into "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:16 atlantis_workspace.go:77: [INFO] lkysow/atlantis-example#1: Checking out branch "example"
2018/05/08 08:18:16 plan_executor.go:81: [INFO] lkysow/atlantis-example#1: Found 1 files modified in this pull request
2018/05/08 08:18:16 project_finder.go:49: [INFO] lkysow/atlantis-example#1: Filtered modified files to 1 .tf files: [main.tf]
2018/05/08 08:18:16 project_finder.go:63: [INFO] lkysow/atlantis-example#1: There are 1 modified project(s) at path(s): .
2018/05/08 08:18:16 plan_executor.go:95: [INFO] lkysow/atlantis-example#1: Running plan for project at path "."
2018/05/08 08:18:16 project_pre_execute.go:66: [INFO] lkysow/atlantis-example#1: Acquired lock with id "lkysow/atlantis-example/./default"
2018/05/08 08:18:16 project_pre_execute.go:100: [INFO] lkysow/atlantis-example#1: Determined that we are running terraform with version >= 0.9.0. Running version 0.11.7
2018/05/08 08:18:17 terraform_client.go:129: [INFO] lkysow/atlantis-example#1: Successfully ran "sh -c terraform init -no-color" in "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:17 terraform_client.go:129: [INFO] lkysow/atlantis-example#1: Successfully ran "sh -c terraform workspace show" in "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:17 terraform_client.go:129: [INFO] lkysow/atlantis-example#1: Successfully ran "sh -c terraform plan -refresh -no-color -out /tmp/atlantis/data/repos/lkysow/atlantis-example/1/default/default.tfplan -var atlantis_user=lkysow" in "/tmp/atlantis/data/repos/lkysow/atlantis-example/1/default"
2018/05/08 08:18:17 plan_executor.go:131: [INFO] lkysow/atlantis-example#1: Plan succeeded
2018/05/08 08:18:18 events_controller.go:187: [DEBUG] server: Ignoring non-command comment: "```diff\nRefreshing Terraform state in-me..."

Are you sending all the necessary events?
image

When you type atlantis plan do you see that event being sent to Atlantis in the GitHub webhook logs:
image

And Atlantis responding:

image

@ghost
Copy link
Author

ghost commented May 9, 2018

@lkysow Thanks it helped, Now We're able to run Atlantis plan but Atlantis apply fails with following error.

exit status 1: running "sh -c terraform apply -no-color /root/.atlantis/repos/NDE-Platform-Operations/terraform-scripts/18/default/atlantis-test/default.tfplan" in "/root/.atlantis/repos/NDE-Platform-Operations/terraform-scripts/18/default/atlantis-test": 

Error: Error applying plan:

1 error(s) occurred:

* provider.aws: Not a valid region: 

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.




Error: Error applying plan:

1 error(s) occurred:

* provider.aws: Not a valid region: 

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

This is main.tf

provider "aws" {
  region = "us-east-1"
}

resource "aws_s3_bucket" "bucket" {
  bucket = "srikanth-test-atlantis"
  acl    = "private"
  region = "us-east-1"

  tags {
    Name        = "newname"
    Environment = "Dev"
  }

What am I missing here?

@lkysow
Copy link
Member

lkysow commented May 10, 2018

When you run terraform apply locally is there an error? Atlantis isn't doing anything other than running terraform apply so that error indicates to me that either your terraform locally is incorrect OR maybe you haven't pushed the latest version to your branch.

@ghost
Copy link
Author

ghost commented May 10, 2018

@lkysow terraform apply worked locally
screen shot 2018-05-10 at 10 21 05 am I pushed latest code I verified

@ghost
Copy link
Author

ghost commented May 10, 2018

@lkysow It is working fine now didn't make any changes. Strange!

@ghost ghost closed this as completed May 10, 2018
lkysow added a commit that referenced this issue May 30, 2018
Bootstrap is meant for a system that sets itself up. This command is
more like a testing mode so I want to rename it to avoid confusion.

Fixes #129 and came out of #117.
meringu pushed a commit to meringu/atlantis that referenced this issue May 29, 2023
runatlantis#117)

* Adding support for https cloning using github username and token provided instead of using ssh

* Update event_parser.go

* now using new name for CloneURL that is sanitized and has no username and password
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants