Skip to content

Commit

Permalink
Merge pull request #1849 from hashicorp/check-resolve-as-boolean-bug
Browse files Browse the repository at this point in the history
chore: synthesize all boolean as iresolvable tests
  • Loading branch information
DanielMSchmidt authored Jun 7, 2022
2 parents 93e9984 + df65e1b commit 5408d26
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ azureadUserAzureUsers.addOverride(
"
`;
exports[`convert list access through [] snapshot 1`] = `
exports[`convert list access through square brackets snapshot 1`] = `
"import * as cdktf from \\"cdktf\\";
/*Provider bindings are generated by running cdktf get.
Expand Down Expand Up @@ -863,7 +863,7 @@ new cdktf.TerraformOutput(this, \\"cidr_out\\", {
"
`;
exports[`convert property access through [] snapshot 1`] = `
exports[`convert property access through square brackets snapshot 1`] = `
"import * as cdktf from \\"cdktf\\";
/*Provider bindings are generated by running cdktf get.
Expand Down Expand Up @@ -961,7 +961,6 @@ new aws.AwsProvider(this, \\"aws\\", {
region: \\"us-east-1\\",
secretKey: \\"mock_secret_key\\",
skipCredentialsValidation: true,
skipMetadataApiCheck: true,
skipRequestingAccountId: true,
});
"
Expand Down
44 changes: 19 additions & 25 deletions packages/@cdktf/hcl2cdk/test/hcl2cdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const providers = [

enum Synth {
yes,
needsAFix_BooleanAsIResolvable, // https://github.com/hashicorp/terraform-cdk/issues/1550
needsAFix_UnforseenClassRename, // https://github.com/hashicorp/terraform-cdk/issues/1552
needsAFix_UnforseenPropertyRename, // https://github.com/hashicorp/terraform-cdk/issues/1708
never, // Some examples are built so that they will never synth but test a specific generation edge case
Expand Down Expand Up @@ -89,10 +88,6 @@ const createTestCase =
);
});
}

if ([Synth.needsAFix_BooleanAsIResolvable].includes(shouldSynth)) {
it.todo("plans");
}
});
};
const testCase = {
Expand Down Expand Up @@ -199,15 +194,14 @@ describe("convert", () => {
region = "us-east-1"
secret_key = "mock_secret_key"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
dynamodb = "http://localhost:8000"
}
}
`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -219,7 +213,7 @@ describe("convert", () => {
resource "aws_vpc" "example" {
cidr_block = "10.0.0.0/16"
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -332,7 +326,7 @@ describe("convert", () => {
cloudfront_default_certificate = true
}
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -344,7 +338,7 @@ describe("convert", () => {
data "aws_subnet" "selected" {
vpc_id = "subnet_id"
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -404,7 +398,7 @@ describe("convert", () => {
source = "index.html"
kms_key_id = aws_kms_key.examplekms.arn
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -422,7 +416,7 @@ describe("convert", () => {
bucket = local.bucket_name
acl = "private"
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -440,7 +434,7 @@ describe("convert", () => {
bucket = var.bucket_name
acl = "private"
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -463,7 +457,7 @@ describe("convert", () => {
bucket = data.aws_s3_bucket.examplebucket.arn
source = "index.html"
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -484,7 +478,7 @@ describe("convert", () => {
tag-key = var.bucket_name
}
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -594,7 +588,7 @@ describe("convert", () => {
source = "index.html"
kms_key_id = aws_kms_key.examplekms.arn
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -690,7 +684,7 @@ describe("convert", () => {
source = "index.html"
kms_key_id = aws_kms_key.examplekms.arn
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -724,7 +718,7 @@ describe("convert", () => {
kms_key_id = aws_kms_key.examplekms.arn
}
`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -751,7 +745,7 @@ describe("convert", () => {
);

testCase.test(
"property access through []",
"property access through square brackets",
`
provider "aws" {
region = "us-east-1"
Expand All @@ -765,11 +759,11 @@ describe("convert", () => {
acl = "private"
}
`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
"list access through []",
"list access through square brackets",
`
provider "aws" {
region = "us-east-1"
Expand All @@ -783,7 +777,7 @@ describe("convert", () => {
acl = "private"
}
`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -805,7 +799,7 @@ describe("convert", () => {
tag-key = "tag-value"
}
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand All @@ -825,7 +819,7 @@ describe("convert", () => {
}
}
`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down Expand Up @@ -901,7 +895,7 @@ describe("convert", () => {
Name = "allow_tls"
}
}`,
Synth.needsAFix_BooleanAsIResolvable
Synth.yes
);

testCase.test(
Expand Down

0 comments on commit 5408d26

Please sign in to comment.