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

Add NREL GHA runner WIF setup #3952

Merged
merged 2 commits into from
Dec 30, 2024
Merged

Add NREL GHA runner WIF setup #3952

merged 2 commits into from
Dec 30, 2024

Conversation

jdangerx
Copy link
Member

@jdangerx jdangerx commented Nov 8, 2024

Overview

Helps with catalyst-cooperative/nrel-fuel-and-industry-inputs#5.

What problem does this address?

The NREL github runner didn't have access to the archives on GCP.

What did you change?

  • put archives.catalyst.coop bucket under terraform management
  • add service account, permissions, and WIF for NREL GH runner

Testing

Here was the terraform plan. It took two applys to actually get it to stick since the service account took a little time to create.

Terraform will perform the following actions:                                                                                   
                                                                                                                                
  # google_service_account.nrel_finito_inputs_gha will be created                                                               
  + resource "google_service_account" "nrel_finito_inputs_gha" {                                                                
      + account_id   = "nrel-finito-inputs-gha"                                                                                 
      + disabled     = false                                              
      + display_name = "NREL FINITO inputs github action service account"                                                                                                                           
      + email        = (known after apply)                                                                                                                                
      + id           = (known after apply)                      
      + member       = (known after apply)                                                       
      + name         = (known after apply)                                                                                                            
      + project      = "catalyst-cooperative-pudl"                                                                             
      + unique_id    = (known after apply)                                                                                      
    }                                                                                                                                                 
                                                                                    
  # google_storage_bucket_iam_member.nrel_finito_inputs_archiver_gcs_iam["roles/storage.insightsCollectorService"] will be created                                                                   
  + resource "google_storage_bucket_iam_member" "nrel_finito_inputs_archiver_gcs_iam" {                                         
      + bucket = "archives.catalyst.coop"                                                                                       
      + etag   = (known after apply)                            
      + id     = (known after apply)                                                                                                                                      
      + member = (known after apply)                           
      + role   = "roles/storage.insightsCollectorService"                                                                      
    }                                                                                                                                                                     
                                                                                                 
  # google_storage_bucket_iam_member.nrel_finito_inputs_archiver_gcs_iam["roles/storage.objectCreator"] will be created                                                                             
  + resource "google_storage_bucket_iam_member" "nrel_finito_inputs_archiver_gcs_iam" {                                                               
      + bucket = "archives.catalyst.coop"                                                        
      + etag   = (known after apply)                                                                                                                  
      + id     = (known after apply)                                                                                                                                                                
      + member = (known after apply)                                      
      + role   = "roles/storage.objectCreator"                                                                                                        
    }                                                                                                                                                                                               
                                                                                                                                                      
  # google_storage_bucket_iam_member.nrel_finito_inputs_archiver_gcs_iam["roles/storage.objectViewer"] will be created                                                    
  + resource "google_storage_bucket_iam_member" "nrel_finito_inputs_archiver_gcs_iam" {                                         
      + bucket = "archives.catalyst.coop"                                           
      + etag   = (known after apply)                                                                                                                                      
      + id     = (known after apply)                                                
      + member = (known after apply)                                                                                                                                      
      + role   = "roles/storage.objectViewer"                                                                                                                             
    }                                                                                                                                                                     
                                                                                                 
  # module.gh_oidc.google_service_account_iam_member.wif-sa["nrel-finito-inputs-gha"] will be created                           
  + resource "google_service_account_iam_member" "wif-sa" {                                                                    
      + etag               = (known after apply)                                                                               
      + id                 = (known after apply)                                                                                                                                                    
      + member             = "principalSet://iam.googleapis.com/projects/345950277072/locations/global/workloadIdentityPools/gh-actions-pool/attribute.repository/catalyst-cooperative/nrel-fuel-and-industry-inputs"
      + role               = "roles/iam.workloadIdentityUser"                                                                                                                                       
      + service_account_id = "projects/catalyst-cooperative-pudl/serviceAccounts/nrel-finito-inputs-gha@catalyst-cooperative-pudl.iam.gserviceaccount.com"                                           
    }                                                                                                                                                                                               
                                                               
Plan: 5 to add, 0 to change, 0 to destroy.   

@jdangerx jdangerx requested review from e-belfer and zschira November 8, 2024 21:38
@jdangerx
Copy link
Member Author

jdangerx commented Nov 8, 2024

@e-belfer more of an FYI - and @zschira more of an "actually review this terraform setup" thing.

@zschira
Copy link
Member

zschira commented Nov 25, 2024

@e-belfer if NREL is switching to onedrive, it seems this might be outdated now?

@e-belfer
Copy link
Member

@zschira We still will be working on this project through December and who knows, there may be future iterations. So for now I think we should keep it as is / not take it down.

@jdangerx
Copy link
Member Author

Since this reflects the latest infra state in GCP we should merge it. Otherwise I can't make new changes to infrastructure without basing my terraform config off of this branch. If we want to undo the NREL WIF changes later it's very easy to just delete all this stuff and make terraform remove the infrastructure.

@jdangerx jdangerx enabled auto-merge December 30, 2024 15:45
Copy link
Member

@zschira zschira left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, approved!

@jdangerx jdangerx added this pull request to the merge queue Dec 30, 2024
Merged via the queue into main with commit 976388a Dec 30, 2024
17 checks passed
@jdangerx jdangerx deleted the setup-nrel-wif branch December 30, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants