Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Sep 18, 2023
1 parent cb0e5b2 commit edf83eb
Showing 1 changed file with 287 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,109 +2,341 @@

exports[`generate module that can't be initialized 1`] = `
"// generated by cdktf get
// terraform-aws-modules/vpc/aws//modules/vpc-endpoints
// milliHQ/next-js/aws
import { TerraformModule, TerraformModuleUserConfig } from 'cdktf';
import { Construct } from 'constructs';
export interface VpcEndpointsConfig extends TerraformModuleUserConfig {
export interface NextJsConfig extends TerraformModuleUserConfig {
/**
* Determines whether resources will be created
* ACM certificate arn for custom_domain
*/
readonly cloudfrontAcmCertificateArn?: string;
/**
* Aliases for custom_domain
*
*/
readonly cloudfrontAliases?: string[];
/**
* Header keys that should be used to calculate the cache key in CloudFront.
* Authorization
*/
readonly cloudfrontCacheKeyHeaders?: string[];
/**
* Controls whether the main CloudFront distribution should be created.
* true
*/
readonly create?: boolean;
readonly cloudfrontCreateDistribution?: boolean;
/**
* A map of interface and/or gateway endpoints containing their properties and configurations
* When using an external CloudFront distribution provide its arn.
*/
readonly endpoints?: any;
readonly cloudfrontExternalArn?: string;
/**
* Default security group IDs to associate with the VPC endpoints
*
* When using an external CloudFront distribution provide its id.
*/
readonly securityGroupIds?: string[];
readonly cloudfrontExternalId?: string;
/**
* Default subnets IDs to associate with the VPC endpoints
*
* The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. One of SSLv3, TLSv1, TLSv1_2016, TLSv1.1_2016, TLSv1.2_2018 or TLSv1.2_2019.
* TLSv1
*/
readonly subnetIds?: string[];
readonly cloudfrontMinimumProtocolVersion?: string;
/**
* A map of tags to use on all resources
* Id of a custom request policy that overrides the default policy (AllViewer). Can be custom or managed.
*/
readonly cloudfrontOriginRequestPolicy?: string;
/**
* Price class for the CloudFront distributions (main & proxy config). One of PriceClass_All, PriceClass_200, PriceClass_100.
* PriceClass_100
*/
readonly cloudfrontPriceClass?: string;
/**
* Id of a response headers policy. Can be custom or managed. Default is empty.
*/
readonly cloudfrontResponseHeadersPolicy?: string;
/**
* An optional webacl2 arn or webacl id to associate with the cloudfront distribution
*/
readonly cloudfrontWebaclId?: string;
/**
* Controls whether resources for image optimization support should be created or not.
* true
*/
readonly createImageOptimization?: boolean;
/**
* Use locally built packages rather than download them from npm.
*/
readonly debugUseLocalPackages?: boolean;
/**
* Identifier for the deployment group (only lowercase alphanumeric characters and hyphens are allowed).
* tf-next
*/
readonly deploymentName?: string;
/**
* Controls whether it should be possible to run multiple deployments in parallel (requires multiple_deployments_base_domain).
*/
readonly enableMultipleDeployments?: boolean;
/**
* Amount of memory in MB the worker Lambda Function for image optimization can use. Valid value between 128 MB to 10,240 MB, in 1 MB increments.
* 2,048
*/
readonly imageOptimizationLambdaMemorySize?: number;
/**
* Whether to deploy additional lambda JSON policies. If false, lambda_policy_json will not be attached to the lambda function. (Necessary since policy strings are only known after apply when using Terraforms data.aws_iam_policy_document)
*/
readonly lambdaAttachPolicyJson?: boolean;
/**
* Set to true if the Lambda functions should be attached to a VPC. Use this setting if VPC resources should be accessed by the Lambda functions. When setting this to true, use vpc_security_group_ids and vpc_subnet_ids to specify the VPC networking. Note that attaching to a VPC would introduce a delay on to cold starts
*/
readonly lambdaAttachToVpc?: boolean;
/**
* Additional policy document as JSON to attach to the Lambda Function role
*/
readonly lambdaPolicyJson?: string;
/**
* ARN of IAM policy that scopes aws_iam_role access for the lambda
*/
readonly lambdaRolePermissionsBoundary?: string;
/**
* Default wildcard domain where new deployments should be available. Should be in the form of *.example.com.
*/
readonly multipleDeploymentsBaseDomain?: string;
/**
* Tag metadata to label AWS resources that support tags.
* The property type contains a map, they have special handling, please see {@link cdk.tf/module-map-inputs the docs}
*/
readonly tags?: { [key: string]: string };
/**
* Define maximum timeout for creating, updating, and deleting VPC endpoint resources
* Tag metadata to label AWS S3 buckets. Overrides tags with the same name in input variable tags.
* The property type contains a map, they have special handling, please see {@link cdk.tf/module-map-inputs the docs}
*/
readonly timeouts?: { [key: string]: string };
readonly tagsS3Bucket?: { [key: string]: string };
/**
* The ID of the VPC in which the endpoint will be used
* The list of Security Group IDs to be used by the Lambda functions. lambda_attach_to_vpc should be set to true for these to be applied.
*
*/
readonly vpcId?: string;
readonly vpcSecurityGroupIds?: string[];
/**
* The list of VPC subnet IDs to attach the Lambda functions. lambda_attach_to_vpc should be set to true for these to be applied.
*
*/
readonly vpcSubnetIds?: string[];
}
/**
* Defines an VpcEndpoints based on a Terraform module
* Defines an NextJs based on a Terraform module
*
* Docs at Terraform Registry: {@link https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/3.19.0/submodules/vpc-endpoints terraform-aws-modules/vpc/aws//modules/vpc-endpoints}
* Docs at Terraform Registry: {@link https://registry.terraform.io/modules/milliHQ/next-js/aws/1.0.0-canary.5 milliHQ/next-js/aws}
*/
export class VpcEndpoints extends TerraformModule {
export class NextJs extends TerraformModule {
private readonly inputs: { [name: string]: any } = { }
public constructor(scope: Construct, id: string, config: VpcEndpointsConfig = {}) {
public constructor(scope: Construct, id: string, config: NextJsConfig = {}) {
super(scope, id, {
...config,
source: 'terraform-aws-modules/vpc/aws//modules/vpc-endpoints',
version: '3.19.0',
source: 'milliHQ/next-js/aws',
version: '1.0.0-canary.5',
});
this.create = config.create;
this.endpoints = config.endpoints;
this.securityGroupIds = config.securityGroupIds;
this.subnetIds = config.subnetIds;
this.cloudfrontAcmCertificateArn = config.cloudfrontAcmCertificateArn;
this.cloudfrontAliases = config.cloudfrontAliases;
this.cloudfrontCacheKeyHeaders = config.cloudfrontCacheKeyHeaders;
this.cloudfrontCreateDistribution = config.cloudfrontCreateDistribution;
this.cloudfrontExternalArn = config.cloudfrontExternalArn;
this.cloudfrontExternalId = config.cloudfrontExternalId;
this.cloudfrontMinimumProtocolVersion = config.cloudfrontMinimumProtocolVersion;
this.cloudfrontOriginRequestPolicy = config.cloudfrontOriginRequestPolicy;
this.cloudfrontPriceClass = config.cloudfrontPriceClass;
this.cloudfrontResponseHeadersPolicy = config.cloudfrontResponseHeadersPolicy;
this.cloudfrontWebaclId = config.cloudfrontWebaclId;
this.createImageOptimization = config.createImageOptimization;
this.debugUseLocalPackages = config.debugUseLocalPackages;
this.deploymentName = config.deploymentName;
this.enableMultipleDeployments = config.enableMultipleDeployments;
this.imageOptimizationLambdaMemorySize = config.imageOptimizationLambdaMemorySize;
this.lambdaAttachPolicyJson = config.lambdaAttachPolicyJson;
this.lambdaAttachToVpc = config.lambdaAttachToVpc;
this.lambdaPolicyJson = config.lambdaPolicyJson;
this.lambdaRolePermissionsBoundary = config.lambdaRolePermissionsBoundary;
this.multipleDeploymentsBaseDomain = config.multipleDeploymentsBaseDomain;
this.tags = config.tags;
this.timeouts = config.timeouts;
this.vpcId = config.vpcId;
this.tagsS3Bucket = config.tagsS3Bucket;
this.vpcSecurityGroupIds = config.vpcSecurityGroupIds;
this.vpcSubnetIds = config.vpcSubnetIds;
}
public get create(): boolean | undefined {
return this.inputs['create'] as boolean | undefined;
public get cloudfrontAcmCertificateArn(): string | undefined {
return this.inputs['cloudfront_acm_certificate_arn'] as string | undefined;
}
public set create(value: boolean | undefined) {
this.inputs['create'] = value;
public set cloudfrontAcmCertificateArn(value: string | undefined) {
this.inputs['cloudfront_acm_certificate_arn'] = value;
}
public get endpoints(): any | undefined {
return this.inputs['endpoints'] as any | undefined;
public get cloudfrontAliases(): string[] | undefined {
return this.inputs['cloudfront_aliases'] as string[] | undefined;
}
public set endpoints(value: any | undefined) {
this.inputs['endpoints'] = value;
public set cloudfrontAliases(value: string[] | undefined) {
this.inputs['cloudfront_aliases'] = value;
}
public get securityGroupIds(): string[] | undefined {
return this.inputs['security_group_ids'] as string[] | undefined;
public get cloudfrontCacheKeyHeaders(): string[] | undefined {
return this.inputs['cloudfront_cache_key_headers'] as string[] | undefined;
}
public set securityGroupIds(value: string[] | undefined) {
this.inputs['security_group_ids'] = value;
public set cloudfrontCacheKeyHeaders(value: string[] | undefined) {
this.inputs['cloudfront_cache_key_headers'] = value;
}
public get subnetIds(): string[] | undefined {
return this.inputs['subnet_ids'] as string[] | undefined;
public get cloudfrontCreateDistribution(): boolean | undefined {
return this.inputs['cloudfront_create_distribution'] as boolean | undefined;
}
public set subnetIds(value: string[] | undefined) {
this.inputs['subnet_ids'] = value;
public set cloudfrontCreateDistribution(value: boolean | undefined) {
this.inputs['cloudfront_create_distribution'] = value;
}
public get cloudfrontExternalArn(): string | undefined {
return this.inputs['cloudfront_external_arn'] as string | undefined;
}
public set cloudfrontExternalArn(value: string | undefined) {
this.inputs['cloudfront_external_arn'] = value;
}
public get cloudfrontExternalId(): string | undefined {
return this.inputs['cloudfront_external_id'] as string | undefined;
}
public set cloudfrontExternalId(value: string | undefined) {
this.inputs['cloudfront_external_id'] = value;
}
public get cloudfrontMinimumProtocolVersion(): string | undefined {
return this.inputs['cloudfront_minimum_protocol_version'] as string | undefined;
}
public set cloudfrontMinimumProtocolVersion(value: string | undefined) {
this.inputs['cloudfront_minimum_protocol_version'] = value;
}
public get cloudfrontOriginRequestPolicy(): string | undefined {
return this.inputs['cloudfront_origin_request_policy'] as string | undefined;
}
public set cloudfrontOriginRequestPolicy(value: string | undefined) {
this.inputs['cloudfront_origin_request_policy'] = value;
}
public get cloudfrontPriceClass(): string | undefined {
return this.inputs['cloudfront_price_class'] as string | undefined;
}
public set cloudfrontPriceClass(value: string | undefined) {
this.inputs['cloudfront_price_class'] = value;
}
public get cloudfrontResponseHeadersPolicy(): string | undefined {
return this.inputs['cloudfront_response_headers_policy'] as string | undefined;
}
public set cloudfrontResponseHeadersPolicy(value: string | undefined) {
this.inputs['cloudfront_response_headers_policy'] = value;
}
public get cloudfrontWebaclId(): string | undefined {
return this.inputs['cloudfront_webacl_id'] as string | undefined;
}
public set cloudfrontWebaclId(value: string | undefined) {
this.inputs['cloudfront_webacl_id'] = value;
}
public get createImageOptimization(): boolean | undefined {
return this.inputs['create_image_optimization'] as boolean | undefined;
}
public set createImageOptimization(value: boolean | undefined) {
this.inputs['create_image_optimization'] = value;
}
public get debugUseLocalPackages(): boolean | undefined {
return this.inputs['debug_use_local_packages'] as boolean | undefined;
}
public set debugUseLocalPackages(value: boolean | undefined) {
this.inputs['debug_use_local_packages'] = value;
}
public get deploymentName(): string | undefined {
return this.inputs['deployment_name'] as string | undefined;
}
public set deploymentName(value: string | undefined) {
this.inputs['deployment_name'] = value;
}
public get enableMultipleDeployments(): boolean | undefined {
return this.inputs['enable_multiple_deployments'] as boolean | undefined;
}
public set enableMultipleDeployments(value: boolean | undefined) {
this.inputs['enable_multiple_deployments'] = value;
}
public get imageOptimizationLambdaMemorySize(): number | undefined {
return this.inputs['image_optimization_lambda_memory_size'] as number | undefined;
}
public set imageOptimizationLambdaMemorySize(value: number | undefined) {
this.inputs['image_optimization_lambda_memory_size'] = value;
}
public get lambdaAttachPolicyJson(): boolean | undefined {
return this.inputs['lambda_attach_policy_json'] as boolean | undefined;
}
public set lambdaAttachPolicyJson(value: boolean | undefined) {
this.inputs['lambda_attach_policy_json'] = value;
}
public get lambdaAttachToVpc(): boolean | undefined {
return this.inputs['lambda_attach_to_vpc'] as boolean | undefined;
}
public set lambdaAttachToVpc(value: boolean | undefined) {
this.inputs['lambda_attach_to_vpc'] = value;
}
public get lambdaPolicyJson(): string | undefined {
return this.inputs['lambda_policy_json'] as string | undefined;
}
public set lambdaPolicyJson(value: string | undefined) {
this.inputs['lambda_policy_json'] = value;
}
public get lambdaRolePermissionsBoundary(): string | undefined {
return this.inputs['lambda_role_permissions_boundary'] as string | undefined;
}
public set lambdaRolePermissionsBoundary(value: string | undefined) {
this.inputs['lambda_role_permissions_boundary'] = value;
}
public get multipleDeploymentsBaseDomain(): string | undefined {
return this.inputs['multiple_deployments_base_domain'] as string | undefined;
}
public set multipleDeploymentsBaseDomain(value: string | undefined) {
this.inputs['multiple_deployments_base_domain'] = value;
}
public get tags(): { [key: string]: string } | undefined {
return this.inputs['tags'] as { [key: string]: string } | undefined;
}
public set tags(value: { [key: string]: string } | undefined) {
this.inputs['tags'] = value;
}
public get timeouts(): { [key: string]: string } | undefined {
return this.inputs['timeouts'] as { [key: string]: string } | undefined;
public get tagsS3Bucket(): { [key: string]: string } | undefined {
return this.inputs['tags_s3_bucket'] as { [key: string]: string } | undefined;
}
public set timeouts(value: { [key: string]: string } | undefined) {
this.inputs['timeouts'] = value;
public set tagsS3Bucket(value: { [key: string]: string } | undefined) {
this.inputs['tags_s3_bucket'] = value;
}
public get vpcId(): string | undefined {
return this.inputs['vpc_id'] as string | undefined;
public get vpcSecurityGroupIds(): string[] | undefined {
return this.inputs['vpc_security_group_ids'] as string[] | undefined;
}
public set vpcId(value: string | undefined) {
this.inputs['vpc_id'] = value;
public set vpcSecurityGroupIds(value: string[] | undefined) {
this.inputs['vpc_security_group_ids'] = value;
}
public get endpointsOutput() {
return this.getString('endpoints')
public get vpcSubnetIds(): string[] | undefined {
return this.inputs['vpc_subnet_ids'] as string[] | undefined;
}
public set vpcSubnetIds(value: string[] | undefined) {
this.inputs['vpc_subnet_ids'] = value;
}
public get apiEndpointOutput() {
return this.getString('api_endpoint')
}
public get apiEndpointAccessPolicyArnOutput() {
return this.getString('api_endpoint_access_policy_arn')
}
public get cloudfrontCustomErrorResponseOutput() {
return this.getString('cloudfront_custom_error_response')
}
public get cloudfrontDefaultCacheBehaviorOutput() {
return this.getString('cloudfront_default_cache_behavior')
}
public get cloudfrontDefaultRootObjectOutput() {
return this.getString('cloudfront_default_root_object')
}
public get cloudfrontDomainNameOutput() {
return this.getString('cloudfront_domain_name')
}
public get cloudfrontHostedZoneIdOutput() {
return this.getString('cloudfront_hosted_zone_id')
}
public get cloudfrontOrderedCacheBehaviorsOutput() {
return this.getString('cloudfront_ordered_cache_behaviors')
}
public get cloudfrontOriginsOutput() {
return this.getString('cloudfront_origins')
}
public get uploadBucketIdOutput() {
return this.getString('upload_bucket_id')
}
protected synthesizeAttributes() {
return this.inputs;
Expand Down

0 comments on commit edf83eb

Please sign in to comment.