ovotech / circleci-orbs

CircleCI Orbs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[terraform] Gracefully handle no github environment variables in apply step

bnjns opened this issue · comments

We are using the terraform orb to plan and apply our infrastructure, but we aren't needed to have the jobs automatically close PRs in GitHub so we don't have any of the GitHub environment variables set.

terraform/plan is absolutely fine with this, but terraform/apply gives the following error message between the init and plan stages:

Traceback (most recent call last):
  File "/tmp/github.py", line 10, in <module>
    github_username = os.environ['GITHUB_USERNAME']
  File "/usr/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'GITHUB_USERNAME'
Unable to update status on PR

The rest of the job still continues, but it would be nice not to have this error message, as it pollutes the output a little.

Orb version: ovotech/terraform@1.6.1
Terraform version: 0.12.17

We are using the terraform orb to plan and apply our infrastructure, but we aren't needed to have the jobs automatically close PRs in GitHub so we don't have any of the GitHub environment variables set.

terraform/plan is absolutely fine with this, but terraform/apply gives the following error message between the init and plan stages:

Traceback (most recent call last):
  File "/tmp/github.py", line 10, in <module>
    github_username = os.environ['GITHUB_USERNAME']
  File "/usr/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'GITHUB_USERNAME'
Unable to update status on PR

The rest of the job still continues, but it would be nice not to have this error message, as it pollutes the output a little.

Orb version: ovotech/terraform@1.6.1
Terraform version: 0.12.17

Hi bnjns

are you able to workout may i know how you guys setup things because we are using circleci recently and i want deploy my terraform code into AWS could you please help me out

Thanks in advance