@aws/nx-plugin 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +2 -2
- package/migrations.json +6 -1
- package/package.json +1 -1
- package/src/migrations/latest/api-custom-domain-runtime-config/metadata.json +3 -0
- package/src/migrations/latest/api-custom-domain-runtime-config/migration.d.ts +6 -0
- package/src/migrations/latest/api-custom-domain-runtime-config/migration.js +362 -0
- package/src/migrations/latest/api-custom-domain-runtime-config/migration.js.map +1 -0
- package/src/py/fast-api/__snapshots__/generator.spec.ts.snap +54 -6
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +378 -6
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +252 -4
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +432 -12
- package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +34 -4
- package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +20 -2
- package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +63 -1
- package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +63 -1
|
@@ -833,6 +833,19 @@ variable "tags" {
|
|
|
833
833
|
default = {}
|
|
834
834
|
}
|
|
835
835
|
|
|
836
|
+
# Custom domain configuration
|
|
837
|
+
variable "custom_domain_name" {
|
|
838
|
+
description = "Custom domain name for the API. Requires acm_certificate_arn."
|
|
839
|
+
type = string
|
|
840
|
+
default = null
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
variable "acm_certificate_arn" {
|
|
844
|
+
description = "ARN of an ACM certificate (in the API's region) for the custom domain name."
|
|
845
|
+
type = string
|
|
846
|
+
default = null
|
|
847
|
+
}
|
|
848
|
+
|
|
836
849
|
# Get current AWS region and account ID
|
|
837
850
|
data "aws_region" "current" {}
|
|
838
851
|
data "aws_caller_identity" "current" {}
|
|
@@ -1275,6 +1288,10 @@ locals {
|
|
|
1275
1288
|
]
|
|
1276
1289
|
}
|
|
1277
1290
|
|
|
1291
|
+
locals {
|
|
1292
|
+
api_url = var.custom_domain_name == null ? "\${aws_api_gateway_stage.api_stage.invoke_url}/" : "https://\${var.custom_domain_name}/"
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1278
1295
|
# CloudWatch Log Group for Lambda
|
|
1279
1296
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
1280
1297
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -1658,11 +1675,41 @@ module "add_url_to_runtime_config" {
|
|
|
1658
1675
|
|
|
1659
1676
|
namespace = "connection"
|
|
1660
1677
|
key = "apis"
|
|
1661
|
-
value = { "TestApi" =
|
|
1678
|
+
value = { "TestApi" = local.api_url }
|
|
1662
1679
|
|
|
1663
1680
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
1664
1681
|
}
|
|
1665
1682
|
|
|
1683
|
+
# Custom domain for the API, served without the stage path prefix
|
|
1684
|
+
resource "aws_api_gateway_domain_name" "custom_domain" {
|
|
1685
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
1686
|
+
|
|
1687
|
+
domain_name = var.custom_domain_name
|
|
1688
|
+
regional_certificate_arn = var.acm_certificate_arn
|
|
1689
|
+
security_policy = "TLS_1_2"
|
|
1690
|
+
|
|
1691
|
+
endpoint_configuration {
|
|
1692
|
+
types = ["REGIONAL"]
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
tags = var.tags
|
|
1696
|
+
|
|
1697
|
+
lifecycle {
|
|
1698
|
+
precondition {
|
|
1699
|
+
condition = var.acm_certificate_arn != null
|
|
1700
|
+
error_message = "acm_certificate_arn is required when custom_domain_name is set."
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
resource "aws_api_gateway_base_path_mapping" "custom_domain" {
|
|
1706
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
1707
|
+
|
|
1708
|
+
api_id = module.rest_api.api_id
|
|
1709
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
1710
|
+
domain_name = aws_api_gateway_domain_name.custom_domain[0].domain_name
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1666
1713
|
# Outputs
|
|
1667
1714
|
|
|
1668
1715
|
# API Gateway Outputs (from core module)
|
|
@@ -1691,6 +1738,21 @@ output "stage_invoke_url" {
|
|
|
1691
1738
|
value = aws_api_gateway_stage.api_stage.invoke_url
|
|
1692
1739
|
}
|
|
1693
1740
|
|
|
1741
|
+
output "api_url" {
|
|
1742
|
+
description = "URL clients should call: the custom domain if configured, otherwise the stage invoke URL"
|
|
1743
|
+
value = local.api_url
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
output "custom_domain_target_domain_name" {
|
|
1747
|
+
description = "Target domain name to point a DNS alias or CNAME record at for the custom domain"
|
|
1748
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_domain_name
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
output "custom_domain_hosted_zone_id" {
|
|
1752
|
+
description = "Hosted zone ID to use for a Route 53 alias record for the custom domain"
|
|
1753
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_zone_id
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1694
1756
|
output "stage_arn" {
|
|
1695
1757
|
description = "ARN of the API Gateway stage"
|
|
1696
1758
|
value = aws_api_gateway_stage.api_stage.arn
|
|
@@ -2677,6 +2739,19 @@ variable "tags" {
|
|
|
2677
2739
|
default = {}
|
|
2678
2740
|
}
|
|
2679
2741
|
|
|
2742
|
+
# Custom domain configuration
|
|
2743
|
+
variable "custom_domain_name" {
|
|
2744
|
+
description = "Custom domain name for the API. Requires acm_certificate_arn."
|
|
2745
|
+
type = string
|
|
2746
|
+
default = null
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
variable "acm_certificate_arn" {
|
|
2750
|
+
description = "ARN of an ACM certificate (in the API's region) for the custom domain name."
|
|
2751
|
+
type = string
|
|
2752
|
+
default = null
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2680
2755
|
# Get current AWS region and account ID
|
|
2681
2756
|
data "aws_region" "current" {}
|
|
2682
2757
|
data "aws_caller_identity" "current" {}
|
|
@@ -3119,6 +3194,10 @@ locals {
|
|
|
3119
3194
|
]
|
|
3120
3195
|
}
|
|
3121
3196
|
|
|
3197
|
+
locals {
|
|
3198
|
+
api_url = var.custom_domain_name == null ? "\${aws_api_gateway_stage.api_stage.invoke_url}/" : "https://\${var.custom_domain_name}/"
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3122
3201
|
# CloudWatch Log Group for Lambda
|
|
3123
3202
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
3124
3203
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -3420,11 +3499,41 @@ module "add_url_to_runtime_config" {
|
|
|
3420
3499
|
|
|
3421
3500
|
namespace = "connection"
|
|
3422
3501
|
key = "apis"
|
|
3423
|
-
value = { "TestApi" =
|
|
3502
|
+
value = { "TestApi" = local.api_url }
|
|
3424
3503
|
|
|
3425
3504
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
3426
3505
|
}
|
|
3427
3506
|
|
|
3507
|
+
# Custom domain for the API, served without the stage path prefix
|
|
3508
|
+
resource "aws_api_gateway_domain_name" "custom_domain" {
|
|
3509
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
3510
|
+
|
|
3511
|
+
domain_name = var.custom_domain_name
|
|
3512
|
+
regional_certificate_arn = var.acm_certificate_arn
|
|
3513
|
+
security_policy = "TLS_1_2"
|
|
3514
|
+
|
|
3515
|
+
endpoint_configuration {
|
|
3516
|
+
types = ["REGIONAL"]
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
tags = var.tags
|
|
3520
|
+
|
|
3521
|
+
lifecycle {
|
|
3522
|
+
precondition {
|
|
3523
|
+
condition = var.acm_certificate_arn != null
|
|
3524
|
+
error_message = "acm_certificate_arn is required when custom_domain_name is set."
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
resource "aws_api_gateway_base_path_mapping" "custom_domain" {
|
|
3530
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
3531
|
+
|
|
3532
|
+
api_id = module.rest_api.api_id
|
|
3533
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
3534
|
+
domain_name = aws_api_gateway_domain_name.custom_domain[0].domain_name
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3428
3537
|
# Outputs
|
|
3429
3538
|
|
|
3430
3539
|
# API Gateway Outputs (from core module)
|
|
@@ -3453,6 +3562,21 @@ output "stage_invoke_url" {
|
|
|
3453
3562
|
value = aws_api_gateway_stage.api_stage.invoke_url
|
|
3454
3563
|
}
|
|
3455
3564
|
|
|
3565
|
+
output "api_url" {
|
|
3566
|
+
description = "URL clients should call: the custom domain if configured, otherwise the stage invoke URL"
|
|
3567
|
+
value = local.api_url
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
output "custom_domain_target_domain_name" {
|
|
3571
|
+
description = "Target domain name to point a DNS alias or CNAME record at for the custom domain"
|
|
3572
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_domain_name
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
output "custom_domain_hosted_zone_id" {
|
|
3576
|
+
description = "Hosted zone ID to use for a Route 53 alias record for the custom domain"
|
|
3577
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_zone_id
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3456
3580
|
output "stage_arn" {
|
|
3457
3581
|
description = "ARN of the API Gateway stage"
|
|
3458
3582
|
value = aws_api_gateway_stage.api_stage.arn
|
|
@@ -3980,6 +4104,19 @@ variable "tags" {
|
|
|
3980
4104
|
default = {}
|
|
3981
4105
|
}
|
|
3982
4106
|
|
|
4107
|
+
# Custom domain configuration
|
|
4108
|
+
variable "custom_domain_name" {
|
|
4109
|
+
description = "Custom domain name for the API. Requires acm_certificate_arn."
|
|
4110
|
+
type = string
|
|
4111
|
+
default = null
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
variable "acm_certificate_arn" {
|
|
4115
|
+
description = "ARN of an ACM certificate (in the API's region) for the custom domain name."
|
|
4116
|
+
type = string
|
|
4117
|
+
default = null
|
|
4118
|
+
}
|
|
4119
|
+
|
|
3983
4120
|
# Get current AWS region and account ID
|
|
3984
4121
|
data "aws_region" "current" {}
|
|
3985
4122
|
data "aws_caller_identity" "current" {}
|
|
@@ -4422,6 +4559,10 @@ locals {
|
|
|
4422
4559
|
]
|
|
4423
4560
|
}
|
|
4424
4561
|
|
|
4562
|
+
locals {
|
|
4563
|
+
api_url = var.custom_domain_name == null ? "\${aws_api_gateway_stage.api_stage.invoke_url}/" : "https://\${var.custom_domain_name}/"
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4425
4566
|
# CloudWatch Log Group for Lambda
|
|
4426
4567
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
4427
4568
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -4722,11 +4863,41 @@ module "add_url_to_runtime_config" {
|
|
|
4722
4863
|
|
|
4723
4864
|
namespace = "connection"
|
|
4724
4865
|
key = "apis"
|
|
4725
|
-
value = { "TestApi" =
|
|
4866
|
+
value = { "TestApi" = local.api_url }
|
|
4726
4867
|
|
|
4727
4868
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
4728
4869
|
}
|
|
4729
4870
|
|
|
4871
|
+
# Custom domain for the API, served without the stage path prefix
|
|
4872
|
+
resource "aws_api_gateway_domain_name" "custom_domain" {
|
|
4873
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
4874
|
+
|
|
4875
|
+
domain_name = var.custom_domain_name
|
|
4876
|
+
regional_certificate_arn = var.acm_certificate_arn
|
|
4877
|
+
security_policy = "TLS_1_2"
|
|
4878
|
+
|
|
4879
|
+
endpoint_configuration {
|
|
4880
|
+
types = ["REGIONAL"]
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
tags = var.tags
|
|
4884
|
+
|
|
4885
|
+
lifecycle {
|
|
4886
|
+
precondition {
|
|
4887
|
+
condition = var.acm_certificate_arn != null
|
|
4888
|
+
error_message = "acm_certificate_arn is required when custom_domain_name is set."
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4893
|
+
resource "aws_api_gateway_base_path_mapping" "custom_domain" {
|
|
4894
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
4895
|
+
|
|
4896
|
+
api_id = module.rest_api.api_id
|
|
4897
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
4898
|
+
domain_name = aws_api_gateway_domain_name.custom_domain[0].domain_name
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4730
4901
|
# Outputs
|
|
4731
4902
|
|
|
4732
4903
|
# API Gateway Outputs (from core module)
|
|
@@ -4755,6 +4926,21 @@ output "stage_invoke_url" {
|
|
|
4755
4926
|
value = aws_api_gateway_stage.api_stage.invoke_url
|
|
4756
4927
|
}
|
|
4757
4928
|
|
|
4929
|
+
output "api_url" {
|
|
4930
|
+
description = "URL clients should call: the custom domain if configured, otherwise the stage invoke URL"
|
|
4931
|
+
value = local.api_url
|
|
4932
|
+
}
|
|
4933
|
+
|
|
4934
|
+
output "custom_domain_target_domain_name" {
|
|
4935
|
+
description = "Target domain name to point a DNS alias or CNAME record at for the custom domain"
|
|
4936
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_domain_name
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
output "custom_domain_hosted_zone_id" {
|
|
4940
|
+
description = "Hosted zone ID to use for a Route 53 alias record for the custom domain"
|
|
4941
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_zone_id
|
|
4942
|
+
}
|
|
4943
|
+
|
|
4758
4944
|
output "stage_arn" {
|
|
4759
4945
|
description = "ARN of the API Gateway stage"
|
|
4760
4946
|
value = aws_api_gateway_stage.api_stage.arn
|
|
@@ -4969,6 +5155,19 @@ variable "tags" {
|
|
|
4969
5155
|
default = {}
|
|
4970
5156
|
}
|
|
4971
5157
|
|
|
5158
|
+
# Custom domain configuration
|
|
5159
|
+
variable "custom_domain_name" {
|
|
5160
|
+
description = "Custom domain name for the API. Requires acm_certificate_arn."
|
|
5161
|
+
type = string
|
|
5162
|
+
default = null
|
|
5163
|
+
}
|
|
5164
|
+
|
|
5165
|
+
variable "acm_certificate_arn" {
|
|
5166
|
+
description = "ARN of an ACM certificate (in the API's region) for the custom domain name."
|
|
5167
|
+
type = string
|
|
5168
|
+
default = null
|
|
5169
|
+
}
|
|
5170
|
+
|
|
4972
5171
|
# Get current AWS region and account ID
|
|
4973
5172
|
data "aws_region" "current" {}
|
|
4974
5173
|
data "aws_caller_identity" "current" {}
|
|
@@ -5411,6 +5610,10 @@ locals {
|
|
|
5411
5610
|
]
|
|
5412
5611
|
}
|
|
5413
5612
|
|
|
5613
|
+
locals {
|
|
5614
|
+
api_url = var.custom_domain_name == null ? "\${aws_api_gateway_stage.api_stage.invoke_url}/" : "https://\${var.custom_domain_name}/"
|
|
5615
|
+
}
|
|
5616
|
+
|
|
5414
5617
|
# CloudWatch Log Group for Lambda
|
|
5415
5618
|
resource "aws_cloudwatch_log_group" "lambda_logs" {
|
|
5416
5619
|
#checkov:skip=CKV_AWS_158:Using default CloudWatch log encryption
|
|
@@ -5794,11 +5997,41 @@ module "add_url_to_runtime_config" {
|
|
|
5794
5997
|
|
|
5795
5998
|
namespace = "connection"
|
|
5796
5999
|
key = "apis"
|
|
5797
|
-
value = { "CustomApi" =
|
|
6000
|
+
value = { "CustomApi" = local.api_url }
|
|
5798
6001
|
|
|
5799
6002
|
depends_on = [aws_api_gateway_stage.api_stage]
|
|
5800
6003
|
}
|
|
5801
6004
|
|
|
6005
|
+
# Custom domain for the API, served without the stage path prefix
|
|
6006
|
+
resource "aws_api_gateway_domain_name" "custom_domain" {
|
|
6007
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
6008
|
+
|
|
6009
|
+
domain_name = var.custom_domain_name
|
|
6010
|
+
regional_certificate_arn = var.acm_certificate_arn
|
|
6011
|
+
security_policy = "TLS_1_2"
|
|
6012
|
+
|
|
6013
|
+
endpoint_configuration {
|
|
6014
|
+
types = ["REGIONAL"]
|
|
6015
|
+
}
|
|
6016
|
+
|
|
6017
|
+
tags = var.tags
|
|
6018
|
+
|
|
6019
|
+
lifecycle {
|
|
6020
|
+
precondition {
|
|
6021
|
+
condition = var.acm_certificate_arn != null
|
|
6022
|
+
error_message = "acm_certificate_arn is required when custom_domain_name is set."
|
|
6023
|
+
}
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
|
|
6027
|
+
resource "aws_api_gateway_base_path_mapping" "custom_domain" {
|
|
6028
|
+
count = var.custom_domain_name == null ? 0 : 1
|
|
6029
|
+
|
|
6030
|
+
api_id = module.rest_api.api_id
|
|
6031
|
+
stage_name = aws_api_gateway_stage.api_stage.stage_name
|
|
6032
|
+
domain_name = aws_api_gateway_domain_name.custom_domain[0].domain_name
|
|
6033
|
+
}
|
|
6034
|
+
|
|
5802
6035
|
# Outputs
|
|
5803
6036
|
|
|
5804
6037
|
# API Gateway Outputs (from core module)
|
|
@@ -5827,6 +6060,21 @@ output "stage_invoke_url" {
|
|
|
5827
6060
|
value = aws_api_gateway_stage.api_stage.invoke_url
|
|
5828
6061
|
}
|
|
5829
6062
|
|
|
6063
|
+
output "api_url" {
|
|
6064
|
+
description = "URL clients should call: the custom domain if configured, otherwise the stage invoke URL"
|
|
6065
|
+
value = local.api_url
|
|
6066
|
+
}
|
|
6067
|
+
|
|
6068
|
+
output "custom_domain_target_domain_name" {
|
|
6069
|
+
description = "Target domain name to point a DNS alias or CNAME record at for the custom domain"
|
|
6070
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_domain_name
|
|
6071
|
+
}
|
|
6072
|
+
|
|
6073
|
+
output "custom_domain_hosted_zone_id" {
|
|
6074
|
+
description = "Hosted zone ID to use for a Route 53 alias record for the custom domain"
|
|
6075
|
+
value = var.custom_domain_name == null ? null : aws_api_gateway_domain_name.custom_domain[0].regional_zone_id
|
|
6076
|
+
}
|
|
6077
|
+
|
|
5830
6078
|
output "stage_arn" {
|
|
5831
6079
|
description = "ARN of the API Gateway stage"
|
|
5832
6080
|
value = aws_api_gateway_stage.api_stage.arn
|