Skip to content

Commit 4509be5

Browse files
committed
fixed iam role issues with lambda workshop
1 parent a8ba7f6 commit 4509be5

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

content/en/ninja-workshops/6-lambda-kinesis/1-setup.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,6 @@ weight: 1
88

99
## Prerequisites
1010

11-
### Note to Workshop Instructor
12-
13-
This step only needs to be completed once, as the IAM role created
14-
in this step will be shared by all workshop participants:
15-
16-
``` bash
17-
cd ~/workshop/lambda/iam_role
18-
terraform init
19-
terraform plan
20-
terraform apply
21-
```
22-
23-
After the workshop is complete, cleanup the role as follows:
24-
25-
``` bash
26-
cd ~/workshop/lambda/iam_role
27-
terraform destroy
28-
```
29-
3011
### Observability Workshop Instance
3112
The Observability Workshop uses the `Splunk4Ninjas - Observability` workshop template in Splunk Show,
3213
which provides a pre-configured EC2 instance running Ubuntu.
@@ -98,6 +79,12 @@ The Workshop Directory `lambda` is a repository that contains all the configurat
9879
### AWS & Terraform Variables
9980

10081
#### AWS
82+
83+
> Note to the workshop instructor: create a new user in the target AWS account called `lambda-workshop-user`.
84+
> Ensure it has full permissions to perform the required actions via Terraform. Create an access token for the `lambda-workshop-user`
85+
> user and share the Access Key ID and Secret Access Key with the workshop participants. Delete the user
86+
> when the workshop is complete.
87+
10188
The AWS CLI requires that you have credentials to be able to access and manage resources deployed by their services. Both Terraform and the Python scripts in this workshop require these variables to perform their tasks.
10289

10390
- Configure the **awscli** with the _**access key ID**_, _**secret access key**_ and _**region**_ for this workshop:
@@ -117,10 +104,24 @@ The AWS CLI requires that you have credentials to be able to access and manage r
117104
aws configure
118105
```
119106

120-
> Note to the workshop instructor: create a new user in the target AWS account called `lambda-workshop-user`.
121-
> Ensure it has full permissions to perform the required actions via Terraform. Create an access token for the `lambda-workshop-user`
122-
> user and share the Access Key ID and Secret Access Key with the workshop participants. Delete the user
123-
> when the workshop is complete.
107+
#### Create an IAM Role (Workshop Instructor Only)
108+
109+
> Note to the workshop instructor: This step only needs to be completed once, as the IAM role created
110+
> in this step will be shared by all workshop participants:
111+
112+
``` bash
113+
cd ~/workshop/lambda/iam_role
114+
terraform init
115+
terraform plan
116+
terraform apply
117+
```
118+
119+
> Note to the workshop instructor: After the workshop is complete, cleanup the role as follows:
120+
121+
``` bash
122+
cd ~/workshop/lambda/iam_role
123+
terraform destroy
124+
```
124125

125126
#### Terraform
126127
Terraform supports the passing of variables to ensure sensitive or dynamic data is not hard-coded in your .tf configuration files, as well as to make those values reusable throughout your resource definitions.

workshop/lambda/auto/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "aws_lambda_function" "lambda_producer" {
8181

8282
source_code_hash = data.archive_file.producer_app.output_base64sha256
8383

84-
role = aws_iam_role.lambda_kinesis.arn
84+
role = data.aws_iam_role.lambda_kinesis.arn
8585

8686
environment {
8787
variables = {
@@ -110,7 +110,7 @@ resource "aws_lambda_function" "lambda_consumer" {
110110

111111
source_code_hash = data.archive_file.consumer_app.output_base64sha256
112112

113-
role = aws_iam_role.lambda_kinesis.arn
113+
role = data.aws_iam_role.lambda_kinesis.arn
114114

115115
environment {
116116
variables = {

workshop/lambda/manual/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "aws_lambda_function" "lambda_producer" {
8181

8282
source_code_hash = data.archive_file.producer_app.output_base64sha256
8383

84-
role = aws_iam_role.lambda_kinesis.arn
84+
role = data.aws_iam_role.lambda_kinesis.arn
8585

8686
environment {
8787
variables = {
@@ -110,7 +110,7 @@ resource "aws_lambda_function" "lambda_consumer" {
110110

111111
source_code_hash = data.archive_file.consumer_app.output_base64sha256
112112

113-
role = aws_iam_role.lambda_kinesis.arn
113+
role = data.aws_iam_role.lambda_kinesis.arn
114114

115115
environment {
116116
variables = {

0 commit comments

Comments
 (0)