Skip to content

openshift-install inconsistent AWS credentials usage #336

Closed

Description

@dgoodwin

Similar to #335, it appears the installer may be unpredictable with AWS credentials. I was experimenting with running in a container using env vars for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Because it was in a container I had no ~/.aws/credentials file. This was good enough for the installer's initial phases, however once terraform ran I hit this error:

data.terraform_remote_state.assets: Refreshing state...                                                                                                                                            
data.aws_region.current: Refreshing state...                                                                                                                                                       
data.aws_availability_zones.azs: Refreshing state...                                                                                                                                               
data.aws_route53_zone.tectonic: Refreshing state...                                                                                                                                                
                                                                                                                                                                                                   
Error: Error refreshing state: 1 error(s) occurred:                                                                                                                                                
                                                                                                                                                                                                   
* module.dns.data.aws_route53_zone.tectonic: 1 error(s) occurred:                                                                                                                                  
                                                                                                                                                                                                   
* module.dns.data.aws_route53_zone.tectonic: data.aws_route53_zone.tectonic: no matching Route53Zone found                                                                                         
                                                                                                                                                                                                   
                                                                                                                                                                                                   
ERRO[0056] terraform failed: failed to run Terraform: exit status 1                                                                                                                                
FATA[0056] failed to generate asset: failed to read tfstate file "/tmp/openshift-install-314417690/infra.tfstate": open /tmp/openshift-install-314417690/infra.tfstate: no such file or directory 

On a hunch from others hitting similar issues yesterday I mounted in "-v /home/dgoodwin/.aws/credentials:/home/user/.aws/credentials:Z", in this file default was my desired credentials, and now terraform was happy to complete the install.

It appears the installer and terraform are not loading credentials the same way, specifically terraform does not appear to respect the standard env vars for AWS creds.

