Resource for Greengrass component version.
Create a component from a recipe
resource "awscc_greengrassv2_component_version" "MyGreengrassComponentVersion_example" {
inline_recipe = jsonencode({
"RecipeFormatVersion" = "2020-01-25"
"ComponentName" = "MyLambdaComponent"
"ComponentVersion" = "1.0.0"
"ComponentDescription" = "This is a sample Greengrass component created using InlineRecipe."
"Manifests" = [
{
"Platform" = {
"os" = "linux"
"arch" = "armhf"
}
"Lifecycle" = {
"install" = {
"script" = "apt-get install -y my-package"
}
"run" = {
"script" = "python3 my_script.py"
}
}
}
]
})
tags = {
MyTagKey = "MyTagValue"
}
}
Create a component from a lambda-function
#Example with lambda function
resource "aws_greengrassv2_component_version" "MyGreengrassComponentVersion" {
lambda_function {
lambda_arn = "arn:aws:lambda:<region>:<account-id>:function:<LambdaFunctionName>:<version>"
component_name = "MyLambdaComponent"
component_version = "1.0.0"
}
tags = {
Environment = "Production"
Project = "Greengrass-awscc-Project"
}
}
Create a component from a lambda-function and its nested schema
resource "aws_greengrassv2_component_version" "MyGreengrassComponentVersion-NestedLambda" {
lambda_function {
component_name = "MyLambdaComponent"
component_version = "1.0.0"
lambda_arn = "arn:aws:lambda:<region>:<account>:function:<LambdaFunctionName>:<LambdaVersion>"
component_dependencies {
dependency_type = "runtime"
version_requirement = ">=1.0.0"
}
component_lambda_parameters {
environment_variables = {
ENV_VAR1 = "value1"
ENV_VAR2 = "value2"
}
event_sources {
topic = "topic1"
type = "sns"
}
exec_args = ["arg1", "arg2"]
input_payload_encoding_type = "json"
linux_process_params {
isolation_mode {
devices {
add_group_owner = true
path = "/dev/random"
permission = "rw"
}
memory_size_in_kb = 1024
mount_ro_sysfs = false
volumes {
add_group_owner = false
destination_path = "/mnt/data"
permission = "rw"
source_path = "/data"
}
}
container_params {
environment_variables = {
CONTAINER_ENV_VAR1 = "container_value1"
CONTAINER_ENV_VAR2 = "container_value2"
}
image_uri = "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-container-image:latest"
memory_size_in_kb = 2048
vcpu_count = 2
}
}
max_idle_time_in_seconds = 300
max_instances_count = 3
max_queue_size = 10
pinned = false
status_timeout_in_seconds = 60
timeout_in_seconds = 30
}
component_platforms {
attributes = {
platform_version = "1.2.3"
architecture = "arm64"
}
name = "Linux"
}
}
tags = {
Environment = "Production"
Project = "GreengrassProject-Nested"
}
}
inline_recipe
(String)lambda_function
(Attributes) (see below for nested schema)tags
(Map of String)arn
(String)component_name
(String)component_version
(String)id
(String) Uniquely identifies the resource.lambda_function
Optional:
component_dependencies
(Attributes Map) (see below for nested schema)component_lambda_parameters
(Attributes) (see below for nested schema)component_name
(String)component_platforms
(Attributes List) (see below for nested schema)component_version
(String)lambda_arn
(String)lambda_function.component_dependencies
Optional:
dependency_type
(String)version_requirement
(String)lambda_function.component_lambda_parameters
Optional:
environment_variables
(Map of String)event_sources
(Attributes List) (see below for nested schema)exec_args
(List of String)input_payload_encoding_type
(String)linux_process_params
(Attributes) (see below for nested schema)max_idle_time_in_seconds
(Number)max_instances_count
(Number)max_queue_size
(Number)pinned
(Boolean)status_timeout_in_seconds
(Number)timeout_in_seconds
(Number)lambda_function.component_lambda_parameters.event_sources
Optional:
topic
(String)type
(String)lambda_function.component_lambda_parameters.linux_process_params
Optional:
container_params
(Attributes) (see below for nested schema)isolation_mode
(String)lambda_function.component_lambda_parameters.linux_process_params.container_params
Optional:
devices
(Attributes List) (see below for nested schema)memory_size_in_kb
(Number)mount_ro_sysfs
(Boolean)volumes
(Attributes List) (see below for nested schema)lambda_function.component_lambda_parameters.linux_process_params.isolation_mode.devices
Optional:
add_group_owner
(Boolean)path
(String)permission
(String)lambda_function.component_lambda_parameters.linux_process_params.isolation_mode.volumes
Optional:
add_group_owner
(Boolean)destination_path
(String)permission
(String)source_path
(String)lambda_function.component_platforms
Optional:
attributes
(Map of String)name
(String)Import is supported using the following syntax:
$ terraform import awscc_greengrassv2_component_version.example <resource ID>