Skip to content

Commit ed94251

Browse files
committed
add API_KEYS_FILE and STORAGE_PROFILE_FILE to migration
1 parent aa05e00 commit ed94251

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

generated-templates/lakerunner-migration.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ Resources:
9393
Value: lakerunner
9494
- Name: CONFIGDB_SSLMODE
9595
Value: require
96+
- Name: API_KEYS_FILE
97+
Value: env:API_KEYS_ENV
98+
- Name: STORAGE_PROFILE_FILE
99+
Value: env:STORAGE_PROFILES_ENV
96100
Image: !Ref 'ContainerImage'
97101
LogConfiguration:
98102
LogDriver: awslogs
@@ -112,6 +116,10 @@ Resources:
112116
- '${S}:password::'
113117
- S: !ImportValue
114118
Fn::Sub: ${CommonInfraStackName}-DbSecretArn
119+
- Name: API_KEYS_ENV
120+
ValueFrom: !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/api_keys'
121+
- Name: STORAGE_PROFILES_ENV
122+
ValueFrom: !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/storage_profiles'
115123
Cpu: !Ref 'Cpu'
116124
ExecutionRoleArn: !GetAtt 'TaskExecutionRole.Arn'
117125
Family: lakerunner-migration
@@ -323,6 +331,12 @@ Resources:
323331
- ${SecretArn}*
324332
- SecretArn: !ImportValue
325333
Fn::Sub: ${CommonInfraStackName}-DbSecretArn
334+
- Action:
335+
- ssm:GetParameter
336+
Effect: Allow
337+
Resource:
338+
- !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/api_keys'
339+
- !Sub 'arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/storage_profiles'
326340
Version: '2012-10-17'
327341
PolicyName: TaskExecutionSecretsPolicy
328342
Type: AWS::IAM::Role

src/lakerunner_migration.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ def ci_export(suffix):
181181
"Effect": "Allow",
182182
"Action": ["secretsmanager:GetSecretValue"],
183183
"Resource": [Sub("${SecretArn}*", SecretArn=DbSecretArnValue)]
184+
},
185+
{
186+
"Effect": "Allow",
187+
"Action": ["ssm:GetParameter"],
188+
"Resource": [
189+
Sub("arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/api_keys"),
190+
Sub("arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/storage_profiles")
191+
]
184192
}
185193
]
186194
}
@@ -224,10 +232,14 @@ def ci_export(suffix):
224232
Environment(Name="CONFIGDB_DBNAME", Value="lakerunner"),
225233
Environment(Name="CONFIGDB_USER", Value="lakerunner"),
226234
Environment(Name="CONFIGDB_SSLMODE", Value="require"),
235+
Environment(Name="API_KEYS_FILE", Value="env:API_KEYS_ENV"),
236+
Environment(Name="STORAGE_PROFILE_FILE", Value="env:STORAGE_PROFILES_ENV"),
227237
],
228238
Secrets=[
229239
EcsSecret(Name="LRDB_PASSWORD", ValueFrom=Sub("${S}:password::", S=DbSecretArnValue)),
230-
EcsSecret(Name="CONFIGDB_PASSWORD", ValueFrom=Sub("${S}:password::", S=DbSecretArnValue))
240+
EcsSecret(Name="CONFIGDB_PASSWORD", ValueFrom=Sub("${S}:password::", S=DbSecretArnValue)),
241+
EcsSecret(Name="API_KEYS_ENV", ValueFrom=Sub("arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/api_keys")),
242+
EcsSecret(Name="STORAGE_PROFILES_ENV", ValueFrom=Sub("arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/lakerunner/storage_profiles"))
231243
]
232244
)
233245
]

0 commit comments

Comments
 (0)