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

resource/aws_synthetics_canary: error reading Synthetics Canary name #18636

Closed
GopalaDuggina opened this issue Apr 7, 2021 · 13 comments · Fixed by #20463
Closed

resource/aws_synthetics_canary: error reading Synthetics Canary name #18636

GopalaDuggina opened this issue Apr 7, 2021 · 13 comments · Fixed by #20463
Labels
bug Addresses a defect in current functionality. service/synthetics Issues and PRs that pertain to the synthetics service.
Milestone

Comments

@GopalaDuggina
Copy link

GopalaDuggina commented Apr 7, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

3.35.0

Affected Resource(s)

  • aws_synthetics_canary

Description

In aws_synthetics_canary resource , argument "name" not able to read the provided input value

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

data "archive_file" "source" {
  type        = "zip"
  source_dir  = "${path.module}/files/canaries"
  output_path = "${path.module}/files/canaries.zip"
}

resource "aws_synthetics_canary" "wbox-es-endpoint" {
  depends_on = [data.archive_file.source]

  name                 = "test-endpoint"
  artifact_s3_location = var.artifact_s3_location
  execution_role_arn   = var.execution_role_arn
  handler              = "script.handler"
  zip_file            = data.archive_file.source.output_path
  runtime_version      = "syn-nodejs-puppeteer-3.1"
  run_config {
    memory_in_mb       = 960
    timeout_in_seconds = 60
  }
  vpc_config {
    security_group_ids = ["xxxxxxxxx"]
    subnet_ids = [
      "xxxxxxxx",
    ]
  }
  schedule {
    duration_in_seconds = 0
    expression          = "rate(5 minutes)"
  }
  tags = local.default_tags
}

Debug Output

aws_synthetics_canary.wbox-es-endpoint: Creating...

Error: error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, GetCanaryInput.Name.

    on canary.tf line 58, in resource "aws_synthetics_canary" "wbox-es-endpoint":
    resource "aws_synthetics_canary" "wbox-es-endpoint" {

Panic Output

Expected Behavior

Terraform should be able to create a canary

Actual Behavior

aws_synthetics_canary.wbox-es-endpoint: Creating...

Error: error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, GetCanaryInput.Name.

    on canary.tf line 58, in resource "aws_synthetics_canary" "wbox-es-endpoint":
    resource "aws_synthetics_canary" "wbox-es-endpoint" {

Steps to Reproduce

  1. terraform apply
@ghost ghost added the service/synthetics Issues and PRs that pertain to the synthetics service. label Apr 7, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 7, 2021
@bill-rich bill-rich added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 7, 2021
@DesmondH0
Copy link

fwiw, we also hit this issue with version 3.36.0

@cesarwhite
Copy link

Getting a similar issue with 3.36.0:

aws_synthetics_canary.mycw_canary_tf_test: Creating...

│ Error: error starting Synthetics Canary: InvalidParameter: 1 validation error(s) found.
│ - minimum field size of 1, StartCanaryInput.Name.


│ on s3bucket.tf line 79, in resource "aws_synthetics_canary" "mycw_canary_tf_test":
│ 79: resource "aws_synthetics_canary" "mycw_canary_tf_test" {

Do you have a time frame to be able to look into this? Thank you!

@q45
Copy link

q45 commented Apr 19, 2021

getting the same error with 3.37.0

Error: error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, GetCanaryInput.Name.

    on ../canary/main.tf line 1, in resource "aws_synthetics_canary" "some":
    1: resource "aws_synthetics_canary" "some" {

@sthristov
Copy link

I had the same issue and it turned out that the artifact bucket had to defined with 's3://...' like:

artifact_s3_location = "s3://${var.artifact_s3_location}"

I hope that helps.

@DesmondH0
Copy link

I had further debug this on my case.
And after enabled debugging with export TF_LOG=DEBUG, I can see the error was returned with a response code 400.
Which is a Validation issue, and after creating a AWS ticket and giving the original POST call.
AWS is able to track down which part the input was wrong.

For my case, it's just a stupid error at rate(2 minutes), and I was missing s in minute

@codecheetos
Copy link

Did anyone try with this PR and see if the validations are fixed?

https://github.com/MaksymBilenko/terraform-provider-synthetics

@Webgardener
Copy link

Did anyone try with this PR and see if the validations are fixed?

https://github.com/MaksymBilenko/terraform-provider-synthetics

I have just tried it out. It works with adjustment. See issue MaksymBilenko/terraform-provider-synthetics#10

@srgustafson8
Copy link
Contributor

I just came across this - as apparent with other people's cases, it seems the validation message is incorrect.

Checking the debug logs, I got an HTTP 400 Bad Request response with the message "ArtifactS3Location: The bucket does not exist." while Terraform told me error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found. - minimum field size of 1, GetCanaryInput.Name.

@NJITman
Copy link

NJITman commented Jun 22, 2021

The validations are not fixed as of 06/22/2021. I got the same error for the artifact_s3_location and schedule expression having validation errors. Looks like it is using the same error message for all failed validations (or at least the two that I forced to fail).

Error: error reading Synthetics Canary: InvalidParameter: 1 validation error(s) found.
│ - minimum field size of 1, GetCanaryInput.Name.

@gingeririna
Copy link

gingeririna commented Aug 4, 2021

I had the same issue, problem was with schedule. I changed rate(5 minutes) to rate(1 minutes) and forgot to remove (s) in the end.

@NJITman
Copy link

NJITman commented Aug 4, 2021

Yeah, each of those small issues (forgetting the s, adding the s when it is not needed), plus other validation errors all give the same validation error. The error messages need to be updated to reflect what failed, otherwise, you have to look through your code to find the offending issues.

@github-actions
Copy link

This functionality has been released in v3.54.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/synthetics Issues and PRs that pertain to the synthetics service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.