Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
70bfbad
feat(lint): add go-lint and validate
jshiwamV Oct 20, 2025
83cf53f
feat(push): remove push trigger
jshiwamV Oct 20, 2025
0597184
feat(fix): fix tf version
jshiwamV Oct 20, 2025
e9bc59e
feat(fmt): fix fmt
jshiwamV Oct 20, 2025
bb0306f
feat(idp): add aws setup tfs
jshiwamV Oct 20, 2025
40e3904
feat(oidc): add aws oidc setup
jshiwamV Oct 22, 2025
53f9427
feat(push): make aws test workflow visible
jshiwamV Oct 22, 2025
d5257c3
feat(push): make aws test workflow logs visible
jshiwamV Oct 22, 2025
6fdf26e
feat(test): fix cleanup with safeLoad
jshiwamV Oct 22, 2025
c040b17
feat(test): fix hardcoded regions
jshiwamV Oct 22, 2025
0e388fb
feat(role): add role duration to be 4 hours
jshiwamV Oct 22, 2025
3fb5b45
feat(role): add role duration to be 4 hours
jshiwamV Oct 22, 2025
24ab5ec
feat(iam): max duration is 8 hours
jshiwamV Oct 22, 2025
9f3ba15
feat(fixture): fix dependencies in fixtures
jshiwamV Oct 23, 2025
f945867
feat(gcp) gcp ci with SA based OIDC
jshiwamV Oct 23, 2025
9e41000
feat(gcp): fix compute perms for SA
jshiwamV Oct 23, 2025
c619ed0
feat(azure): az ci config
jshiwamV Oct 24, 2025
9a85cda
feat(azure): az ci config unsaved changes
jshiwamV Oct 24, 2025
eb11ea9
feat(oidc): fix trigger option for test and oidc fed cred refs
jshiwamV Oct 24, 2025
e9b36f0
feat(oidc): fix envs
jshiwamV Oct 24, 2025
eb52ddf
feat(location): add under envs
jshiwamV Oct 24, 2025
96bbcb8
feat(role): use contributor role for now to make things work
jshiwamV Oct 25, 2025
4069100
feat(on-approval): trigger on approval
jshiwamV Oct 27, 2025
9e072cf
feat(bugs): fix test-on-approval pr event bugs
jshiwamV Oct 27, 2025
4ed6d66
feat(backend): only keep generic info
jshiwamV Oct 27, 2025
be38f45
feat(backend): new lines
jshiwamV Oct 27, 2025
c3df554
feat(merge queue): add merge queue based CI and address comments
jshiwamV Oct 29, 2025
f198476
feat(disable): azure with paths ignore, keep manual trigger open
jshiwamV Oct 29, 2025
8afdf04
better shebang
jshiwamV Nov 1, 2025
891feb6
feat(condition): use better abac condition
jshiwamV Nov 3, 2025
ae87474
feat(odic): fix issues and disable azure for now
jshiwamV Nov 3, 2025
fe1f160
backend cleanup
jshiwamV Nov 3, 2025
23a0649
Merge branch 'main' into test-ci
jshiwamV Nov 4, 2025
496aabf
better ci and correct timeout
jshiwamV Nov 5, 2025
eca07d2
run required tests on merge event
jshiwamV Nov 6, 2025
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
25 changes: 25 additions & 0 deletions .github/setup/aws/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .github/setup/aws/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
backend "s3" {
bucket = "materialize-terraform-self-managed-state"
key = "github-setup/oidc/aws/terraform.tfstate"
region = "us-east-1"
encrypt = true
# profile = "" # Add your profile name here since backend block doesn't accept variables
}
}
35 changes: 35 additions & 0 deletions .github/setup/aws/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# IAM Role for GitHub Actions
resource "aws_iam_role" "github_actions" {
name = "mz-self-managed-github-actions-role"
max_session_duration = var.max_session_duration
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRoleWithWebIdentity"
Effect = "Allow"
Principal = {
Federated = var.oidc_provider_arn
}
Condition = {
StringEquals = {
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
}
StringLike = {
"token.actions.githubusercontent.com:sub" = "repo:MaterializeInc/materialize-terraform-self-managed:*"
}
}
}
]
})

tags = {
Name = "materialize-terraform-self-managed-github-actions-role"
}
}

# Admin policy for GitHub Actions (simplified for testing)
resource "aws_iam_role_policy_attachment" "github_actions_admin" {
role = aws_iam_role.github_actions.name
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
Copy link
Contributor

Choose a reason for hiding this comment

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

}
10 changes: 10 additions & 0 deletions .github/setup/aws/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Outputs for GitHub Actions configuration
output "github_actions_role_arn" {
description = "ARN of the IAM role for GitHub Actions"
value = aws_iam_role.github_actions.arn
}

output "github_actions_role_name" {
description = "Name of the IAM role for GitHub Actions"
value = aws_iam_role.github_actions.name
}
16 changes: 16 additions & 0 deletions .github/setup/aws/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
variable "profile" {
description = "The AWS CLI profile to use for authentication"
type = string
default = "default"
}

variable "oidc_provider_arn" {
description = "The ARN of the OIDC provider for GitHub Actions"
type = string
}

variable "max_session_duration" {
description = "The maximum session duration for the IAM role"
type = number
default = 28800 # 8 hours
}
15 changes: 15 additions & 0 deletions .github/setup/aws/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

provider "aws" {
profile = var.profile
region = "us-east-1"
}
42 changes: 42 additions & 0 deletions .github/setup/azure/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions .github/setup/azure/accessTokenLifeTime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# Exit early on error/unset var/pipe failure
set -euo pipefail

# 1. Create a 4-hour token lifetime policy and capture the policy ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# 1. Create a 4-hour token lifetime policy and capture the policy ID
#!/usr/bin/env bash
set -euo pipefail
# 1. Create a 4-hour token lifetime policy and capture the policy ID

Please always include a shebang and set shell options to reduce risk of them continuing erroneously.

POLICY_RESPONSE=$(az rest --method POST \
--url "https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies" \
--headers "Content-Type=application/json" \
--body '{
"definition": ["{\"TokenLifetimePolicy\":{\"Version\":1,\"AccessTokenLifetime\":\"04:00:00\"}}"],
"displayName": "ExtendedAccessTokenPolicy",
"isOrganizationDefault": false
}')

# 2. Extract policy ID and get application ID
POLICY_ID=$(echo $POLICY_RESPONSE | jq -r '.id')
APP_ID=$(az ad app list --display-name "mz-self-managed-github-actions" --query "[0].id" -o tsv)

echo "Policy ID: $POLICY_ID"
echo "Application ID: $APP_ID"

# 3. Assign policy to application
az rest --method POST \
--url "https://graph.microsoft.com/v1.0/applications/${APP_ID}/tokenLifetimePolicies/\$ref" \
--headers "Content-Type=application/json" \
--body "{\"@odata.id\": \"https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies/${POLICY_ID}\"}"

echo "✅ Token lifetime policy applied successfully!"
9 changes: 9 additions & 0 deletions .github/setup/azure/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
backend "s3" {
bucket = "materialize-terraform-self-managed-state"
key = "github-setup/oidc/azure/terraform.tfstate"
region = "us-east-1"
encrypt = true
# profile = "" # Add your profile name here since backend block doesn't accept variables
}
}
Loading