File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed
Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,12 @@ The configuration file has the following structure:
2424
2525``` toml
2626bundle =" /path/containing/code/to/bundle/into/build" # default is none
27+ iam_role_prefix =" my-prefix-" # default is "pf-" for PicoFun
2728layers =" arn:aws:lambda:us-east-1:012345678910:layer:example:1,arn:aws:lambda:us-east-1:012345678910:layer:another-example:123" # default is none
2829output_dir =" /path/to/write/output-files" # default is current-working-directory/output
2930postprocessor =" fully.qualified.reference.to.postprocessor" # default is none
3031preprocessor =" fully.qualified.reference.to.preprocessor" # default is none
32+ role_permissions_boundary =" arn:aws:iam::012345678910:policy/..." # default is none
3133subnets =" subnet-1234567890abcdef0,subnet-234567890abcdef01" # default is none and VPC networking is no enabled
3234tags =... # default is none
3335template_path =" /path/to/templates" # default is current-working-directory/templates
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ class Config:
1515 _attrs : typing .ClassVar [dict [str : typing .Any ]] = {
1616 "_config_file" : str ,
1717 "bundle" : str ,
18+ "iam_role_prefix" : str ,
1819 "layers" : list ,
1920 "output_dir" : str ,
2021 "postprocessor" : str ,
2122 "preprocessor" : str ,
23+ "role_permissions_boundary" : str ,
2224 "subnets" : list ,
2325 "tags" : dict ,
2426 "template_path" : str ,
@@ -147,10 +149,12 @@ def set_defaults(self) -> None:
147149 defaults = {
148150 "_config_file" : "" ,
149151 "bundle" : None ,
152+ "iam_role_prefix" : "pf-" ,
150153 "layers" : [],
151154 "output_dir" : os .path .realpath (os .path .join (os .getcwd (), "output" )),
152155 "postprocessor" : "" ,
153156 "preprocessor" : "" ,
157+ "role_permissions_boundary" : None ,
154158 "subnets" : [],
155159 "tags" : {},
156160 "template_path" : os .path .join (files ("picofun" ), "templates" ),
Original file line number Diff line number Diff line change @@ -122,9 +122,10 @@ resource "aws_lambda_function" "this" {
122122}
123123
124124resource "aws_iam_role" "lambda" {
125- name = "pf- {{ namespace }}"
125+ name = "{{ iam_role_prefix }} {{ namespace }}"
126126
127127 assume_role_policy = data.aws_iam_policy_document.lambda_assume_role.json
128+ permissions_boundary = {{ '"{}"'.format(role_permissions_boundary) if role_permissions_boundary else "null" }}
128129
129130 tags = local.tags
130131}
Original file line number Diff line number Diff line change @@ -33,10 +33,12 @@ def generate(
3333 template = self ._template .get ("main.tf.j2" )
3434
3535 terraform_content = template .render (
36- namespace = self ._namespace ,
36+ bundle = self ._config .bundle ,
37+ iam_role_prefix = self ._config .iam_role_prefix ,
3738 lambdas = lambdas ,
3839 layers = self ._config .layers ,
39- bundle = self ._config .bundle ,
40+ namespace = self ._namespace ,
41+ role_permissions_boundary = self ._config .role_permissions_boundary ,
4042 subnets = self ._config .subnets ,
4143 tags = self ._config .tags ,
4244 )
You can’t perform that action at this time.
0 commit comments