Skip to content

Commit

Permalink
Merge pull request #1266 from turkenf/fix-issue-1027
Browse files Browse the repository at this point in the history
Fix update loop for Function.lambda resource
  • Loading branch information
turkenf authored Apr 24, 2024
2 parents 4bd0432 + 7b22448 commit 5daf796
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
1 change: 1 addition & 0 deletions apis/lambda/v1beta1/zz_function_terraformed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions apis/lambda/v1beta1/zz_function_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions config/lambda/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ func Configure(p *config.Provider) {
SelectorFieldName: "SubnetIDSelector",
}
delete(r.TerraformResource.Schema, "filename")
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"source_code_hash"},
}
r.MetaResource.ArgumentDocs["source_code_hash"] = "Used to trigger updates. Must be set to " +
"a base64 encoded SHA256 hash of the package file specified with either filename or s3_key. " +
"If you have specified this field manually, it should be the actual (computed) hash of the " +
"underlying lambda function specified in the filename, image_uri, s3_bucket fields."
})

p.AddResourceConfigurator("aws_lambda_function_event_invoke_config", func(r *config.Resource) {
Expand Down
2 changes: 1 addition & 1 deletion examples/lambda/v1beta1/function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
name: example
spec:
forProvider:
s3Bucket: upbound-provider-test-data
s3Bucket: official-provider-test-data
s3Key: hello-python.zip
handler: index.py
packageType: Zip
Expand Down
33 changes: 15 additions & 18 deletions package/crds/lambda.aws.upbound.io_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,11 @@ spec:
type: object
type: array
sourceCodeHash:
description: Used to trigger updates. Must be set to a base64-encoded
SHA256 hash of the package file specified with either filename
or s3_key. The usual way to set this is filebase64sha256("file.11.12
and later) or base64sha256(file("file.11.11 and earlier), where
"file.zip" is the local filename of the lambda function source
archive.
description: Used to trigger updates. Must be set to a base64
encoded SHA256 hash of the package file specified with either
filename or s3_key. If you have specified this field manually,
it should be the actual (computed) hash of the underlying lambda
function specified in the filename, image_uri, s3_bucket fields.
type: string
tags:
additionalProperties:
Expand Down Expand Up @@ -1439,12 +1438,11 @@ spec:
type: object
type: array
sourceCodeHash:
description: Used to trigger updates. Must be set to a base64-encoded
SHA256 hash of the package file specified with either filename
or s3_key. The usual way to set this is filebase64sha256("file.11.12
and later) or base64sha256(file("file.11.11 and earlier), where
"file.zip" is the local filename of the lambda function source
archive.
description: Used to trigger updates. Must be set to a base64
encoded SHA256 hash of the package file specified with either
filename or s3_key. If you have specified this field manually,
it should be the actual (computed) hash of the underlying lambda
function specified in the filename, image_uri, s3_bucket fields.
type: string
tags:
additionalProperties:
Expand Down Expand Up @@ -2047,12 +2045,11 @@ spec:
type: object
type: array
sourceCodeHash:
description: Used to trigger updates. Must be set to a base64-encoded
SHA256 hash of the package file specified with either filename
or s3_key. The usual way to set this is filebase64sha256("file.11.12
and later) or base64sha256(file("file.11.11 and earlier), where
"file.zip" is the local filename of the lambda function source
archive.
description: Used to trigger updates. Must be set to a base64
encoded SHA256 hash of the package file specified with either
filename or s3_key. If you have specified this field manually,
it should be the actual (computed) hash of the underlying lambda
function specified in the filename, image_uri, s3_bucket fields.
type: string
sourceCodeSize:
description: Size in bytes of the function .zip file.
Expand Down

0 comments on commit 5daf796

Please sign in to comment.