Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive_file not creating archive #12471

Closed
blalor opened this issue Mar 6, 2017 · 2 comments
Closed

archive_file not creating archive #12471

blalor opened this issue Mar 6, 2017 · 2 comments

Comments

@blalor
Copy link
Contributor

blalor commented Mar 6, 2017

Terraform Version

v0.8.8

Affected Resource(s)

  • archive_file

Terraform Configuration Files

(partial; if the log's not sufficient, I'll encrypt my config and upload.)

data "null_data_source" "lambda_vars" {
    inputs = {
        output_path = "/tmp/route53-vpn-updater.${data.template_file.var_vpc_id.rendered}.zip"
    }
}

## zip up the Lambda source file
# https://github.com/hashicorp/terraform/issues/8344#issuecomment-265548941
data "archive_file" "route53_vpn_updater" {
    type = "zip"
    source_file = "${path.module}/files/lambda_functions/vpn_ddns.py"
    output_path = "${data.null_data_source.lambda_vars.outputs.output_path}"
}

## the Lambda function itself
resource "aws_lambda_function" "route53_vpn_updater" {
    ## must match pattern:
    ## (arn:aws:lambda:)?([a-z]{2}-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?
    function_name = "route53-vpn-updater_${data.template_file.var_vpc_label.rendered}"

    filename = "${data.null_data_source.lambda_vars.outputs.output_path}"
    source_code_hash = "${data.archive_file.route53_vpn_updater.output_base64sha256}"
    handler = "vpn_ddns.lambda_handler"

    role = "${var.ddns_lambda_role_arn}"
    
    runtime = "python2.7"
    timeout = 300
    
    kms_key_arn = "${aws_kms_key.ddns-lambda.arn}"
}

Debug Output

Encrypted with security@hashicorp.com's PGP key; this is from a real run of one of my environments.
terraform.log.gpg.zip

Expected Behavior

Lambda function should have been created from the archive file.

Actual Behavior

* aws_lambda_function.route53_vpn_updater: Unable to load "/tmp/route53-vpn-updater.prod_aws_gen_eu-west-1.zip": open /tmp/route53-vpn-updater.prod_aws_gen_eu-west-1.zip: no such file or directory

Steps to Reproduce

The apply worked fine on macOS 10.12.3, but failed in a CentOS 7 rkt container. The apply failed consistently enough in my CI environment that I was able to add the TF_LOG stuff to capture the output.

@blalor
Copy link
Contributor Author

blalor commented Mar 6, 2017

Is it possible that the archive_file datasource is creating the file during plan but not during apply? I'm using separate plan and apply runs, with the output of the plan being used as the input of the apply, and running in different containers (so there's no shared filesystem state outside of the terraform directories).

@ghost
Copy link

ghost commented Apr 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants