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

feat(init-templates): app template comes with hint comments for 'env' #13696

Merged
merged 4 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,35 @@ sealed class Program
public static void Main(string[] args)
{
var app = new App();
new %name.PascalCased%Stack(app, "%name.PascalCased%Stack");
new %name.PascalCased%Stack(app, "%name.PascalCased%Stack", new StackProps
{
// If you don't specify 'env', this stack will be environment-agnostic.
// Account/Region-dependent features and context lookups will not work,
// but a single synthesized template can be deployed anywhere.

// Uncomment the next block to specialize this stack for the AWS Account
// and Region that are implied by the current CLI configuration.
/*
Env = new Amazon.CDK.Environment
{
Account = System.Environment.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
Region = System.Environment.GetEnvironmentVariable("CDK_DEFAULT_REGION"),
}
*/

// Uncomment the next block if you know exactly what Account and Region you
// want to deploy the stack to.
/*
Env = new Amazon.CDK.Environment
{
Account = "123456789012",
Region = "us-east-1",
}
*/

// For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
});

app.Synth();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
package com.myorg;

import software.amazon.awscdk.core.App;
import software.amazon.awscdk.core.Environment;

import java.util.Arrays;

public class %name.PascalCased%App {
public static void main(final String[] args) {
App app = new App();

new %name.PascalCased%Stack(app, "%name.PascalCased%Stack");
%name.PascalCased%Stack.Builder.create(app, "%name.PascalCased%Stack")
// If you don't specify 'env', this stack will be environment-agnostic.
// Account/Region-dependent features and context lookups will not work,
// but a single synthesized template can be deployed anywhere.

// Uncomment the next block to specialize this stack for the AWS Account
// and Region that are implied by the current CLI configuration.
/*
.env(Environment.builder()
.account(System.getenv("CDK_DEFAULT_ACCOUNT"))
.region(System.getenv("CDK_DEFAULT_REGION"))
.build())
*/

// Uncomment the next block if you know exactly what Account and Region you
// want to deploy the stack to.
/*
.env(Environment.builder()
.account("123456789012")
.region("us-east-1")
.build())
*/

// For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
.build();

app.synth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ const cdk = require('@aws-cdk/core');
const { %name.PascalCased%Stack } = require('../lib/%name%-stack');

const app = new cdk.App();
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */

/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import os

from aws_cdk import core as cdk

Expand All @@ -12,6 +13,22 @@


app = core.App()
%name.PascalCased%Stack(app, "%name.PascalCased%Stack")
%name.PascalCased%Stack(app, "%name.PascalCased%Stack",
# If you don't specify 'env', this stack will be environment-agnostic.
# Account/Region-dependent features and context lookups will not work,
# but a single synthesized template can be deployed anywhere.

# Uncomment the next line to specialize this stack for the AWS Account
# and Region that are implied by the current CLI configuration.

#env=core.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),

# Uncomment the next line if you know exactly what Account and Region you
# want to deploy the stack to. */

#env=core.Environment(account='123456789012', region='us-east-1'),

# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
)

app.synth()
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ import * as cdk from '@aws-cdk/core';
import { %name.PascalCased%Stack } from '../lib/%name%-stack';

const app = new cdk.App();
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other languages? v2 templates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not merging yet -- would like to get some agreement on verbiage before I apply the same to all templates.

* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* but a single synthesized template can be deployed anywhere. */
* but a single synthesized template can be deployed anywhere.
* See https://docs.aws.amazon.com/cdk/latest/guide/stacks.html to
* learn more about environment agnostic stacks.
* See https://docs.aws.amazon.com/cdk/latest/guide/context.html to
* learn more about runtime contexts. */


/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,34 @@ sealed class Program
public static void Main(string[] args)
{
var app = new App();
new %name.PascalCased%Stack(app, "%name.PascalCased%Stack");
new %name.PascalCased%Stack(app, "%name.PascalCased%Stack", new StackProps
{
// If you don't specify 'env', this stack will be environment-agnostic.
// Account/Region-dependent features and context lookups will not work,
// but a single synthesized template can be deployed anywhere.

// Uncomment the next block to specialize this stack for the AWS Account
// and Region that are implied by the current CLI configuration.
/*
Env = new Amazon.CDK.Environment
{
Account = System.Environment.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
Region = System.Environment.GetEnvironmentVariable("CDK_DEFAULT_REGION"),
}
*/

// Uncomment the next block if you know exactly what Account and Region you
// want to deploy the stack to.
/*
Env = new Amazon.CDK.Environment
{
Account = "123456789012",
Region = "us-east-1",
}
*/

// For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
});
app.Synth();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
package com.myorg;

import software.amazon.awscdk.lib.App;
import software.amazon.awscdk.lib.Environment;

import java.util.Arrays;

public class %name.PascalCased%App {
public static void main(final String[] args) {
App app = new App();

new %name.PascalCased%Stack(app, "%name.PascalCased%Stack");
%name.PascalCased%Stack.Builder.create(app, "%name.PascalCased%Stack")
// If you don't specify 'env', this stack will be environment-agnostic.
// Account/Region-dependent features and context lookups will not work,
// but a single synthesized template can be deployed anywhere.

// Uncomment the next block to specialize this stack for the AWS Account
// and Region that are implied by the current CLI configuration.
/*
.env(Environment.builder()
.account(System.getenv("CDK_DEFAULT_ACCOUNT"))
.region(System.getenv("CDK_DEFAULT_REGION"))
.build())
*/

// Uncomment the next block if you know exactly what Account and Region you
// want to deploy the stack to.
/*
.env(Environment.builder()
.account("123456789012")
.region("us-east-1")
.build())
*/

// For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
.build();

app.synth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ const cdk = require('aws-cdk-lib');
const { %name.PascalCased%Stack } = require('../lib/%name%-stack');

const app = new cdk.App();
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */

/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/usr/bin/env python3
import os

import aws_cdk_lib as core

from %name.PythonModule%.%name.PythonModule%_stack import %name.PascalCased%Stack


app = core.App()
%name.PascalCased%Stack(app, "%name.PascalCased%Stack")
%name.PascalCased%Stack(app, "%name.PascalCased%Stack",
# If you don't specify 'env', this stack will be environment-agnostic.
# Account/Region-dependent features and context lookups will not work,
# but a single synthesized template can be deployed anywhere.

# Uncomment the next line to specialize this stack for the AWS Account
# and Region that are implied by the current CLI configuration.

#env=core.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),

# Uncomment the next line if you know exactly what Account and Region you
# want to deploy the stack to. */

#env=core.Environment(account='123456789012', region='us-east-1'),

# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
)

app.synth()
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,18 @@ import * as cdk from 'aws-cdk-lib';
import { %name.PascalCased%Stack } from '../lib/%name%-stack';

const app = new cdk.App();
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack');
new %name.PascalCased%Stack(app, '%name.PascalCased%Stack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */

/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});