Skip to content

Commit

Permalink
Added README content
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Hawkins committed Mar 16, 2024
1 parent 6602567 commit f54f958
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 3 deletions.
84 changes: 82 additions & 2 deletions packages/aws-cdk-lib/aws-appconfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', {
});
```

The `deployTo` parameter is used to specify which environments to deploy the configuration to. If this parameter is not
specified, there will not be a deployment.
The `deployTo` parameter is used to specify which environments to deploy the configuration to.

A hosted configuration with `deployTo`:

Expand All @@ -268,6 +267,87 @@ new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', {
});
```

When more than one configuration is set to deploy to the same environment, the
deployments will occur one at a time. This is done to satisfy
[AppConfig's constraint:](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-deploying.html)
> [!NOTE]
> You can only deploy one configuration at a time to an environment.
> However, you can deploy one configuration each to different environments at the same time.
The deployment order matches the order in which the configurations are declared.

```ts
const app = new appconfig.Application(this, 'MyApp');
const env = new appconfig.Environment(this, 'MyEnv', {
application: app,
});

new appconfig.HostedConfiguration(this, 'MyFirstHostedConfig', {
application: app,
deployTo: [env],
content: appconfig.ConfigurationContent.fromInlineText('This is my first configuration content.'),
});

new appconfig.HostedConfiguration(this, 'MySecondHostedConfig', {
application: app,
deployTo: [env],
content: appconfig.ConfigurationContent.fromInlineText('This is my second configuration content.'),
});
```

If an application would benefit from a deployment order that differs from the
declared order, you can defer the decision by using `IEnvironment.addDeployment`
rather than the `deployTo` property.

```ts
const app = new appconfig.Application(this, 'MyApp');
const env = new appconfig.Environment(this, 'MyEnv', {
application: app,
});

const secondConfig = new appconfig.HostedConfiguration(this, 'MySecondHostedConfig', {
application: app,
content: appconfig.ConfigurationContent.fromInlineText('This is my second configuration content.'),
});

const firstConfig = new appconfig.HostedConfiguration(this, 'MyFirstHostedConfig', {
application: app,
deployTo: [env],
content: appconfig.ConfigurationContent.fromInlineText('This is my first configuration content.'),
});

env.addDeployment(secondConfig);
```

Alternatively, you can defer multiple deployments in favor of
`IEnvironment.addDeployments`, which allows you to declare multiple
configurations in the order they will be deployed.

```ts
const app = new appconfig.Application(this, 'MyApp');
const env = new appconfig.Environment(this, 'MyEnv', {
application: app,
});

const secondConfig = new appconfig.HostedConfiguration(this, 'MySecondHostedConfig', {
application: app,
content: appconfig.ConfigurationContent.fromInlineText('This is my second configuration content.'),
});

const firstConfig = new appconfig.HostedConfiguration(this, 'MyFirstHostedConfig', {
application: app,
content: appconfig.ConfigurationContent.fromInlineText('This is my first configuration content.'),
});

env.addDeployments(firstConfig, secondConfig);
```

Any mix of `deployTo`, `addDeployment`, and `addDeployments` is permitted.
The declaration order will be respected regardless of the approach used.

> [!IMPORTANT]
> If none of these options are utilized, there will not be any deployments.
### SourcedConfiguration

A sourced configuration represents configuration stored in any of the following:
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export interface ConfigurationOptions {
* The list of environments to deploy the configuration to.
*
* If this parameter is not specified, then there will be no
* deployment.
* deployment created alongside this configuration.
*
* A deployment can be added later via IEnvironment.
*
* @default - None.
*/
Expand Down

0 comments on commit f54f958

Please sign in to comment.