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(ec2): add options for Cfn init proxies #19480

Closed
wants to merge 15 commits into from
Closed
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
35 changes: 27 additions & 8 deletions packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export abstract class Signals {
protected doRender(options: SignalsOptions, count?: number): CfnCreationPolicy {
const minSuccessfulInstancesPercent = validatePercentage(options.minSuccessPercentage);
return {
...options.minSuccessPercentage !== undefined ? { autoScalingCreationPolicy: { minSuccessfulInstancesPercent } } : { },
...options.minSuccessPercentage !== undefined ? { autoScalingCreationPolicy: { minSuccessfulInstancesPercent } } : {},
resourceSignal: {
count,
timeout: options.timeout?.toIsoString(),
Expand Down Expand Up @@ -1085,7 +1085,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements

this.autoScalingGroup = new CfnAutoScalingGroup(this, 'ASG', asgProps);
this.osType = imageConfig.osType;
this.autoScalingGroupName = this.getResourceNameAttribute(this.autoScalingGroup.ref),
this.autoScalingGroupName = this.getResourceNameAttribute(this.autoScalingGroup.ref);
this.autoScalingGroupArn = Stack.of(this).formatArn({
service: 'autoscaling',
resource: 'autoScalingGroup:*:autoScalingGroupName',
Expand Down Expand Up @@ -1185,6 +1185,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
ignoreFailures: options.ignoreFailures,
includeRole: options.includeRole,
includeUrl: options.includeUrl,
httpProxy: options.httpProxy,
httpsProxy: options.httpsProxy,
});
}

Expand Down Expand Up @@ -1837,11 +1839,28 @@ export interface ApplyCloudFormationInitOptions {
readonly includeUrl?: boolean;

/**
* Include --role argument when running cfn-init and cfn-signal commands
*
* This will be the IAM instance profile attached to the EC2 instance
*
* @default false
*/
* Include --role argument when running cfn-init and cfn-signal commands
*
* This will be the IAM instance profile attached to the EC2 instance
*
* @default false
*/
readonly includeRole?: boolean;
/**
* Include --http-proxy argument when running cfn-init and cfn-signal commands
*
* An HTTP proxy (non-SSL). Use the following format: http://user:password@host:port
*
* @default
*/
readonly httpProxy?: string;

/**
* Include --https-proxy argument when running cfn-init and cfn-signal commands
*
* An HTTPS proxy. Use the following format: https://user:password@host:port
*
* @default
*/
readonly httpsProxy?: string;
Copy link
Contributor

@LukvonStrom LukvonStrom Apr 23, 2022

Choose a reason for hiding this comment

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

as these are secrets, I would like to propose an alternative way:
An interface like this:

enum ProxyProtocol {
HTTP= "http",
HTTPS = "https",
}

interface IProxyConfig {
protocol: ProxyProtocol,
user?: string,
password?: ISecret,
host: string,
port?: number
}


// [...]

readonly proxy?: IProxyConfig;

take only one argument called proxy here and decide wether -http-proxy or -https-proxy is appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finally getting back to this. Currently figuring out how to deal with circular dependencies between packages.

aws-secretsmanager has a dependency on the aws-ec2 package, causing issues when doing a yarn build within the aws-ec2 package after adding secrets manager.

Trying to figure out how to handle this if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Articulated this in #19479

}
Loading