Skip to content

Commit

Permalink
Merge pull request #154 from allez-allez-allez/updates-repos-enabling
Browse files Browse the repository at this point in the history
Updates lx templates to allow enabling repos
  • Loading branch information
lorengordon authored Aug 23, 2019
2 parents 6603d04 + 823605c commit e3ab037
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.15.6
current_version = 1.15.7
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
7 changes: 4 additions & 3 deletions modules/lx-autoscale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DesiredCapacity = "${var.DesiredCapacity}"
EbsOptimized = "${var.EbsOptimized}"
EnableRepos = "${var.EnableRepos}"
InstanceRole = "${var.InstanceRole}"
InstanceTerminationPolicies = "${join(",", var.InstanceTerminationPolicies)}"
InstanceType = "${var.InstanceType}"
Expand Down Expand Up @@ -67,8 +68,8 @@ resource "aws_cloudformation_stack" "watchmaker-lx-autoscale" {
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
6 changes: 6 additions & 0 deletions modules/lx-autoscale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,9 @@ variable "EbsOptimized" {
description = "Specifies whether the launch configuration is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. Warning: Stack creation will fail if set to true and the instance type does not support EBS Optimization. See complete list of supported instances here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html#ebs-optimization-support"
default = "false"
}

variable "EnableRepos" {
type = "string"
description = "(Optional) Specify repos to be enabled by yum-config-manager"
default = ""
}
2 changes: 2 additions & 0 deletions modules/lx-autoscale/watchmaker-lx-autoscale.params.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
ParameterValue: __DESIREDCAPACITY__
- ParameterKey: EbsOptimized
ParameterValue: __EBSOPTIMIZED__
- ParameterKey: EnableRepos
ParameterValue: __ENABLEREPOS__
- ParameterKey: InstanceRole
ParameterValue: __INSTANCEROLE__
- ParameterKey: InstanceTerminationPolicies
Expand Down
19 changes: 18 additions & 1 deletion modules/lx-autoscale/watchmaker-lx-autoscale.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Conditions:
- !Equals
- !Ref PatchGroup
- ''
EnablingRepos: !Not
- !Equals
- !Ref EnableRepos
- ''
ExecuteAppScript: !Not
- !Equals
- !Ref AppScriptUrl
Expand Down Expand Up @@ -202,7 +206,7 @@ Metadata:
default: Force Cfn Init Update
ToggleNewInstances:
default: Force New Instances
Version: 1.15.6
Version: 1.15.7
Outputs:
ScaleDownScheduledAction:
Condition: UseScheduledAction
Expand Down Expand Up @@ -368,6 +372,10 @@ Parameters:
See complete list of supported instances here:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html#ebs-optimization-support
Type: String
EnableRepos:
Default: ''
Description: '(Optional) Specify repos to be enabled by yum-config-manager. Example: epel'
Type: String
InstanceRole:
Default: ''
Description: (Optional) IAM instance role to apply to the instance(s)
Expand Down Expand Up @@ -631,6 +639,10 @@ Resources:
- InstallCloudWatchAgent
- cw-agent-install
- !Ref 'AWS::NoValue'
- !If
- EnablingRepos
- enable-repos
- !Ref 'AWS::NoValue'
- watchmaker-install
- watchmaker-launch
- !If
Expand Down Expand Up @@ -784,6 +796,11 @@ Resources:
commands:
10-install-updates:
command: yum -y update
enable-repos:
commands:
10-enable-repos:
command:
!Sub 'yum-config-manager --enable ${EnableRepos}'
make-app:
commands:
05-get-appscript:
Expand Down
7 changes: 4 additions & 3 deletions modules/lx-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
CloudWatchAppLogs = "${join(",", var.CloudWatchAppLogs)}"
DisableApiTermination = "${var.DisableApiTermination}"
EbsOptimized = "${var.EbsOptimized}"
EnableRepos = "${var.EnableRepos}"
InstanceRole = "${var.InstanceRole}"
InstanceType = "${var.InstanceType}"
KeyPairName = "${var.KeyPairName}"
Expand All @@ -58,8 +59,8 @@ resource "aws_cloudformation_stack" "watchmaker-lx-instance" {
}

timeouts {
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
create = "${var.TimeoutInMinutes}m"
delete = "${var.TimeoutInMinutes}m"
update = "${var.TimeoutInMinutes}m"
}
}
6 changes: 6 additions & 0 deletions modules/lx-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,9 @@ variable "EbsOptimized" {
description = "Specifies whether the instance is optimized for Amazon Elastic Block Store I/O. See complete list of supported instances here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html#ebs-optimization-support"
default = "false"
}

variable "EnableRepos" {
type = "string"
description = "(Optional) Specify repos to be enabled by yum-config-manager"
default = ""
}
2 changes: 2 additions & 0 deletions modules/lx-instance/watchmaker-lx-instance.params.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
ParameterValue: __DISABLEAPITERMINATION__
- ParameterKey: EbsOptimized
ParameterValue: __EBSOPTIMIZED__
- ParameterKey: EnableRepos
ParameterValue: __ENABLEREPOS__
- ParameterKey: InstanceRole
ParameterValue: __INSTANCEROLE__
- ParameterKey: InstanceType
Expand Down
19 changes: 18 additions & 1 deletion modules/lx-instance/watchmaker-lx-instance.template.cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Conditions:
- !Equals
- !Ref PatchGroup
- ''
EnablingRepos: !Not
- !Equals
- !Ref EnableRepos
- ''
ExecuteAppScript: !Not
- !Equals
- !Ref AppScriptUrl
Expand Down Expand Up @@ -153,7 +157,7 @@ Metadata:
ParameterLabels:
ToggleCfnInitUpdate:
default: Force Cfn Init Update
Version: 1.15.6
Version: 1.15.7
Outputs:
WatchmakerInstanceId:
Description: Instance ID
Expand Down Expand Up @@ -288,6 +292,10 @@ Parameters:
See complete list of supported instances here:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html#ebs-optimization-support
Type: String
EnableRepos:
Default: ''
Description: '(Optional) Specify repos to be enabled by yum-config-manager. Example: epel'
Type: String
InstanceRole:
Default: ''
Description: (Optional) IAM instance role to apply to the instance
Expand Down Expand Up @@ -444,6 +452,10 @@ Resources:
- InstallCloudWatchAgent
- cw-agent-install
- !Ref 'AWS::NoValue'
- !If
- EnablingRepos
- enable-repos
- !Ref 'AWS::NoValue'
- watchmaker-install
- watchmaker-launch
- !If
Expand Down Expand Up @@ -597,6 +609,11 @@ Resources:
commands:
10-install-updates:
command: yum -y update
enable-repos:
commands:
10-enable-repos:
command:
!Sub 'yum-config-manager --enable ${EnableRepos}'
make-app:
commands:
05-get-appscript:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Metadata:
default: Force Cfn Init Update
ToggleNewInstances:
default: Force New Instances
Version: 1.15.6
Version: 1.15.7
Outputs:
ScaleDownScheduledAction:
Condition: UseScheduledAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Metadata:
ParameterLabels:
ToggleCfnInitUpdate:
default: Force Cfn Init Update
Version: 1.15.6
Version: 1.15.7
Outputs:
WatchmakerInstanceId:
Description: Instance ID
Expand Down
4 changes: 4 additions & 0 deletions tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "lx-instance-centos6" {
SubnetId = "${var.subnet_id}"
WatchmakerConfig = "${var.watchmaker_config}"
WatchmakerEnvironment = "${var.watchmaker_env}"
EnableRepos = "epel"
}

module "lx-instance-centos7" {
Expand All @@ -39,6 +40,7 @@ module "lx-instance-centos7" {
SubnetId = "${var.subnet_id}"
WatchmakerConfig = "${var.watchmaker_config}"
WatchmakerEnvironment = "${var.watchmaker_env}"
EnableRepos = "epel"
}

module "lx-autoscale-centos6" {
Expand All @@ -61,6 +63,7 @@ module "lx-autoscale-centos6" {
SubnetIds = "${var.subnet_id}"
WatchmakerConfig = "${var.watchmaker_config}"
WatchmakerEnvironment = "${var.watchmaker_env}"
EnableRepos = "epel"
}

module "lx-autoscale-centos7" {
Expand All @@ -84,6 +87,7 @@ module "lx-autoscale-centos7" {
SubnetIds = "${var.subnet_id}"
WatchmakerConfig = "${var.watchmaker_config}"
WatchmakerEnvironment = "${var.watchmaker_env}"
EnableRepos = "epel"
}

module "win-instance-2008R2" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,9 @@ variable "ToggleCfnInitUpdate" {
description = "A/B toggle that forces a change to instance metadata, triggering the cfn-init update sequence"
default = "A"
}

variable "EnableRepos" {
type = "string"
description = "(Optional) Specify repos to be enabled by yum-config-manager"
default = ""
}

0 comments on commit e3ab037

Please sign in to comment.