hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

Wrong documentation for creating canary . It throws error when using s3 for script location and passing 's3://' in the s3_bucket . #20161

Closed nihaldivyam closed 1 year ago

nihaldivyam commented 3 years ago

When creating canary script we don't need to pass 's3://' in the s3_bucket . The Terraform documentation is wrong . In the AWS documentation its mentioned not to pass s3:// in name, need to write only bucket name. Correct Example :-

resource "aws_synthetics_canary" "app2" {
  name                 = "dev-home"
  artifact_s3_location = "s3://cw-syn-results-######-eu-west-2/canary/eu-west-2/####/"
  execution_role_arn   = "arn:aws:iam::######:role/service-role/CloudWatchSyntheticsRole-dev-######"
  handler              = "pageLoadBlueprint.handler"
  s3_bucket            = "aws-synthetics-library-dev"
  s3_key               = "scripts/cwsyn-dev-grid-home.zip"
  runtime_version      = "syn-nodejs-puppeteer-3.1"
  schedule {
    expression = "rate(1 minute)"
  }
}

Error Screenshot from 2021-07-12 20-12-00

mknapik commented 1 year ago

Same issue, let me include terraform output:

Acquiring state lock. This may take a few moments...
aws_synthetics_canary.api: Destroying... [id=dev-api]
aws_synthetics_canary.api: Destruction complete after 3s
aws_synthetics_canary.api: Creating...
╷
│ Error: error waiting for Synthetics Canary (dev-api) create: error waiting on Synthetics Canary on retry (dev-api): unexpected state 'ERROR', wanted target 'READY'. last error: CREATE_FAILED: 1 validation error detected: Value 's3://redacted' at 'content.s3Bucket' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[0-9A-Za-z\.\-_]*(?<!\.)$ (Service: AWSLambda; Status Code: 400; Error Code: ValidationException; Request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx; Proxy: null)
│
│   with aws_synthetics_canary.api,
│   on synthethis.cloudwatch.tf line 1, in resource "aws_synthetics_canary" "api":
│    1: resource "aws_synthetics_canary" "api" {
│
github-actions[bot] commented 1 year ago

This functionality has been released in v4.57.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[bot] commented 1 year ago

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.