Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions modules/flyte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.1.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | ~> 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.0 |

## Modules

Expand All @@ -36,6 +38,7 @@ No modules.
| [aws_s3_bucket_policy.flyte_metadata](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.flye_metadata_encryption](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.flyte_data_encryption](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [random_id.server](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
| [aws_caller_identity.aws_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.flyte_controlplane](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.flyte_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
21 changes: 21 additions & 0 deletions modules/flyte/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ resource "aws_iam_role_policy_attachment" "flyte_controlplane" {
policy_arn = aws_iam_policy.flyte_controlplane.arn
}

resource "random_id" "server" {
keepers = {
# Generate a new id each time there's a new deploy id (which should never occur)
deploy_id = local.deploy_id
}

byte_length = 8
}

resource "aws_iam_role" "flyte_dataplane" {
name = "${local.deploy_id}-flyte-dataplane"
assume_role_policy = jsonencode({
Expand Down Expand Up @@ -91,6 +100,18 @@ resource "aws_iam_role" "flyte_dataplane" {
}
}
},
{
Action = "sts:AssumeRoleWithWebIdentity"
Effect = "Allow"
Principal = {
Federated = "accounts.google.com"
}
Condition : {
StringEquals : {
"accounts.google.com:aud" : "${local.deploy_id}-flyte-gcp-${random_id.server.hex}"
}
}
},
Copy link
Contributor Author

@ddl-ebrown ddl-ebrown Oct 24, 2025

Choose a reason for hiding this comment

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

Azure will look something like this

{
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Federated": "arn:aws:iam::<AWS_ACCOUNT_ID>:oidc-provider/sts.windows.net/<AZURE_AD_TENANT_ID>/"
          },
          "Action": "sts:AssumeRoleWithWebIdentity",
          "Condition": {
            "StringEquals": {
              "sts.windows.net/<AZURE_AD_TENANT_ID>/:aud": "<AZURE_AD_APPLICATION_ID>"
            }
          }
        }
      ]
    }

OR

{
    "Version": 2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Principal": {
            "Federated": "arn:aws:iam::<AWS Account ID>:oidc-provider/sts.windows.net/<Microsoft Entra Tenant ID>/"
        },
        "Action": "sts:AssumeRoleWithWebIdentity",
        "Condition": {
            "StringEquals": {
                "sts.windows.net/<Microsoft Entra Tenant ID>/:aud": "<Application ID URI>",
                "sts.windows.net/<Microsoft Entra Tenant ID>/:sub": "<Managed Identity’s Object (Principal)ID>"
            }
        }
    }]
}

More details in https://aws.amazon.com/blogs/security/how-to-access-aws-resources-from-microsoft-entra-id-tenants-using-aws-security-token-service/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened up a separate PR at #412 for that since it will generally be a pain

]
})
}
Expand Down
1 change: 1 addition & 0 deletions modules/flyte/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ output "eks" {
data_bucket = aws_s3_bucket.flyte_data.bucket
controlplane_role_arn = aws_iam_role.flyte_controlplane.arn
dataplane_role_arn = aws_iam_role.flyte_dataplane.arn
gcp_token_audience = "${local.deploy_id}-flyte-gcp-${random_id.server.hex}"
}
}
4 changes: 4 additions & 0 deletions modules/flyte/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ terraform {
source = "hashicorp/aws"
version = "~> 5.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.0"
}
}
}
Loading