Skip to content

Commit

Permalink
added: aws_api_gateway_api_key (GoogleCloudPlatform#1528)
Browse files Browse the repository at this point in the history
* added: aws_api_gateway_api_key

* fix linter naming warning
  • Loading branch information
aav66 authored Nov 15, 2022
1 parent d1f3745 commit 05ed073
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ terraformer import aws --resources=sg --regions=us-east-1
* `aws_lb_target_group_attachment`
* `api_gateway`
* `aws_api_gateway_authorizer`
* `aws_api_gateway_api_key`
* `aws_api_gateway_documentation_part`
* `aws_api_gateway_gateway_response`
* `aws_api_gateway_integration`
Expand Down
23 changes: 23 additions & 0 deletions providers/aws/api_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func (g *APIGatewayGenerator) InitResources() error {
if err := g.loadUsagePlans(svc); err != nil {
return err
}
if err := g.loadAPIKeys(svc); err != nil {
return err
}

return nil
}
Expand Down Expand Up @@ -424,3 +427,23 @@ func (g *APIGatewayGenerator) loadUsagePlans(svc *apigateway.Client) error {
}
return nil
}

func (g *APIGatewayGenerator) loadAPIKeys(svc *apigateway.Client) error {
p := apigateway.NewGetApiKeysPaginator(svc, &apigateway.GetApiKeysInput{})
for p.HasMorePages() {
page, err := p.NextPage(context.TODO())
if err != nil {
return err
}
for _, apiKey := range page.Items {
g.Resources = append(g.Resources, terraformutils.NewSimpleResource(
*apiKey.Id,
*apiKey.Name,
"aws_api_gateway_api_key",
"aws",
apiGatewayAllowEmptyValues))
}
}

return nil
}

0 comments on commit 05ed073

Please sign in to comment.