https://github.com/jameswoolfenden/terraform-aws-appsync
Basic appsync module
https://github.com/jameswoolfenden/terraform-aws-appsync
appsync aws module terraform
Last synced: 12 months ago
JSON representation
Basic appsync module
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-appsync
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2020-06-03T18:27:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-29T20:00:23.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T22:54:38.257Z (about 1 year ago)
- Topics: appsync, aws, module, terraform
- Language: HCL
- Homepage:
- Size: 105 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-aws-appsync
[](https://github.com/JamesWoolfenden/terraform-aws-appsync)
[](https://github.com/JamesWoolfenden/terraform-aws-appsync/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-appsync/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-appsync&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-appsync&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module -
---
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
## Usage
This is just a very basic example.

Include **module.appsync.tf** this repository as a module in your existing terraform code:
```terraform
module "appsync" {
source = "JamesWoolfenden/appsync/aws"
version = "0.0.4"
common_tags = var.common_tags
lambda_resolver_arn = var.lambda_resolver_arn
datasource_user_name = var.datasource_user_name
api_name = var.api_name
request_template = file("${path.module}/templates/request")
response_template = file("${path.module}/templates/response")
schema = file("${path.module}/templates/schema")
resolver_field = "singlePost"
resolver_type = "Query"
kms_key_id = aws_kms_key.example.arn
web_acl_arn = module.waf2.aws_wafv2_web_acl.arn
}
```
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_appsync_datasource.user](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_datasource) | resource |
| [aws_appsync_graphql_api.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_graphql_api) | resource |
| [aws_appsync_resolver.user](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_resolver) | resource |
| [aws_cloudwatch_log_group.api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_iam_role.appsync](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_wafv2_web_acl_association.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl_association) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [api\_name](#input\_api\_name) | n/a | `string` | `"hitme"` | no |
| [appsync\_rolename](#input\_appsync\_rolename) | The name of the role to attach to appsync | `string` | `"Appsync"` | no |
| [common\_tags](#input\_common\_tags) | This is a map type for applying tags on resources | `map(any)` | n/a | yes |
| [datasource\_user\_name](#input\_datasource\_user\_name) | n/a | `string` | `"hitme_user"` | no |
| [kms\_key\_id](#input\_kms\_key\_id) | KMS key arn | `string` | n/a | yes |
| [lambda\_resolver\_arn](#input\_lambda\_resolver\_arn) | n/a | `string` | n/a | yes |
| [log\_level](#input\_log\_level) | log level for the api | `string` | `"ERROR"` | no |
| [request\_template](#input\_request\_template) | n/a | `string` | n/a | yes |
| [resolver\_field](#input\_resolver\_field) | (optional) describe your variable | `string` | n/a | yes |
| [resolver\_type](#input\_resolver\_type) | (optional) describe your variable | `string` | n/a | yes |
| [response\_template](#input\_response\_template) | n/a | `string` | n/a | yes |
| [retention\_in\_days](#input\_retention\_in\_days) | How long Cloudwatch retains your logs | `number` | `90` | no |
| [schema](#input\_schema) | n/a | `string` | n/a | yes |
| [web\_acl\_arn](#input\_web\_acl\_arn) | n/a | `string` | n/a | yes |
## Outputs
| Name | Description |
|------|-------------|
| [api](#output\_api) | n/a |
| [datasource](#output\_datasource) | n/a |
| [resolver](#output\_resolver) | n/a |
## Policy
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:AttachRolePolicy",
"iam:CreateRole",
"iam:DeleteRole",
"iam:DetachRolePolicy",
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:TagRole"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"logs:AssociateKmsKey",
"logs:CreateLogGroup",
"logs:DeleteLogGroup",
"logs:DeleteRetentionPolicy",
"logs:DescribeLogGroups",
"logs:DisassociateKmsKey",
"logs:ListTagsLogGroup",
"logs:PutRetentionPolicy"
],
"Resource": "*"
}
]
})
}
```
## Related Projects
Check out these related projects.
- [terraform-aws-s3](https://github.com/jameswoolfenden/terraform-aws-s3) - S3 buckets
## Help
**Got a question?**
File a GitHub [issue](https://github.com/JamesWoolfenden/terraform-aws-appsync/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/JamesWoolfenden/terraform-aws-appsync/issues) to report any bugs or file feature requests.
## Copyrights
Copyright � 2019-2022 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150