Skip to content

Commit f7b9cfa

Browse files
committed
chore!: Rename resource aws_appsync_api_cache
1 parent ea0f847 commit f7b9cfa

File tree

8 files changed

+86
-36
lines changed

8 files changed

+86
-36
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ $ terraform apply
132132

133133
| Name | Version |
134134
|------|---------|
135-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
135+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 |
136136
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61.0 |
137137

138138
## Providers
@@ -149,7 +149,7 @@ No modules.
149149

150150
| Name | Type |
151151
|------|------|
152-
| [aws_appsync_api_cache.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_api_cache) | resource |
152+
| [aws_appsync_api_cache.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_api_cache) | resource |
153153
| [aws_appsync_api_key.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_api_key) | resource |
154154
| [aws_appsync_datasource.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_datasource) | resource |
155155
| [aws_appsync_domain_name.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appsync_domain_name) | resource |
@@ -188,15 +188,15 @@ No modules.
188188
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | The domain name that AppSync gets associated with. | `string` | `""` | no |
189189
| <a name="input_domain_name_association_enabled"></a> [domain\_name\_association\_enabled](#input\_domain\_name\_association\_enabled) | Whether to enable domain name association on GraphQL API | `bool` | `false` | no |
190190
| <a name="input_domain_name_description"></a> [domain\_name\_description](#input\_domain\_name\_description) | A description of the Domain Name. | `string` | `null` | no |
191-
| <a name="input_dynamodb_allowed_actions"></a> [dynamodb\_allowed\_actions](#input\_dynamodb\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_DYNAMODB | `list(string)` | <pre>[<br/> "dynamodb:GetItem",<br/> "dynamodb:PutItem",<br/> "dynamodb:DeleteItem",<br/> "dynamodb:UpdateItem",<br/> "dynamodb:Query",<br/> "dynamodb:Scan",<br/> "dynamodb:BatchGetItem",<br/> "dynamodb:BatchWriteItem"<br/>]</pre> | no |
192-
| <a name="input_elasticsearch_allowed_actions"></a> [elasticsearch\_allowed\_actions](#input\_elasticsearch\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_ELASTICSEARCH | `list(string)` | <pre>[<br/> "es:ESHttpDelete",<br/> "es:ESHttpHead",<br/> "es:ESHttpGet",<br/> "es:ESHttpPost",<br/> "es:ESHttpPut"<br/>]</pre> | no |
191+
| <a name="input_dynamodb_allowed_actions"></a> [dynamodb\_allowed\_actions](#input\_dynamodb\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_DYNAMODB | `list(string)` | <pre>[<br> "dynamodb:GetItem",<br> "dynamodb:PutItem",<br> "dynamodb:DeleteItem",<br> "dynamodb:UpdateItem",<br> "dynamodb:Query",<br> "dynamodb:Scan",<br> "dynamodb:BatchGetItem",<br> "dynamodb:BatchWriteItem"<br>]</pre> | no |
192+
| <a name="input_elasticsearch_allowed_actions"></a> [elasticsearch\_allowed\_actions](#input\_elasticsearch\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_ELASTICSEARCH | `list(string)` | <pre>[<br> "es:ESHttpDelete",<br> "es:ESHttpHead",<br> "es:ESHttpGet",<br> "es:ESHttpPost",<br> "es:ESHttpPut"<br>]</pre> | no |
193193
| <a name="input_enhanced_metrics_config"></a> [enhanced\_metrics\_config](#input\_enhanced\_metrics\_config) | Nested argument containing Lambda Ehanced metrics configuration. | `map(string)` | `{}` | no |
194-
| <a name="input_eventbridge_allowed_actions"></a> [eventbridge\_allowed\_actions](#input\_eventbridge\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_EVENTBRIDGE | `list(string)` | <pre>[<br/> "events:PutEvents"<br/>]</pre> | no |
194+
| <a name="input_eventbridge_allowed_actions"></a> [eventbridge\_allowed\_actions](#input\_eventbridge\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_EVENTBRIDGE | `list(string)` | <pre>[<br> "events:PutEvents"<br>]</pre> | no |
195195
| <a name="input_functions"></a> [functions](#input\_functions) | Map of functions to create | `any` | `{}` | no |
196196
| <a name="input_graphql_api_tags"></a> [graphql\_api\_tags](#input\_graphql\_api\_tags) | Map of tags to add to GraphQL API | `map(string)` | `{}` | no |
197197
| <a name="input_iam_permissions_boundary"></a> [iam\_permissions\_boundary](#input\_iam\_permissions\_boundary) | ARN for iam permissions boundary | `string` | `null` | no |
198198
| <a name="input_introspection_config"></a> [introspection\_config](#input\_introspection\_config) | Whether to enable or disable introspection of the GraphQL API. | `string` | `null` | no |
199-
| <a name="input_lambda_allowed_actions"></a> [lambda\_allowed\_actions](#input\_lambda\_allowed\_actions) | List of allowed IAM actions for datasources type AWS\_LAMBDA | `list(string)` | <pre>[<br/> "lambda:invokeFunction"<br/>]</pre> | no |
199+
| <a name="input_lambda_allowed_actions"></a> [lambda\_allowed\_actions](#input\_lambda\_allowed\_actions) | List of allowed IAM actions for datasources type AWS\_LAMBDA | `list(string)` | <pre>[<br> "lambda:invokeFunction"<br>]</pre> | no |
200200
| <a name="input_lambda_authorizer_config"></a> [lambda\_authorizer\_config](#input\_lambda\_authorizer\_config) | Nested argument containing Lambda authorizer configuration. | `map(string)` | `{}` | no |
201201
| <a name="input_log_cloudwatch_logs_role_arn"></a> [log\_cloudwatch\_logs\_role\_arn](#input\_log\_cloudwatch\_logs\_role\_arn) | Amazon Resource Name of the service role that AWS AppSync will assume to publish to Amazon CloudWatch logs in your account. | `string` | `null` | no |
202202
| <a name="input_log_exclude_verbose_content"></a> [log\_exclude\_verbose\_content](#input\_log\_exclude\_verbose\_content) | Set to TRUE to exclude sections that contain information such as headers, context, and evaluated mapping templates, regardless of logging level. | `bool` | `false` | no |
@@ -206,14 +206,14 @@ No modules.
206206
| <a name="input_logs_role_tags"></a> [logs\_role\_tags](#input\_logs\_role\_tags) | Map of tags to add to Cloudwatch logs IAM role | `map(string)` | `{}` | no |
207207
| <a name="input_name"></a> [name](#input\_name) | Name of GraphQL API | `string` | `""` | no |
208208
| <a name="input_openid_connect_config"></a> [openid\_connect\_config](#input\_openid\_connect\_config) | Nested argument containing OpenID Connect configuration. | `map(string)` | `{}` | no |
209-
| <a name="input_opensearchservice_allowed_actions"></a> [opensearchservice\_allowed\_actions](#input\_opensearchservice\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_OPENSEARCH\_SERVICE | `list(string)` | <pre>[<br/> "es:ESHttpDelete",<br/> "es:ESHttpHead",<br/> "es:ESHttpGet",<br/> "es:ESHttpPost",<br/> "es:ESHttpPut"<br/>]</pre> | no |
209+
| <a name="input_opensearchservice_allowed_actions"></a> [opensearchservice\_allowed\_actions](#input\_opensearchservice\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_OPENSEARCH\_SERVICE | `list(string)` | <pre>[<br> "es:ESHttpDelete",<br> "es:ESHttpHead",<br> "es:ESHttpGet",<br> "es:ESHttpPost",<br> "es:ESHttpPut"<br>]</pre> | no |
210210
| <a name="input_query_depth_limit"></a> [query\_depth\_limit](#input\_query\_depth\_limit) | The maximum depth a query can have in a single request. | `number` | `null` | no |
211-
| <a name="input_relational_database_allowed_actions"></a> [relational\_database\_allowed\_actions](#input\_relational\_database\_allowed\_actions) | List of allowed IAM actions for datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br/> "rds-data:BatchExecuteStatement",<br/> "rds-data:BeginTransaction",<br/> "rds-data:CommitTransaction",<br/> "rds-data:ExecuteStatement",<br/> "rds-data:RollbackTransaction"<br/>]</pre> | no |
211+
| <a name="input_relational_database_allowed_actions"></a> [relational\_database\_allowed\_actions](#input\_relational\_database\_allowed\_actions) | List of allowed IAM actions for datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br> "rds-data:BatchExecuteStatement",<br> "rds-data:BeginTransaction",<br> "rds-data:CommitTransaction",<br> "rds-data:ExecuteStatement",<br> "rds-data:RollbackTransaction"<br>]</pre> | no |
212212
| <a name="input_resolver_caching_ttl"></a> [resolver\_caching\_ttl](#input\_resolver\_caching\_ttl) | Default caching TTL for resolvers when caching is enabled | `number` | `60` | no |
213213
| <a name="input_resolver_count_limit"></a> [resolver\_count\_limit](#input\_resolver\_count\_limit) | The maximum number of resolvers that can be invoked in a single request. | `number` | `null` | no |
214214
| <a name="input_resolvers"></a> [resolvers](#input\_resolvers) | Map of resolvers to create | `any` | `{}` | no |
215215
| <a name="input_schema"></a> [schema](#input\_schema) | The schema definition, in GraphQL schema language format. Terraform cannot perform drift detection of this configuration. | `string` | `""` | no |
216-
| <a name="input_secrets_manager_allowed_actions"></a> [secrets\_manager\_allowed\_actions](#input\_secrets\_manager\_allowed\_actions) | List of allowed IAM actions for secrets manager datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br/> "secretsmanager:GetSecretValue"<br/>]</pre> | no |
216+
| <a name="input_secrets_manager_allowed_actions"></a> [secrets\_manager\_allowed\_actions](#input\_secrets\_manager\_allowed\_actions) | List of allowed IAM actions for secrets manager datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br> "secretsmanager:GetSecretValue"<br>]</pre> | no |
217217
| <a name="input_tags"></a> [tags](#input\_tags) | Map of tags to add to all GraphQL resources created by this module | `map(string)` | `{}` | no |
218218
| <a name="input_user_pool_config"></a> [user\_pool\_config](#input\_user\_pool\_config) | The Amazon Cognito User Pool configuration. | `map(string)` | `{}` | no |
219219
| <a name="input_visibility"></a> [visibility](#input\_visibility) | The API visibility. Valid values: GLOBAL, PRIVATE. | `string` | `null` | no |

examples/complete/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ Note that this example may create resources which cost money. Run `terraform des
2929
| Name | Version |
3030
|------|---------|
3131
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.1 |
32+
| <a name="provider_aws.us-east-1"></a> [aws.us-east-1](#provider\_aws.us-east-1) | >= 5.1 |
3233
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |
3334

3435
## Modules
3536

3637
| Name | Source | Version |
3738
|------|--------|---------|
38-
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 3 |
39+
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 3.0 |
3940
| <a name="module_appsync"></a> [appsync](#module\_appsync) | ../../ | n/a |
4041
| <a name="module_disabled"></a> [disabled](#module\_disabled) | ../../ | n/a |
4142

@@ -48,11 +49,18 @@ Note that this example may create resources which cost money. Run `terraform des
4849
| [aws_route53_record.api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
4950
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource |
5051
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
52+
| [aws_acm_certificate.existing_certificate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate) | data source |
53+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
54+
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
5155
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |
5256

5357
## Inputs
5458

55-
No inputs.
59+
| Name | Description | Type | Default | Required |
60+
|------|-------------|------|---------|:--------:|
61+
| <a name="input_existing_acm_certificate"></a> [existing\_acm\_certificate](#input\_existing\_acm\_certificate) | Override this value to use an existing ACM certificate | <pre>object({<br> # Use existing certificate (via data source) or create new one<br> use = optional(bool, false)<br> domain_name = optional(string)<br> })</pre> | `{}` | no |
62+
| <a name="input_existing_route53_zone"></a> [existing\_route53\_zone](#input\_existing\_route53\_zone) | Override this value to use an existing Route 53 zone | <pre>object({<br> # Use existing zone (via data source) or create new one (will fail validation, if zone is not reachable)<br> use = optional(bool, true)<br> domain_name = optional(string, "terraform-aws-modules.modules.tf")<br> })</pre> | <pre>{<br> "domain_name": "pat-poc.edf.fr"<br>}</pre> | no |
63+
| <a name="input_main_region"></a> [main\_region](#input\_main\_region) | AWS main region | `string` | `"eu-west-1"` | no |
5664

5765
## Outputs
5866

examples/complete/main.tf

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
provider "aws" {
2-
region = "eu-west-1"
2+
region = var.main_region
33

44
# Make it faster by skipping something
55
skip_metadata_api_check = true
@@ -24,60 +24,67 @@ provider "aws" {
2424
}
2525

2626
locals {
27-
# Use existing (via data source) or create new zone (will fail validation, if zone is not reachable)
28-
use_existing_route53_zone = true
29-
30-
domain = "terraform-aws-modules.modules.tf"
31-
3227
# Removing trailing dot from domain - just to be sure :)
33-
domain_name = trimsuffix(local.domain, ".")
28+
route53_domain_name = trimsuffix(var.existing_route53_zone.domain_name, ".")
3429
}
3530

3631
data "aws_route53_zone" "this" {
37-
count = local.use_existing_route53_zone ? 1 : 0
32+
count = var.existing_route53_zone.use ? 1 : 0
3833

39-
name = local.domain_name
34+
name = local.route53_domain_name
4035
private_zone = false
4136
}
4237

4338
resource "aws_route53_zone" "this" {
44-
count = !local.use_existing_route53_zone ? 1 : 0
45-
name = local.domain_name
39+
count = !var.existing_route53_zone.use ? 1 : 0
40+
name = local.route53_domain_name
4641
}
4742

4843
resource "aws_route53_record" "api" {
4944
zone_id = try(data.aws_route53_zone.this[0].zone_id, aws_route53_zone.this[0].zone_id)
50-
name = "api.${local.domain}"
45+
name = "api.${var.existing_route53_zone.domain_name}"
5146
type = "CNAME"
5247
ttl = "300"
5348
records = [module.appsync.appsync_domain_name]
5449
}
5550

51+
data "aws_acm_certificate" "existing_certificate" {
52+
count = var.existing_acm_certificate.use ? 1 : 0
53+
domain = var.existing_acm_certificate.domain_name
54+
55+
provider = aws.us-east-1
56+
}
57+
5658
module "acm" {
59+
count = var.existing_acm_certificate.use ? 0 : 1
5760
source = "terraform-aws-modules/acm/aws"
58-
version = "~> 3"
61+
version = "~> 3.0"
5962

60-
domain_name = local.domain_name
63+
domain_name = local.route53_domain_name
6164
zone_id = try(data.aws_route53_zone.this[0].zone_id, aws_route53_zone.this[0].zone_id)
6265

6366
subject_alternative_names = [
64-
"*.alerts.${local.domain_name}",
65-
"new.sub.${local.domain_name}",
66-
"*.${local.domain_name}",
67-
"alerts.${local.domain_name}",
67+
"*.alerts.${local.route53_domain_name}",
68+
"new.sub.${local.route53_domain_name}",
69+
"*.${local.route53_domain_name}",
70+
"alerts.${local.route53_domain_name}",
6871
]
6972

7073
wait_for_validation = true
7174

7275
tags = {
73-
Name = local.domain_name
76+
Name = local.route53_domain_name
7477
}
7578

7679
providers = {
7780
aws = aws.us-east-1
7881
}
7982
}
8083

84+
data "aws_caller_identity" "current" {}
85+
86+
data "aws_region" "current" {}
87+
8188
module "appsync" {
8289
source = "../../"
8390

@@ -94,9 +101,9 @@ module "appsync" {
94101
query_depth_limit = 10
95102
resolver_count_limit = 25
96103

97-
domain_name = "api.${local.domain}"
104+
domain_name = "api.${var.existing_route53_zone.domain_name}"
98105
domain_name_description = "My ${random_pet.this.id} AppSync Domain"
99-
certificate_arn = module.acm.acm_certificate_arn
106+
certificate_arn = var.existing_acm_certificate.use ? data.aws_acm_certificate.existing_certificate[0].arn : module.acm[0].acm_certificate_arn
100107

101108
caching_behavior = "PER_RESOLVER_CACHING"
102109
cache_type = "SMALL"
@@ -112,7 +119,7 @@ module "appsync" {
112119
authentication_type = "OPENID_CONNECT"
113120

114121
lambda_authorizer_config = {
115-
authorizer_uri = "arn:aws:lambda:eu-west-1:835367859851:function:appsync_auth_1"
122+
authorizer_uri = "arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:appsync_auth_1"
116123
}
117124

118125
openid_connect_config = {

examples/complete/variables.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
variable "main_region" {
2+
type = string
3+
description = "AWS main region"
4+
default = "eu-west-1"
5+
}
6+
7+
variable "existing_route53_zone" {
8+
type = object({
9+
# Use existing zone (via data source) or create new one (will fail validation, if zone is not reachable)
10+
use = optional(bool, true)
11+
domain_name = optional(string, "terraform-aws-modules.modules.tf")
12+
})
13+
description = "Override this value to use an existing Route 53 zone"
14+
default = {
15+
domain_name = "pat-poc.edf.fr"
16+
}
17+
}
18+
19+
variable "existing_acm_certificate" {
20+
type = object({
21+
# Use existing certificate (via data source) or create new one
22+
use = optional(bool, false)
23+
domain_name = optional(string)
24+
})
25+
description = "Override this value to use an existing ACM certificate"
26+
default = {}
27+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ resource "aws_appsync_domain_name_api_association" "this" {
129129
}
130130

131131
# API Cache
132-
resource "aws_appsync_api_cache" "example" {
132+
resource "aws_appsync_api_cache" "this" {
133133
count = var.create_graphql_api && var.caching_enabled ? 1 : 0
134134

135135
api_id = aws_appsync_graphql_api.this[0].id

migrations.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
################################################################################
2+
# Migrations: v2.6.0 -> v3.0.0
3+
################################################################################
4+
5+
moved {
6+
from = aws_appsync_api_cache.example
7+
to = aws_appsync_api_cache.this
8+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.0"
2+
required_version = ">= 1.3.2"
33

44
required_providers {
55
aws = {

wrappers/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.0"
2+
required_version = ">= 1.3.2"
33

44
required_providers {
55
aws = {

0 commit comments

Comments
 (0)