Skip to content

Add new OIDC role for source mirror updates#1343

Closed
kwryankrattiger wants to merge 4 commits into
spack:mainfrom
kwryankrattiger:gh_source_mirror_oidc
Closed

Add new OIDC role for source mirror updates#1343
kwryankrattiger wants to merge 4 commits into
spack:mainfrom
kwryankrattiger:gh_source_mirror_oidc

Conversation

@kwryankrattiger
Copy link
Copy Markdown
Collaborator

Add OIDC role for source mirror sync from GHA.

cc: @alecbcs

Ubuntu 22 has v1.12.1 available. This seems to work okay with the
configs we have currently so it is probably okay to allow.
}

condition {
test = "StringEqual"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
test = "StringEqual"
test = "StringEquals"

statement {
effect = "Allow"
actions = ["s3:PutObject", "s3:ListBucket"]
resources = ["${data.aws_s3_bucket.source_mirror}/*"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this work with terraform plan? I think it needs to be

Suggested change
resources = ["${data.aws_s3_bucket.source_mirror}/*"]
resources = ["${data.aws_s3_bucket.source_mirror.arn}/*"]

Docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket#arn-1

data "aws_iam_policy_document" "update_source_mirror" {
statement {
effect = "Allow"
actions = ["s3:PutObject", "s3:ListBucket"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ListBucket is a bucket-level action, so it needs to be applied to a bucket resources. i.e. resources = [data.aws_s3_bucket.source_mirror], not resources = ["${data.aws_s3_bucket.source_mirror}/*"]

Comment on lines +1 to +11
variable "deployment_name" {
type = string
}

variable "deployment_stage" {
type = string
}

variable "region" {
type = string
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file isn't needed (see comment about module)

Suggested change
variable "deployment_name" {
type = string
}
variable "deployment_stage" {
type = string
}
variable "region" {
type = string
}

Comment on lines +29 to +37

module "spack_github" {
source = "../modules/spack_github"

deployment_name = "prod"
deployment_stage = "blue"

region = "us-east-1"
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This module block isn't needed if we move the new resources into the production module directly (see comment below)

Suggested change
module "spack_github" {
source = "../modules/spack_github"
deployment_name = "prod"
deployment_stage = "blue"
region = "us-east-1"
}

@@ -0,0 +1,57 @@
locals {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file doesn't need to be its own module - it's not using any of the variables it takes as input, and isn't reused anywhere. We can just move this entire file to terraform/production/mirrors_iam.tf, and that eliminates all the unncessary module boilerplate.

Essentially, exactly what we do for this file https://github.com/spack/spack-infrastructure/blob/main/terraform/production/iam.tf

@jjnesbitt
Copy link
Copy Markdown
Collaborator

Closed in favor #1344

@jjnesbitt jjnesbitt closed this Apr 23, 2026
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

Successfully merging this pull request may close these issues.

3 participants