Skip to content

Commit

Permalink
chore: update snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Aug 9, 2023
1 parent 1f1a2b4 commit 8874684
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 654 deletions.
115 changes: 2 additions & 113 deletions packages/@cdktf/hcl2cdk/test/__snapshots__/iteration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,52 +98,6 @@ class MyConvertedCode extends TerraformStack {

exports[`iteration count loops snapshot typescript 1`] = `
"import { Construct } from "constructs";
import {
VariableType,
TerraformVariable,
Token,
TerraformIterator,
TerraformStack,
} from "cdktf";
/*
* Provider bindings are generated by running \`cdktf get\`.
* See https://cdk.tf/provider-generation for more details.
*/
import { IamUser } from "./.gen/providers/aws/iam-user";
import { AwsProvider } from "./.gen/providers/aws/provider";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
/*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
You can read more about this at https://cdk.tf/variables*/
new AwsProvider(this, "aws", {
region: "us-east-1",
});
const users = new TerraformVariable(this, "users", {
type: VariableType.set(VariableType.STRING),
});
/*In most cases loops should be handled in the programming language context and
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
const lbForEachIterator = TerraformIterator.fromList(
Token.asAny(users.value)
);
new IamUser(this, "lb", {
name: Token.asString(lbForEachIterator.key),
path: "/system/",
tags: {
"tag-key": "tag-value",
},
forEach: lbForEachIterator,
});
}
}
"
`;

exports[`iteration count loops snapshot typescript 2`] = `
"import { Construct } from "constructs";
import {
VariableType,
TerraformVariable,
Expand Down Expand Up @@ -189,70 +143,6 @@ class MyConvertedCode extends TerraformStack {
"
`;

exports[`iteration count loops snapshot typescript 3`] = `
"import { Construct } from "constructs";
import {
VariableType,
TerraformVariable,
Fn,
Token,
TerraformIterator,
TerraformStack,
} from "cdktf";
/*
* Provider bindings are generated by running \`cdktf get\`.
* See https://cdk.tf/provider-generation for more details.
*/
import { KmsKey } from "./.gen/providers/aws/kms-key";
import { AwsProvider } from "./.gen/providers/aws/provider";
import { S3Bucket } from "./.gen/providers/aws/s3-bucket";
import { S3BucketObject } from "./.gen/providers/aws/s3-bucket-object";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
/*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
You can read more about this at https://cdk.tf/variables*/
new AwsProvider(this, "aws", {
region: "us-east-1",
});
const buckets = new TerraformVariable(this, "buckets", {
type: VariableType.list(VariableType.STRING),
});
const examplekms = new KmsKey(this, "examplekms", {
deletionWindowInDays: 7,
description: "KMS key 1",
});
/*In most cases loops should be handled in the programming language context and
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
const examplebucketForEachIterator = TerraformIterator.fromList(
Token.asAny(Fn.toset(Fn.lookupNested(buckets.value, ["*"])))
);
const examplebucket = new S3Bucket(this, "examplebucket", {
acl: "private",
bucket: Token.asString(examplebucketForEachIterator.key),
forEach: examplebucketForEachIterator,
});
/*In most cases loops should be handled in the programming language context and
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
const examplebucketObjectForEachIterator = TerraformIterator.fromList(
Token.asAny(Fn.toset(Fn.lookupNested(examplebucket, ["*"])))
);
new S3BucketObject(this, "examplebucket_object", {
bucket: examplebucketObjectForEachIterator.key,
key: "someobject",
kmsKeyId: examplekms.arn,
source: "index.html",
forEach: examplebucketObjectForEachIterator,
});
}
}
"
`;

exports[`iteration dynamic blocks snapshot typescript 1`] = `
"import { Construct } from "constructs";
import {
Expand Down Expand Up @@ -365,7 +255,6 @@ exports[`iteration for each on list using splat snapshot typescript 1`] = `
import {
VariableType,
TerraformVariable,
propertyAccess,
Fn,
Token,
TerraformIterator,
Expand Down Expand Up @@ -399,7 +288,7 @@ class MyConvertedCode extends TerraformStack {
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
const examplebucketForEachIterator = TerraformIterator.fromList(
Token.asAny(Fn.toset(propertyAccess(buckets.value, ["*"])))
Token.asAny(Fn.toset(Fn.lookupNested(buckets.value, ["*"])))
);
const examplebucket = new S3Bucket(this, "examplebucket", {
acl: "private",
Expand All @@ -411,7 +300,7 @@ class MyConvertedCode extends TerraformStack {
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
const examplebucketObjectForEachIterator = TerraformIterator.fromList(
Token.asAny(Fn.toset(propertyAccess(examplebucket, ["*"])))
Token.asAny(Fn.toset(Fn.lookupNested(examplebucket, ["*"])))
);
new S3BucketObject(this, "examplebucket_object", {
bucket: examplebucketObjectForEachIterator.key,
Expand Down
137 changes: 0 additions & 137 deletions packages/@cdktf/hcl2cdk/test/__snapshots__/jsiiLanguage.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,143 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`JSII Language Support complex aws example snapshot csharp 1`] = `
"import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running \`cdktf get\`.
* See https://cdk.tf/provider-generation for more details.
*/
import { KmsKey } from "./.gen/providers/aws/kms-key";
import { AwsProvider } from "./.gen/providers/aws/provider";
import { S3Bucket } from "./.gen/providers/aws/s3-bucket";
import { S3BucketObject } from "./.gen/providers/aws/s3-bucket-object";
import { SecurityGroup } from "./.gen/providers/aws/security-group";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new AwsProvider(this, "aws", {
region: "us-east-1",
});
const examplekms = new KmsKey(this, "examplekms", {
deletionWindowInDays: 7,
description: "KMS key 1",
});
const examplebucket = new S3Bucket(this, "examplebucket", {
acl: "private",
bucket: "examplebuckettftest",
});
new S3BucketObject(this, "examplebucket_object", {
bucket: examplebucket.bucket,
key: "someobject",
kmsKeyId: examplekms.arn,
source: "index.html",
});
new SecurityGroup(this, "allow_tls", {
description: "Allow TLS inbound traffic",
egress: [
{
cidrBlocks: ["0.0.0.0/0"],
fromPort: 0,
ipv6CidrBlocks: ["::/0"],
protocol: "-1",
toPort: 0,
},
],
ingress: [
{
description: "TLS from VPC",
fromPort: 443,
protocol: "tcp",
toPort: 443,
},
{
description: "TLS from VPC",
fromPort: 80,
protocol: "tcp",
toPort: 80,
},
{
fromPort: 8080,
protocol: "tcp",
toPort: 8080,
},
],
name: "allow_tls",
tags: {
Name: "allow_tls",
},
});
}
}
"
`;

exports[`JSII Language Support complex aws example snapshot csharp 2`] = `
"from constructs import Construct
from cdktf import TerraformStack
#
# Provider bindings are generated by running \`cdktf get\`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.aws.kms_key import KmsKey
from imports.aws.provider import AwsProvider
from imports.aws.s3_bucket import S3Bucket
from imports.aws.s3_bucket_object import S3BucketObject
from imports.aws.security_group import SecurityGroup
class MyConvertedCode(TerraformStack):
def __init__(self, scope, name):
super().__init__(scope, name)
AwsProvider(self, "aws",
region="us-east-1"
)
examplekms = KmsKey(self, "examplekms",
deletion_window_in_days=7,
description="KMS key 1"
)
examplebucket = S3Bucket(self, "examplebucket",
acl="private",
bucket="examplebuckettftest"
)
S3BucketObject(self, "examplebucket_object",
bucket=examplebucket.bucket,
key="someobject",
kms_key_id=examplekms.arn,
source="index.html"
)
SecurityGroup(self, "allow_tls",
description="Allow TLS inbound traffic",
egress=[SecurityGroupEgress(
cidr_blocks=["0.0.0.0/0"],
from_port=0,
ipv6_cidr_blocks=["::/0"],
protocol="-1",
to_port=0
)
],
ingress=[SecurityGroupIngress(
description="TLS from VPC",
from_port=443,
protocol="tcp",
to_port=443
), SecurityGroupIngress(
description="TLS from VPC",
from_port=80,
protocol="tcp",
to_port=80
), SecurityGroupIngress(
from_port=8080,
protocol="tcp",
to_port=8080
)
],
name="allow_tls",
tags={
"Name": "allow_tls"
}
)"
`;

exports[`JSII Language Support complex aws example snapshot csharp 3`] = `
"using Constructs;
using HashiCorp.Cdktf;
/*
Expand Down
28 changes: 0 additions & 28 deletions packages/@cdktf/hcl2cdk/test/__snapshots__/provider.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,6 @@ class MyConvertedCode extends TerraformStack {
exports[`provider provider alias snapshot typescript 1`] = `
"import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running \`cdktf get\`.
* See https://cdk.tf/provider-generation for more details.
*/
import { AwsProvider } from "./.gen/providers/aws/provider";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
new AwsProvider(this, "aws", {
accessKey: "mock_access_key",
endpoints: [
{
dynamodb: "http://localhost:8000",
},
],
region: "us-east-1",
secretKey: "mock_secret_key",
skipCredentialsValidation: true,
skipRequestingAccountId: true,
});
}
}
"
`;

exports[`provider provider alias snapshot typescript 2`] = `
"import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running \`cdktf get\`.
* See https://cdk.tf/provider-generation for more details.
Expand Down
Loading

0 comments on commit 8874684

Please sign in to comment.