Activity

  1. wking commented on Sep 27, 2018

    @wking
    Member

    It appears the installer and terraform are not loading credentials the same way, specifically terraform does not appear to respect the standard env vars for AWS creds.

    I expect Terraform does this right, and our Go's hard-coded default (with no way to override in Go) is what's breaking you here. We may be able to just change the default to an empty string (or drop AWS profiles from Go entirely?), but I haven't had time to look carefully enough to be confident.

  2. dgoodwin commented on Sep 27, 2018

    @dgoodwin
    ContributorAuthor

    Using your latest dockerfile and pr #346, I was able to remove both my credentials and config volume mounts and successfully run the installer. Something may have fixed this in the last day or so.

  3. dak1n1 commented on Sep 27, 2018

    @dak1n1

    I'm getting this same error from the installer. I just did a git rebase, so I'm working from the latest code in this repo. This is my first time running it, so I might have missed a setup step. Here are some relevant system settings:

    [fedora@ip-172-31-18-42 installer]$ cat ~/.aws/config 
    [default]
    aws_access_key_id = REDACTED
    aws_secret_access_key = REDACTED
    region = us-west-1
    
    [fedora@ip-172-31-18-42 installer]$ cat ~/.bashrc
    <snip>
    export GOPATH=$HOME/golang
    export PATH=$PATH:$HOME/bin:$GOPATH/bin
    export AWS_ACCESS_KEY_ID="REDACTED"
    export AWS_SECRET_ACCESS_KEY="REDACTED"
    export AWS_DEFAULT_REGION="us-west-1"
    

    As you can see, my credentials have enough access to view Route53:

    [fedora@ip-172-31-18-42 installer]$ aws route53 list-hosted-zones
    {
        "HostedZones": [
            {
                "Id": "/hostedzone/Z2I29TC6NNC5SM",
                "Name": "aws.openshift.com.",
                "CallerReference": "B4A02993-2717-6204-8587-C5326CF75450",
                "Config": {
                    "PrivateZone": false
                },
                "ResourceRecordSetCount": 4
            },
    <snip>
    

    I'm running this on a development instance in EC2 to try out the installer:

    export OPENSHIFT_INSTALL_BASE_DOMAIN=dakinitest-installer
    export OPENSHIFT_INSTALL_CLUSTER_NAME=dakinitest-installer
    export OPENSHIFT_INSTALL_EMAIL_ADDRESS=REDACTED
    export OPENSHIFT_INSTALL_PASSWORD="REDACTED"
    export OPENSHIFT_INSTALL_PLATFORM=aws
    export OPENSHIFT_INSTALL_PULL_SECRET='{"auths": { "registry.redhat.io": { "auth": "REDACTED"  }  }}'
    export OPENSHIFT_INSTALL_SSH_PUB_KEY="REDACTED"
    export OPENSHIFT_INSTALL_AWS_REGION="us-west-1"
    
    [fedora@ip-172-31-18-42 installer]$ time bin/openshift-install cluster
    Initializing modules...
    - module.bootstrap
      Getting source "../../../modules/aws/bootstrap"
    - module.masters
      Getting source "../../../modules/aws/master"
    - module.iam
      Getting source "../../../modules/aws/iam"
    - module.dns
      Getting source "../../../modules/dns/route53"
    - module.vpc
      Getting source "../../../modules/aws/vpc"
    
    Initializing provider plugins...
    - Checking for available provider plugins on https://releases.hashicorp.com...
    - Downloading plugin for provider "ignition" (1.0.0)...
    - Downloading plugin for provider "aws" (1.8.0)...
    - Downloading plugin for provider "external" (1.0.0)...
    - Downloading plugin for provider "template" (1.0.0)...
    - Downloading plugin for provider "random" (1.0.0)...
    - Downloading plugin for provider "local" (1.0.0)...
    - Downloading plugin for provider "tls" (1.0.1)...
    - Downloading plugin for provider "null" (1.0.0)...
    - Downloading plugin for provider "archive" (1.0.0)...
    
    Terraform has been successfully initialized!
    
    You may now begin working with Terraform. Try running "terraform plan" to see
    any changes that are required for your infrastructure. All Terraform commands
    should now work.
    
    If you ever set or change modules or backend configuration for Terraform,
    rerun this command to reinitialize your working directory. If you forget, other
    commands will detect it and remind you to do so if necessary.
    data.terraform_remote_state.assets: Refreshing state...
    data.aws_region.current: Refreshing state...
    data.aws_availability_zones.azs: Refreshing state...
    data.aws_route53_zone.tectonic: Refreshing state...
    
    Error: Error refreshing state: 1 error(s) occurred:
    
    * module.dns.data.aws_route53_zone.tectonic: 1 error(s) occurred:
    
    * module.dns.data.aws_route53_zone.tectonic: data.aws_route53_zone.tectonic: no matching Route53Zone found
    
    
    ERRO[0011] terraform failed: failed to run Terraform: exit status 1 
    FATA[0011] failed to generate asset: failed to read tfstate file "/tmp/openshift-install-196927464/infra.tfstate": open /tmp/openshift-install-196927464/infra.tfstate: no such file or directory 
    
    real    0m11.646s
    user    0m9.202s
    sys     0m0.620s
    
  4. wking commented on Sep 27, 2018

    @wking
    Member
    * module.dns.data.aws_route53_zone.tectonic: data.aws_route53_zone.tectonic: no matching Route53Zone found
    

    This is a separate issue; see here. I'll port that comment into the new openshift-install doc locations.

  5. wking commented on Sep 27, 2018

    @wking
    Member

    I'll port that comment into the new openshift-install doc locations.

    #353.

  6. dak1n1 commented on Sep 27, 2018

    @dak1n1

    @wking thanks for the help! I created the public Route 53 zone and set that as my OPENSHIFT_INSTALL_BASE_DOMAIN. All's good now :)

  7. sallyom commented on Oct 8, 2018

    @sallyom
    Contributor

    see my comment in #427
    aws-sdk-go requires AWS_PROFILE be set to configure a profile other than "default", AFAICT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions