Skip to content

Commit

Permalink
feat: Add link to TF Cloud documentation (#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
mildaniel authored Aug 30, 2023
1 parent be3f6b8 commit b297ff0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions samcli/hook_packages/terraform/hooks/prepare/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
"HookName": "terraform",
}

TF_CLOUD_LINK = (
"https://docs.aws.amazon.com/serverless-application-model/latest"
"/developerguide/gs-terraform-support.html#gs-terraform-support-cloud"
)
TF_CLOUD_EXCEPTION_MESSAGE = "Terraform Cloud does not support saving the generated execution plan"
TF_CLOUD_HELP_MESSAGE = (
"Terraform Cloud does not currently support generating local plan "
"files that AWS SAM CLI uses to parse the Terraform project.\n"
"To use AWS SAM CLI with Terraform Cloud applications, provide "
"a plan file using the --terraform-plan-file flag."
"a plan file using the --terraform-plan-file flag.\n\n"
f"For more information, follow the link: {TF_CLOUD_LINK}"
)

TF_BLOCKED_ARGUMENTS = [
Expand Down Expand Up @@ -227,7 +232,6 @@ def _generate_plan_file(skip_prepare_infra: bool, terraform_application_dir: str
) from e
except LoadingPatternError as e:
if TF_CLOUD_EXCEPTION_MESSAGE in e.message:
# TODO: Add link to TF Cloud documentation when that is ready
raise TerraformCloudException(TF_CLOUD_HELP_MESSAGE)
raise PrepareHookException(f"Error occurred when invoking a process:\n{e}") from e

Expand Down

0 comments on commit b297ff0

Please sign in to comment.