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

Google cloud oidc integration #55

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ runs:
echo "sort-by=$(atmos describe config -f json | jq -r '.integrations.github.gitops.matrix["sort-by"]')" >> $GITHUB_OUTPUT
echo "aws-region=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].region')" >> $GITHUB_OUTPUT
echo "terraform-plan-role=$(atmos describe config -f json | jq -r '.integrations.github.gitops.role.plan')" >> $GITHUB_OUTPUT
echo "google-workload-identity-provider=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]."google-workload-identity-provider"')" >> $GITHUB_OUTPUT
echo "google-service-account=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"]."google-service-account"')" >> $GITHUB_OUTPUT
echo "backend=$(atmos describe config -f json | jq -r '.integrations.github.gitops["artifact-storage"].backend')" >> $GITHUB_OUTPUT

- name: Install Terraform
if: ${{ steps.config.outputs.terraform-version != '' && steps.config.outputs.terraform-version != 'null' }}
Expand Down Expand Up @@ -163,6 +166,7 @@ runs:
- name: Configure Plan AWS Credentials
if: ${{ steps.config.outputs.aws-region != '' &&
steps.config.outputs.aws-region != 'null' &&
steps.config.outputs.backend == 'aws' &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
steps.config.outputs.backend == 'aws' &&

steps.config.outputs.terraform-plan-role != '' &&
steps.config.outputs.terraform-plan-role != 'null' }}
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -172,6 +176,13 @@ runs:
role-session-name: "atmos-terraform-plan-gitops"
mask-aws-account-id: "no"

- name: Configure Google Credentials
if: ${{ steps.config.outputs.backend == 'google' }}
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ steps.config.outputs.google-workload-identity-provider }}
service_account: ${{ steps.config.outputs.google-service-account }}

Comment on lines +179 to +185
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit confusing part. Let's discuss.
The current atmos gitops pattern assume there are 2 types of AWS creds

integrations:
  github:
    gitops:
....
      artifact-storage:
....
        role: arn:aws:iam::xxxxxxxxxxxx:role/cptest-core-ue2-auto-gitops-gha
      role:
        plan: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
        apply: arn:aws:iam::yyyyyyyyyyyy:role/cptest-core-gbl-identity-gitops
....
  1. IAM role integration.github.gitops.artifact-storage.role that used to read/write plan file to storage
  2. IAM role integration.github.gitops.role.plan / integration.github.gitops.role.apply that used to run terraform plan / apply.

The second ones have wider permissions.
Really, eventually, we'd like to deprecate that part of the config.
Allow external AWS auth actions because we can not support all levels of AWS auth.

I had a feeling that in the case of Google Cloud, you mixed those two types of auth.
I think we do not need the step.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved auth step to GH worklfow in our own project. As you were saying it is not needed here.

- name: atmos affected stacks for atmos pro
id: affected-pro
if: ${{ inputs.atmos-pro-upload == 'true' }}
Expand Down
Loading