Skip to content

Instantly share code, notes, and snippets.

@EvanBoyle
Created June 24, 2020 21:07
Show Gist options
  • Save EvanBoyle/be5e6fcc4f2e09b143cc87fb21b9f41a to your computer and use it in GitHub Desktop.
Save EvanBoyle/be5e6fcc4f2e09b143cc87fb21b9f41a to your computer and use it in GitHub Desktop.
// Here's a representative set of errors that I picked up from running tf2pulumi over the AWS provider with verbose
// logging enabled.
# go
resource "aws_lambda_function" "example" {
filename = "example.zip"
function_name = "Example"
role = "${aws_iam_role.example.arn}"
handler = "index.handler"
runtime = "nodejs10.x"
}
resource "aws_apigatewayv2_integration" "example" {
api_id = "${aws_apigatewayv2_api.example.id}"
integration_type = "AWS"
connection_type = "INTERNET"
content_handling_strategy = "CONVERT_TO_TEXT"
description = "Lambda example"
integration_method = "POST"
integration_uri = "${aws_lambda_function.example.invoke_arn}"
passthrough_behavior = "WHEN_NO_MATCH"
}
Error: not yet implemented: call fileArchive
failed to convert HCL to go
# go
resource "aws_lambda_layer_version" "lambda_layer" {
filename = "lambda_layer_payload.zip"
layer_name = "lambda_layer_name"
compatible_runtimes = ["nodejs8.10"]
}
Error: not yet implemented: call fileArchive
not yet implemented: call fileArchive
not yet implemented: call fileArchive
# go
resource "aws_iam_role" "ecs_events" {
name = "ecs_events"
assume_role_policy = <<DOC
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "events.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
DOC
}
resource "aws_iam_role_policy" "ecs_events_run_task_with_any_role" {
name = "ecs_events_run_task_with_any_role"
role = "${aws_iam_role.ecs_events.id}"
policy = <<DOC
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "ecs:RunTask",
"Resource": "${replace(aws_ecs_task_definition.task_name.arn, "/:\\d+$/", ":*")}"
}
]
}
DOC
}
resource "aws_cloudwatch_event_target" "ecs_scheduled_task" {
target_id = "run-scheduled-task-every-hour"
arn = "${aws_ecs_cluster.cluster_name.arn}"
rule = "${aws_cloudwatch_event_rule.every_hour.name}"
role_arn = "${aws_iam_role.ecs_events.arn}"
ecs_target {
task_count = 1
task_definition_arn = "${aws_ecs_task_definition.task_name.arn}"
}
input = <<DOC
{
"containerOverrides": [
{
"name": "name-of-container-to-override",
"command": ["bin/console", "scheduled-task"]
}
]
}
DOC
}
Error: unknown function 'replace'
on main.tf line 33:
(source code not available)
Error: unknown function 'replace'
on main.tf.pp line 31:
32: "Resource": "${replace(aws_ecs_task_definition.task_name.arn, "/:\\d+$/", ":*")}"
# go
resource "aws_api_gateway_deployment" "MyDemoDeployment" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
stage_name = "test"
triggers = {
redeployment = sha1(join(",", list(
jsonencode(aws_api_gateway_integration.example),
)))
}
lifecycle {
create_before_destroy = true
}
}
Error: unknown function 'list'
on main.tf line 5:
(source code not available)
Error: unknown function 'join'
on main.tf line 5:
(source code not available)
Error: unknown function 'sha1'
on main.tf line 5:
(source code not available)
Error: unknown function 'list'
on main.tf.pp line 4:
5: redeployment = sha1(join(",", list(
Error: unknown function 'join'
on main.tf.pp line 4:
5: redeployment = sha1(join(",", list(
Error: unknown function 'sha1'
on main.tf.pp line 4:
5: redeployment = sha1(join(",", list(
# go
variable "extra_tags" {
default = [
{
key = "Foo"
value = "Bar"
propagate_at_launch = true
},
{
key = "Baz"
value = "Bam"
propagate_at_launch = true
},
]
}
resource "aws_autoscaling_group" "bar" {
name = "foobar3-test"
max_size = 5
min_size = 2
launch_configuration = "${aws_launch_configuration.foobar.name}"
vpc_zone_identifier = ["${aws_subnet.example1.id}", "${aws_subnet.example2.id}"]
tags = ["${concat(
list(
map("key", "interpolation1", "value", "value3", "propagate_at_launch", true),
map("key", "interpolation2", "value", "value4", "propagate_at_launch", true)
),
var.extra_tags)
}"]
}
Error: unknown function 'map'
on main.tf line 19:
(source code not available)
Error: unknown function 'map'
on main.tf line 19:
(source code not available)
Error: unknown function 'list'
on main.tf line 19:
(source code not available)
Error: unknown function 'concat'
on main.tf line 19:
(source code not available)
Error: too many arguments to call: expected 1, got 2
on <anonymous> line 0:
(source code not available)
Error: unknown function 'map'
on main.tf.pp line 17:
18: tagsCollection = concat(list(map("key", "interpolation1", "value", "value3", "propagate_at_launch", true), map("key", "interpolation2", "value", "value4", "propagate_at_launch", true)), extraTags)
Error: unknown function 'map'
on main.tf.pp line 17:
18: tagsCollection = concat(list(map("key", "interpolation1", "value", "value3", "propagate_at_launch", true), map("key", "interpolation2", "value", "value4", "propagate_at_launch", true)), extraTags)
Error: unknown function 'list'
on main.tf.pp line 17:
18: tagsCollection = concat(list(map("key", "interpolation1", "value", "value3", "propagate_at_launch", true), map("key", "interpolation2", "value", "value4", "propagate_at_launch", true)), extraTags)
Error: unknown function 'concat'
on main.tf.pp line 17:
18: tagsCollection = concat(list(map("key", "interpolation1", "value", "value3", "propagate_at_launch", true), map("key", "interpolation2", "value", "value4", "propagate_at_launch", true)), extraTags)
failed to convert HCL to go
# go
resource "aws_iot_thing" "example" {
name = "example"
}
resource "aws_iot_certificate" "cert" {
csr = "${file("csr.pem")}"
active = true
}
resource "aws_iot_thing_principal_attachment" "att" {
principal = "${aws_iot_certificate.cert.arn}"
thing = "${aws_iot_thing.example.name}"
}
Error: not yet implemented: ReadFile
not yet implemented: ReadFile
# go
resource "aws_pinpoint_apns_sandbox_channel" "apns_sandbox" {
application_id = "${aws_pinpoint_app.app.application_id}"
certificate = "${file("./certificate.pem")}"
private_key = "${file("./private_key.key")}"
}
resource "aws_pinpoint_app" "app" {}
Error: not yet implemented: ReadFile
not yet implemented: ReadFile
Error: not yet implemented: ReadFile
not yet implemented: ReadFile
failed to convert HCL to go
# go
resource "aws_s3_bucket_object" "object" {
bucket = "your_bucket_name"
key = "new_object_key"
source = "path/to/file"
# The filemd5() function is available in this provider 0.11.12 and later
# For this provider 0.11.11 and earlier, use the md5() function and the file() function:
# etag = "${md5(file("path/to/file"))}"
etag = "${filemd5("path/to/file")}"
}
Error: unknown function 'error'
on main.tf line 5:
(source code not available)
Error: unknown function 'error'
on main.tf.pp line 5:
6: etag = error("NYI: call to filemd5")
# go
resource "aws_launch_template" "foo" {
name = "foo"
block_device_mappings {
device_name = "/dev/sda1"
ebs {
volume_size = 20
}
}
capacity_reservation_specification {
capacity_reservation_preference = "open"
}
cpu_options {
core_count = 4
threads_per_core = 2
}
credit_specification {
cpu_credits = "standard"
}
disable_api_termination = true
ebs_optimized = true
elastic_gpu_specifications {
type = "test"
}
elastic_inference_accelerator {
type = "eia1.medium"
}
iam_instance_profile {
name = "test"
}
image_id = "ami-test"
instance_initiated_shutdown_behavior = "terminate"
instance_market_options {
market_type = "spot"
}
instance_type = "t2.micro"
kernel_id = "test"
key_name = "test"
license_specification {
license_configuration_arn = "arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef"
}
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
}
monitoring {
enabled = true
}
network_interfaces {
associate_public_ip_address = true
}
placement {
availability_zone = "us-west-2a"
}
ram_disk_id = "test"
vpc_security_group_ids = ["sg-12345678"]
tag_specifications {
resource_type = "instance"
tags = {
Name = "test"
}
}
user_data = filebase64("${path.module}/example.sh")
}
Error: unknown function 'filebase64'
on main.tf line 88:
(source code not available)
Error: unknown function 'filebase64'
on main.tf.pp line 61:
62: userData = filebase64("${path.module}/example.sh")
# go
# The map here can come from other supported configurations
# like locals, resource attribute, map() built-in, etc.
variable "example" {
default = {
key1 = "value1"
key2 = "value2"
}
type = "map"
}
resource "aws_secretsmanager_secret_version" "example" {
secret_id = "${aws_secretsmanager_secret.example.id}"
secret_string = "${jsonencode(var.example)}"
}
Error: unknown function 'error'
on main.tf line 10:
(source code not available)
Error: unknown function 'error'
on main.tf.pp line 10:
11: secretString = error("NYI: call to jsonencode")
# go
resource "aws_ses_domain_identity" "example" {
domain = "example.com"
}
resource "aws_ses_domain_dkim" "example" {
domain = "${aws_ses_domain_identity.example.domain}"
}
resource "aws_route53_record" "example_amazonses_dkim_record" {
count = 3
zone_id = "ABCDEFGHIJ123"
name = "${element(aws_ses_domain_dkim.example.dkim_tokens, count.index)}._domainkey.example.com"
type = "CNAME"
ttl = "600"
records = ["${element(aws_ses_domain_dkim.example.dkim_tokens, count.index)}.dkim.amazonses.com"]
}
Error: not yet implemented: element
not yet implemented: element
Error: not yet implemented: element
not yet implemented: element
# go
data "aws_availability_zones" "available" {
state = "available"
}
resource "aws_subnet" "example" {
count = 2
availability_zone = data.aws_availability_zones.available.names[count.index]
cidr_block = cidrsubnet(aws_vpc.example.cidr_block, 8, count.index)
vpc_id = aws_vpc.example.id
tags = {
"kubernetes.io/cluster/${aws_eks_cluster.example.name}" = "shared"
}
}
Error: unknown function 'cidrsubnet'
on main.tf.pp line 9:
10: cidrBlock = cidrsubnet(aws_vpc.example.cidr_block, 8, range.value)
# go
# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "mongo" {
task_definition = "${aws_ecs_task_definition.mongo.family}"
}
resource "aws_ecs_cluster" "foo" {
name = "foo"
}
resource "aws_ecs_task_definition" "mongo" {
family = "mongodb"
container_definitions = <<DEFINITION
[
{
"cpu": 128,
"environment": [{
"name": "SECRET",
"value": "KEY"
}],
"essential": true,
"image": "mongo:latest",
"memory": 128,
"memoryReservation": 64,
"name": "mongodb"
}
]
DEFINITION
}
resource "aws_ecs_service" "mongo" {
name = "mongo"
cluster = "${aws_ecs_cluster.foo.id}"
desired_count = 2
# Track the latest ACTIVE revision
task_definition = "${aws_ecs_task_definition.mongo.family}:${max("${aws_ecs_task_definition.mongo.revision}", "${data.aws_ecs_task_definition.mongo.revision}")}"
}
Error: unknown function 'error'
on main.tf line 32:
(source code not available)
Error: unknown function 'error'
on main.tf.pp line 30:
31: taskDefinition = "${mongoEcs/taskDefinitionTaskDefinition.family}:${error("NYI: call to max")}"
failed to convert HCL to go
# go
data "aws_instances" "test" {
instance_tags = {
Role = "HardWorker"
}
filter {
name = "instance.group-id"
values = ["sg-12345678"]
}
instance_state_names = ["running", "stopped"]
}
resource "aws_eip" "test" {
count = "${length(data.aws_instances.test.ids)}"
instance = "${data.aws_instances.test.ids[count.index]}"
}
Error: not yet implemented: call length
not yet implemented: call length
# go
data "aws_eks_cluster" "example" {
name = "example"
}
data "aws_eks_cluster_auth" "example" {
name = "example"
}
provider "kubernetes" {
host = "${data.aws_eks_cluster.example.endpoint}"
cluster_ca_certificate = "${base64decode(data.aws_eks_cluster.example.certificate_authority.0.data)}"
token = "${data.aws_eks_cluster_auth.example.token}"
load_config_file = false
}
Error: unknown function 'base64decode'
# go
data "aws_lambda_invocation" "example" {
function_name = "${aws_lambda_function.lambda_function_test.function_name}"
input = <<JSON
{
"key1": "value1",
"key2": "value2"
}
JSON
}
output "result" {
description = "String result of Lambda execution"
value = "${data.aws_lambda_invocation.example.result}"
}
output "result_entry_tf012" {
value = jsondecode(data.aws_lambda_invocation.example.result)["key1"]
}
Error: unknown function 'jsondecode'
on main.tf line 17:
(source code not available)
Error: unknown function 'jsondecode'
on main.tf.pp line 13:
14: value = jsondecode(example.result)["key1"]
failed to convert HCL to go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment