Просмотр исходного кода

chore: remove gh role from infra

Adam 2 месяцев назад
Родитель
Сommit
4862c3e765
2 измененных файлов с 0 добавлено и 44 удалено
  1. 0 43
      infra/stage.ts
  2. 0 1
      sst.config.ts

+ 0 - 43
infra/stage.ts

@@ -9,49 +9,6 @@ export const zoneID = "430ba34c138cfb5360826c4909f99be8"
 export const awsStage = $app.stage === "production" ? "production" : "dev"
 export const awsStage = $app.stage === "production" ? "production" : "dev"
 export const deployAws = $app.stage === awsStage
 export const deployAws = $app.stage === awsStage
 
 
-const githubActionsDeployRole = (() => {
-  if ($app.stage !== "dev" && $app.stage !== "production") return
-
-  const provider = new aws.iam.OpenIdConnectProvider("GithubActionsOidcProvider", {
-    url: "https://token.actions.githubusercontent.com",
-    clientIdLists: ["sts.amazonaws.com"],
-  })
-  const role = new aws.iam.Role("GithubActionsDeployRole", {
-    name: `opencode-${$app.stage}-github-actions-deploy`,
-    maxSessionDuration: 3600,
-    assumeRolePolicy: aws.iam.getPolicyDocumentOutput({
-      statements: [
-        {
-          effect: "Allow",
-          actions: ["sts:AssumeRoleWithWebIdentity"],
-          principals: [{ type: "Federated", identifiers: [provider.arn] }],
-          conditions: [
-            {
-              test: "StringEquals",
-              variable: "token.actions.githubusercontent.com:aud",
-              values: ["sts.amazonaws.com"],
-            },
-            {
-              test: "StringEquals",
-              variable: "token.actions.githubusercontent.com:sub",
-              values: [`repo:anomalyco/opencode:environment:${$app.stage}`],
-            },
-          ],
-        },
-      ],
-    }).json,
-  })
-
-  new aws.iam.RolePolicyAttachment("GithubActionsDeployRoleAdmin", {
-    role: role.name,
-    policyArn: "arn:aws:iam::aws:policy/AdministratorAccess",
-  })
-
-  return role
-})()
-
-export const githubActionsDeployRoleArn = githubActionsDeployRole?.arn
-
 new cloudflare.RegionalHostname("RegionalHostname", {
 new cloudflare.RegionalHostname("RegionalHostname", {
   hostname: domain,
   hostname: domain,
   regionKey: "us",
   regionKey: "us",

+ 0 - 1
sst.config.ts

@@ -51,7 +51,6 @@ export default $config({
       StatWorkerUrl: stat.url,
       StatWorkerUrl: stat.url,
       // StatsUrl: stats.app.url,
       // StatsUrl: stats.app.url,
       AwsStage: stage.awsStage,
       AwsStage: stage.awsStage,
-      ...(stage.githubActionsDeployRoleArn ? { GithubActionsDeployRoleArn: stage.githubActionsDeployRoleArn } : {}),
     }
     }
   },
   },
 })
 })