Skip to content

Commit 316a0db

Browse files
committed
Update code examples
1 parent d1d1020 commit 316a0db

File tree

1 file changed

+29
-15
lines changed
  • content/terraform/v1.14.x (beta)/docs/language/block

1 file changed

+29
-15
lines changed

content/terraform/v1.14.x (beta)/docs/language/block/action.mdx

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,30 @@ The following example adds an `aws_lambda_invoke` action. You can invoke an act
198198
```hcl
199199
action "aws_lambda_invoke" "example" {
200200
config {
201-
values = var.values
202-
timeout = 3000
201+
function_name = "my_function"
202+
payload = jsonencode({
203+
key1 = "value1"
204+
key2 = "value2"
205+
})
203206
}
204207
}
205208
```
206209

210+
"my_function" needs to be defined on AWS.
211+
207212
### Select an alternate provider configuration
208213

209214
The following example configures Terraform to apply the `aws.alias` provider configuration when invoking the action:
210215

211216
```hcl
212-
action "aws_lambda_invocation" "example" {
213-
provider = aws.alias
214-
config {
215-
input = count.index
216-
timeout = 3000
217+
action "aws_lambda_invoke" "example" {
218+
provider = aws.alias
219+
config {
220+
function_name = "my_function"
221+
payload = jsonencode({
222+
key1 = "value1"
223+
key2 = "value2"
224+
})
217225
}
218226
}
219227
```
@@ -229,11 +237,14 @@ You can add a `count` or `for_each` meta-argument to invoke an action multiple t
229237
Terraform invokes the action three times.
230238

231239
```hcl
232-
action "aws_lambda_invocation" "example" {
240+
action "aws_lambda_invoke" "example" {
233241
count = 3
234242
config {
235-
input = count.index
236-
timeout = 3000
243+
function_name = "my_function"
244+
payload = jsonencode({
245+
key1 = "value1"
246+
key2 = "value2"
247+
})
237248
}
238249
}
239250
```
@@ -245,15 +256,18 @@ action "aws_lambda_invocation" "example" {
245256
Terraform invokes the action once for each member of the map, resulting in two invocations.
246257

247258
```hcl
248-
action "aws_lambda_invocation" "example" {
259+
action "aws_lambda_invoke" "example" {
249260
for_each = tomap({
250261
a_group = "eastus"
251262
another_group = "westus2"
252263
})
253-
config {
254-
input = count.index
255-
timeout = 3000
256-
}
264+
config {
265+
function_name = "my_function"
266+
payload = jsonencode({
267+
key1 = "value1"
268+
key2 = "value2"
269+
})
270+
}
257271
}
258272
```
259273

0 commit comments

Comments
 (0)