Skip to content

Commit d9a6ddc

Browse files
committed
change
1 parent 4a097dc commit d9a6ddc

File tree

4 files changed

+61
-68
lines changed

4 files changed

+61
-68
lines changed

.github/workflows/build-backend.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ jobs:
1010
name: Build
1111
runs-on: ${{ format('arm64-fargate-{0}{1}{2}', github.run_id, github.run_number, github.run_attempt) }}
1212
steps:
13-
- uses: actions/checkout@v4
14-
with:
15-
ref: ${{ github.ref }}
16-
fetch-depth: 0
17-
- name: Configure AWS credentials
18-
uses: aws-actions/configure-aws-credentials@v4
19-
with:
20-
aws-access-key-id: ${{ secrets.aws_access_key_id }}
21-
aws-secret-access-key: ${{ secrets.aws_secret_access_key }}
22-
aws-region: eu-central-1
23-
- name: Login to Amazon ECR
24-
uses: aws-actions/amazon-ecr-login@v2
25-
# - run: tail -f /dev/null
2613
- name: Run kaniko
2714
run: |
2815
/kaniko/executor \

infrastructure/global/.terraform.lock.hcl

Lines changed: 17 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infrastructure/global/ecr_repos/main.tf

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
locals {
22
services = [
33
"pycon-backend",
4+
"pycon-backend/cache",
45
"pycon-frontend",
5-
"pretix"
6+
"pycon-frontend/cache",
7+
"pretix",
8+
"pretix/cache",
69
]
10+
infrastructure_tools_account_id = [
11+
for account in data.aws_organizations_organization.organization.non_master_accounts :
12+
account.id
13+
if account.name == "Infrastructure Tools"
14+
][0]
715
}
816

17+
data "aws_organizations_organization" "organization" {}
18+
919
resource "aws_ecr_repository" "service_repo" {
1020
for_each = toset(local.services)
1121
name = "pythonit/${each.key}"
@@ -15,3 +25,35 @@ resource "aws_ecr_repository" "service_repo" {
1525
scan_on_push = false
1626
}
1727
}
28+
29+
data "aws_iam_policy_document" "access_from_infrastructure_account" {
30+
statement {
31+
sid = "access from infrastructure account"
32+
effect = "Allow"
33+
34+
principals {
35+
type = "AWS"
36+
identifiers = [local.infrastructure_tools_account_id]
37+
}
38+
39+
actions = [
40+
"ecr:GetDownloadUrlForLayer",
41+
"ecr:BatchGetImage",
42+
"ecr:BatchCheckLayerAvailability",
43+
"ecr:PutImage",
44+
"ecr:InitiateLayerUpload",
45+
"ecr:UploadLayerPart",
46+
"ecr:CompleteLayerUpload",
47+
"ecr:DescribeRepositories",
48+
"ecr:GetRepositoryPolicy",
49+
"ecr:ListImages",
50+
"ecr:BatchDeleteImage",
51+
]
52+
}
53+
}
54+
55+
resource "aws_ecr_repository_policy" "access_from_infrastructure_account" {
56+
for_each = toset(local.services)
57+
repository = aws_ecr_repository.service_repo[each.key].name
58+
policy = data.aws_iam_policy_document.access_from_infrastructure_account.json
59+
}

infrastructure/global/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "5.64.0"
5+
version = "5.82.2"
66
}
77
}
88

0 commit comments

Comments
 (0)