Skip to content

Commit c8e97d2

Browse files
kevinburkestack72
authored andcommitted
website: describe API Gateway ARN's (hashicorp#11762)
I lost a few hours figuring out the right way to describe an ARN for an API Gateway resource. Specifically I translated the example poorly since I didn't realize I had to append the path onto the end of the ARN. Adds two links to an Amazon documentation page describing the format for API Gateway ARN's. Adds an additional path component to the ARN example so you can see you need to specify paths.
1 parent 781e5a9 commit c8e97d2

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

website/source/docs/providers/aws/r/api_gateway_integration.html.markdown

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ resource "aws_lambda_permission" "apigw_lambda" {
8282
action = "lambda:InvokeFunction"
8383
function_name = "${aws_lambda_function.lambda.arn}"
8484
principal = "apigateway.amazonaws.com"
85-
source_arn = "arn:aws:execute-api:${var.myregion}:${var.accountId}:${aws_api_gateway_rest_api.api.id}/*/${aws_api_gateway_method.method.http_method}/"
85+
86+
# More: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html
87+
source_arn = "arn:aws:execute-api:${var.myregion}:${var.accountId}:${aws_api_gateway_rest_api.api.id}/*/${aws_api_gateway_method.method.http_method}/resourcepath/subresourcepath"
8688
}
8789
8890
resource "aws_lambda_function" "lambda" {

website/source/docs/providers/aws/r/lambda_permission.html.markdown

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ EOF
119119
e.g. `arn:aws:lambda:aws-region:acct-id:function:function-name:2`
120120
* `source_account` - (Optional) The AWS account ID (without a hyphen) of the source owner.
121121
* `source_arn` - (Optional) When granting Amazon S3 or CloudWatch Events permission to
122-
invoke your function, you should specify this field with the Amazon Resource Name (ARN)
123-
for the S3 Bucket or CloudWatch Events Rule as its value. This ensures that only events
124-
generated from the specified bucket or rule can invoke the function.
122+
invoke your function, you should specify this field with the Amazon Resource Name (ARN)
123+
for the S3 Bucket or CloudWatch Events Rule as its value. This ensures that only events
124+
generated from the specified bucket or rule can invoke the function.
125+
API Gateway ARNs have a unique structure described
126+
[here](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html).

0 commit comments

Comments
 (0)