Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add image_uri to data source aws_lambda_function #21015

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/21015.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data source/aws_lambda_function: Add `image_uri` attribute
```
8 changes: 8 additions & 0 deletions internal/service/lambda/function_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ func DataSourceFunction() *schema.Resource {
Type: schema.TypeString,
},
},
"image_uri": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -258,6 +262,10 @@ func dataSourceFunctionRead(d *schema.ResourceData, meta interface{}) error {
d.Set("kms_key_arn", function.KMSKeyArn)
d.Set("last_modified", function.LastModified)

if output.Code != nil {
d.Set("image_uri", output.Code.ImageUri)
}

if err := d.Set("layers", flattenLayers(function.Layers)); err != nil {
return fmt.Errorf("Error setting layers for Lambda Function (%s): %w", d.Id(), err)
}
Expand Down
1 change: 1 addition & 0 deletions internal/service/lambda/function_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func TestAccLambdaFunctionDataSource_image(t *testing.T) {
Config: testAccFunctionImageDataSourceConfig(rName, imageLatestID),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair(dataSourceName, "code_signing_config_arn", resourceName, "code_signing_config_arn"),
resource.TestCheckResourceAttrPair(dataSourceName, "image_uri", resourceName, "image_uri"),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/lambda_function.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ In addition to all arguments above, the following attributes are exported:
* `environment` - The Lambda environment's configuration settings.
* `file_system_config` - The connection settings for an Amazon EFS file system.
* `handler` - The function entrypoint in your code.
* `image_uri` - The URI of the container image.
* `invoke_arn` - The ARN to be used for invoking Lambda Function from API Gateway.
* `kms_key_arn` - The ARN for the KMS encryption key.
* `last_modified` - The date this resource was last modified.
Expand Down