From dc8b24e35c034b949e18732eb995db5635ed14ea Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 21 May 2021 10:34:12 -0400 Subject: [PATCH] r/aws_amplify_app: Update documentation. --- website/docs/r/amplify_app.html.markdown | 131 ++++++++++++----------- 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/website/docs/r/amplify_app.html.markdown b/website/docs/r/amplify_app.html.markdown index 65f85c63bf8..d7e6b81fcce 100644 --- a/website/docs/r/amplify_app.html.markdown +++ b/website/docs/r/amplify_app.html.markdown @@ -15,8 +15,8 @@ Provides an Amplify App resource, a fullstack serverless app hosted on the [AWS ## Example Usage ```hcl -resource "aws_amplify_app" "app" { - name = "app" +resource "aws_amplify_app" "example" { + name = "example" repository = "https://github.com/example/app" # The default build_spec added by the Amplify Console for React. @@ -39,12 +39,16 @@ resource "aws_amplify_app" "app" { - node_modules/**/* EOT - # The default custom_rules added by the Amplify Console. - custom_rules { + # The default rewrites and redirects added by the Amplify Console. + custom_rule { source = "/<*>" status = "404" target = "/index.html" } + + environment_variables = { + ENV = "test" + } } ``` @@ -53,8 +57,8 @@ resource "aws_amplify_app" "app" { If you create a new Amplify App with the `repository` argument, you also need to set `oauth_token` or `access_token` for authentication. For GitHub, get a [personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) and set `access_token` as follows: ```hcl -resource "aws_amplify_app" "app" { - name = "app" +resource "aws_amplify_app" "example" { + name = "example" repository = "https://github.com/example/app" # GitHub personal access token @@ -67,19 +71,18 @@ You can omit `access_token` if you import an existing Amplify App created by the ### Auto Branch Creation ```hcl -resource "aws_amplify_app" "app" { - name = "app" +resource "aws_amplify_app" "example" { + name = "example" - auto_branch_creation_config { - # Enable auto branch creation. - enable_auto_branch_creation = true + enable_auto_branch_creation = true - # The default patterns added by the Amplify Console. - auto_branch_creation_patterns = [ - "*", - "*/**", - ] + # The default patterns added by the Amplify Console. + auto_branch_creation_patterns = [ + "*", + "*/**", + ] + auto_branch_creation_config { # Enable auto build for the created branch. enable_auto_build = true } @@ -89,28 +92,23 @@ resource "aws_amplify_app" "app" { ### Basic Authentication ```hcl -resource "aws_amplify_app" "app" { - name = "app" - - basic_auth_config { - # Enable basic authentication. - enable_basic_auth = true +resource "aws_amplify_app" "example" { + name = "example" - username = "username" - password = "password" - } + enable_basic_auth = true + basic_auth_credentials = base64encode("username1:password1") } ``` ### Rewrites and redirects ```hcl -resource "aws_amplify_app" "app" { - name = "app" +resource "aws_amplify_app" "example" { + name = "example" # Reverse Proxy Rewrite for API requests # https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#reverse-proxy-rewrite - custom_rules { + custom_rule { source = "/api/<*>" status = "200" target = "https://api.example.com/api/<*>" @@ -118,7 +116,7 @@ resource "aws_amplify_app" "app" { # Redirects for Single Page Web Apps (SPA) # https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#redirects-for-single-page-web-apps-spa - custom_rules { + custom_rule { source = "" status = "200" target = "/index.html" @@ -130,58 +128,63 @@ resource "aws_amplify_app" "app" { The following arguments are supported: -* `name` - (Required) Name of the Amplify App. - -* `access_token` - (Optional) Personal Access token for 3rd party source control system for an Amplify App, used to create webhook and read-only deploy key. Token is not stored. -* `auto_branch_creation_config` - (Optional) Automated branch creation config for the Amplify App. An `auto_branch_creation_config` block is documented below. -* `basic_auth_config` - (Optional) Basic Authentication config for the Amplify App. A `basic_auth_config` block is documented below. -* `build_spec` - (Optional) BuildSpec content for Amplify App. -* `custom_rules` - (Optional) Custom redirect / rewrite rules for the Amplify App. A `custom_rules` block is documented below. -* `description` - (Optional) Description for the Amplify App. +* `name` - (Required) The name for an Amplify app. +* `access_token` - (Optional) The personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored. +* `auto_branch_creation_config` - (Optional) The automated branch creation configuration for an Amplify app. An `auto_branch_creation_config` block is documented below. +* `auto_branch_creation_patterns` - (Optional) The automated branch creation glob patterns for an Amplify app. +* `basic_auth_credentials` - (Optional) The credentials for basic authorization for an Amplify app. +* `build_spec` - (Optional) The [build specification](https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html) (build spec) for an Amplify app. +* `custom_rule` - (Optional) The custom rewrite and redirect rules for an Amplify app. A `custom_rule` block is documented below. +* `description` - (Optional) The description for an Amplify app. +* `enable_auto_branch_creation` - (Optional) Enables automated branch creation for an Amplify app. +* `enable_basic_auth` - (Optional) Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app. * `enable_branch_auto_build` - (Optional) Enables auto-building of branches for the Amplify App. -* `environment_variables` - (Optional) Environment Variables for the Amplify App. -* `iam_service_role_arn` - (Optional) IAM service role ARN for the Amplify App. -* `oauth_token` - (Optional) OAuth token for 3rd party source control system for an Amplify App, used to create webhook and read-only deploy key. OAuth token is not stored. -* `platform` - (Optional) Platform for the Amplify App. -* `repository` - (Optional) Repository for the Amplify App. +* `enable_branch_auto_deletion` - (Optional) Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository. +* `environment_variables` - (Optional) The environment variables map for an Amplify app. +* `iam_service_role_arn` - (Optional) The AWS Identity and Access Management (IAM) service role for an Amplify app. +* `oauth_token` - (Optional) The OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored. +* `platform` - (Optional) The platform or framework for an Amplify app. Valid values: `WEB`. +* `repository` - (Optional) The repository for an Amplify app. * `tags` - (Optional) Key-value mapping of resource tags. If configured with a provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. An `auto_branch_creation_config` block supports the following arguments: -* `enable_auto_branch_creation` - (Optional) Enables automated branch creation for the Amplify App. -* `auto_branch_creation_patterns` - (Optional) Automated branch creation glob patterns for the Amplify App. -* `basic_auth_config` - (Optional) Basic Authentication config for the auto created branch. A `basic_auth_config` block is documented below. -* `build_spec` - (Optional) BuildSpec for the auto created branch. -* `enable_auto_build` - (Optional) Enables auto building for the auto created branch. -* `enable_basic_auth` - (Optional) Enables Basic Auth for the auto created branch. -* `enable_pull_request_preview` - (Optional) Enables Pull Request Preview for auto created branch. -* `environment_variables` - (Optional) Environment Variables for the auto created branch. -* `framework` - (Optional) Framework for the auto created branch. -* `pull_request_environment_name` - (Optional) The Amplify Environment name for the pull request. -* `stage` - (Optional) Stage for the branch. Possible values: "PRODUCTION", "BETA", "DEVELOPMENT", "EXPERIMENTAL", or "PULL_REQUEST". - -An `basic_auth_config` block supports the following arguments: - -* `enable_basic_auth` - (Optional) Enables Basic Authorization. -* `username` - (Optional) Basic Authorization username. -* `password` - (Optional) Basic Authorization password. +* `basic_auth_credentials` - (Optional) The basic authorization credentials for the autocreated branch. +* `build_spec` - (Optional) The build specification (build spec) for the autocreated branch. +* `enable_auto_build` - (Optional) Enables auto building for the autocreated branch. +* `enable_basic_auth` - (Optional) Enables basic authorization for the autocreated branch. +* `enable_performance_mode` - (Optional) Enables performance mode for the branch. +* `enable_pull_request_preview` - (Optional) Enables pull request previews for the autocreated branch. +* `environment_variables` - (Optional) The environment variables for the autocreated branch. +* `framework` - (Optional) The framework for the autocreated branch. +* `pull_request_environment_name` - (Optional) The Amplify environment name for the pull request. +* `stage` - (Optional) Describes the current stage for the autocreated branch. Valid values: `PRODUCTION`, `BETA`, `DEVELOPMENT`, `EXPERIMENTAL`, `PULL_REQUEST`. -A `custom_rules` block supports the following arguments: +A `custom_rule` block supports the following arguments: +* `condition` - (Optional) The condition for a URL rewrite or redirect rule, such as a country code. * `source` - (Required) The source pattern for a URL rewrite or redirect rule. +* `status` - (Optional) The status code for a URL rewrite or redirect rule. Valid values: `200`, `301`, `302`, `404`, `404-200`. * `target` - (Required) The target pattern for a URL rewrite or redirect rule. -* `condition` - (Optional) The condition for a URL rewrite or redirect rule, e.g. country code. -* `status` - (Optional) The status code for a URL rewrite or redirect rule. ## Attribute Reference The following attributes are exported: -* `arn` - ARN for the Amplify App. -* `default_domain` - Default domain for the Amplify App. +* `arn` - The Amazon Resource Name (ARN) of the Amplify app. +* `default_domain` - The default domain for the Amplify app. +* `id` - The unique ID of the Amplify app. +* `production_branch` - Describes the information about a production branch for an Amplify app. A `production_branch` block is documented below. * `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](/docs/providers/aws/index.html#default_tags-configuration-block). +A `production_branch` block supports the following attributes: + +* `branch_name` - The branch name for the production branch. +* `last_deploy_time` - The last deploy time of the production branch. +* `status` - The status of the production branch. +* `thumbnail_url` - The thumbnail URL for the production branch. + ## Import Amplify App can be imported using Amplify App ID (appId), e.g.