Giter Club home page Giter Club logo

terraform-aws-autoscaling's People

Contributors

acsrujan avatar antonbabenko avatar awolski avatar betajobot avatar bryantbiggs avatar cageyv avatar cedarkuo avatar dev-slatto avatar dhoppe avatar dinesh-auti avatar fearthebadger avatar gabrielsoltz avatar gasoid avatar grimm26 avatar jherediacmp avatar m42u avatar magreenbaum avatar mbaquer6 avatar nitrocode avatar nubbthedestroyer avatar satish4584 avatar sc250024 avatar schniber avatar semantic-release-bot avatar sirhazi avatar sudokamikaze avatar vucong2409 avatar wincus avatar zahorniak avatar zwick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-aws-autoscaling's Issues

Destroy ASG when LC is updated in-place

One nice "trick" is the fact that once you update the LC, you can trigger a creation of a new ASG. This is done by append to the ASG name the reference to the LC. A discussion about this is here. However with the following module if we decide to create both ASG and LC, this couldn't be achieved. There is any reason behind this choice in the design?

Provided Load Balancers may not be valid

using alb module 2.1.0 & autoscaling module 2.4.0 I am unable to pass a valid value for the input into the asg module. does the asg module accept the alb using the AWS elbv2 api? or only elb?

load_balancers = ["${module.alb_sync.alb_id}"]

I have also tried to pass in just the name as a string

load_balancers = ["sync-alb"]

module.asg_chs.aws_autoscaling_group.this: Modifying... (ID: chs-asg-20180213075027586600000001)
  load_balancers.#:          "0" => "1"
  load_balancers.1915215376: "" => "arn:aws:elasticloadbalancing:us-east-1:483669448754:loadbalancer/app/sync-alb"
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:32 [DEBUG] AutoScaling Group update configuration: {
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   AutoScalingGroupName: "chs-asg-20180213075027586600000001",
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   NewInstancesProtectedFromScaleIn: false
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: }
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:32 [DEBUG] [aws-sdk-go] DEBUG: Request autoscaling/UpdateAutoScalingGroup Details:
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: ---[ REQUEST POST-SIGN ]-----------------------------
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: POST / HTTP/1.1
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Host: autoscaling.us-east-1.amazonaws.com
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: User-Agent: aws-sdk-go/1.12.73 (go1.9.2; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.3
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Length: 143
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Authorization: AWS4-HMAC-SHA256 Credential=AKIAIYJKVMQHT2G4VXLQ/20180213/us-east-1/autoscaling/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=d85b21b6c150999c69693d63a96ea07eca8aca7bea3f5ef4eaefb9bf508a6735
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Type: application/x-www-form-urlencoded; charset=utf-8
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: X-Amz-Date: 20180213T174932Z
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Accept-Encoding: gzip
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Action=UpdateAutoScalingGroup&AutoScalingGroupName=chs-asg-20180213075027586600000001&NewInstancesProtectedFromScaleIn=false&Version=2011-01-01
2018-02-13T09:49:32.244-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: -----------------------------------------------------
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:32 [DEBUG] [aws-sdk-go] DEBUG: Response autoscaling/UpdateAutoScalingGroup Details:
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: ---[ RESPONSE ]--------------------------------------
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: HTTP/1.1 200 OK
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Connection: close
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Length: 231
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Type: text/xml
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Date: Tue, 13 Feb 2018 17:49:33 GMT
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: X-Amzn-Requestid: 3fee3b62-10e6-11e8-a7a9-41bc5703dc2b
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: -----------------------------------------------------
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:32 [DEBUG] [aws-sdk-go] <UpdateAutoScalingGroupResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   <ResponseMetadata>
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:     <RequestId>3fee3b62-10e6-11e8-a7a9-41bc5703dc2b</RequestId>
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   </ResponseMetadata>
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: </UpdateAutoScalingGroupResponse>
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:32 [DEBUG] [aws-sdk-go] DEBUG: Request autoscaling/AttachLoadBalancers Details:
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: ---[ REQUEST POST-SIGN ]-----------------------------
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: POST / HTTP/1.1
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Host: autoscaling.us-east-1.amazonaws.com
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: User-Agent: aws-sdk-go/1.12.73 (go1.9.2; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.3
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Length: 220
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Authorization: AWS4-HMAC-SHA256 Credential=AKIAIYJKVMQHT2G4VXLQ/20180213/us-east-1/autoscaling/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=60700bf4d985fbb838d80a467930df2e03df0713c42ade3bbd7b8e75f6e142fa
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Type: application/x-www-form-urlencoded; charset=utf-8
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: X-Amz-Date: 20180213T174932Z
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Accept-Encoding: gzip
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Action=AttachLoadBalancers&AutoScalingGroupName=chs-asg-20180213075027586600000001&LoadBalancerNames.member.1=arn%3Aaws%3Aelasticloadbalancing%3Aus-east-1%3A483669448754%3Aloadbalancer%2Fapp%2Fsync-alb&Version=2011-01-01
2018-02-13T09:49:32.785-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: -----------------------------------------------------
2018-02-13T09:49:33.320-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:33 [DEBUG] [aws-sdk-go] DEBUG: Response autoscaling/AttachLoadBalancers Details:
2018-02-13T09:49:33.320-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: ---[ RESPONSE ]--------------------------------------
2018-02-13T09:49:33.320-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: HTTP/1.1 400 Bad Request
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Connection: close
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Length: 335
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Content-Type: text/xml
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: Date: Tue, 13 Feb 2018 17:49:33 GMT
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: X-Amzn-Requestid: 403f1afa-10e6-11e8-98c5-bb0269111441
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: -----------------------------------------------------
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:33 [DEBUG] [aws-sdk-go] <ErrorResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   <Error>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:     <Type>Sender</Type>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:     <Code>ValidationError</Code>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:     <Message>Provided Load Balancers may not be valid. Please ensure they exist and try again.</Message>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   </Error>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4:   <RequestId>403f1afa-10e6-11e8-98c5-bb0269111441</RequestId>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: </ErrorResponse>
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 2018/02/13 09:49:33 [DEBUG] [aws-sdk-go] DEBUG: Validate Response autoscaling/AttachLoadBalancers failed, not retrying, error ValidationError: Provided Load Balancers may not be valid. Please ensure they exist and try again.
2018-02-13T09:49:33.321-0800 [DEBUG] plugin.terraform-provider-aws_v1.9.0_x4: 	status code: 400, request id: 403f1afa-10e6-11e8-98c5-bb0269111441
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalWriteState
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalApplyProvisioners
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalIf
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalWriteState
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalWriteDiff
2018/02/13 09:49:33 [TRACE] root.asg_chs: eval: *terraform.EvalApplyPost
2018/02/13 09:49:33 [ERROR] root.asg_chs: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* aws_autoscaling_group.this: [WARN] Error updating Load Balancers for AutoScaling Group (chs-asg-20180213075027586600000001), error: ValidationError: Provided Load Balancers may not be valid. Please ensure they exist and try again.
	status code: 400, request id: 403f1afa-10e6-11e8-98c5-bb0269111441
2018/02/13 09:49:33 [ERROR] root.asg_chs: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* aws_autoscaling_group.this: [WARN] Error updating Load Balancers for AutoScaling Group (chs-asg-20180213075027586600000001), error: ValidationError: Provided Load Balancers may not be valid. Please ensure they exist and try again.
	status code: 400, request id: 403f1afa-10e6-11e8-98c5-bb0269111441
2018/02/13 09:49:33 [TRACE] [walkApply] Exiting eval tree: module.asg_chs.aws_autoscaling_group.this
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_id"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_name"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_health_check_type"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_default_cooldown"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_min_size"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "provider.aws (close)"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_desired_capacity"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_arn"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_max_size"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "module.asg_chs.output.this_autoscaling_group_health_check_grace_period"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2018/02/13 09:49:33 [TRACE] dag/walk: upstream errored, not walking "root"
2018/02/13 09:49:33 [TRACE] Preserving existing state lineage "2f868038-ff15-4192-bbc5-e2d6884c38e2"
2018/02/13 09:49:33 [TRACE] Preserving existing state lineage "2f868038-ff15-4192-bbc5-e2d6884c38e2"
2018/02/13 09:49:33 [TRACE] Preserving existing state lineage "2f868038-ff15-4192-bbc5-e2d6884c38e2"
2018/02/13 09:49:33 [TRACE] Preserving existing state lineage "2f868038-ff15-4192-bbc5-e2d6884c38e2"
2018/02/13 09:49:33 [DEBUG] plugin: waiting for all plugin processes to complete...

Error: Error applying plan:

1 error(s) occurred:

* module.asg_chs.aws_autoscaling_group.this: 1 error(s) occurred:

* aws_autoscaling_group.this: [WARN] Error updating Load Balancers for AutoScaling Group (chs-asg-20180213075027586600000001), error: ValidationError: Provided Load Balancers may not be valid. Please ensure they exist and try again.
	status code: 400, request id: 403f1afa-10e6-11e8-98c5-bb0269111441

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


2018-02-13T09:49:33.343-0800 [DEBUG] plugin: plugin process exited: path=/Users/rmicone/Dev/sync-chef-data/provisioning/stg/.terraform/plugins/darwin_amd64/terraform-provider-template_v1.0.0_x4
2018-02-13T09:49:33.344-0800 [DEBUG] plugin: plugin process exited: path=/Users/rmicone/Dev/sync-chef-data/provisioning/stg/.terraform/plugins/darwin_amd64/terraform-provider-aws_v1.9.0_x4

Name tag keeps being updated on every terraform run

On each terraform plan/apply a change to ASG tags is picked up even though no changes were made in the code:

Terraform will perform the following actions:

  # module.this.aws_autoscaling_group.this[0] will be updated in-place
...
      ~ tags                      = [
          + {
              + "key"                 = "Name"
              + "propagate_at_launch" = "true"
              + "value"               = "xxx"
            },
            {
                "key"                 = "Environment"
                "propagate_at_launch" = "true"
                "value"               = "Development"
            },
            {
                "key"                 = "Managed"
                "propagate_at_launch" = "true"
                "value"               = "Terraform"
            },
          - {
              - "key"                 = "Name"
              - "propagate_at_launch" = "true"
              - "value"               = "xxx"
            },
            {
                "key"                 = "Region"
                "propagate_at_launch" = "true"
                "value"               = "London"
            },
        ]
...
Plan: 0 to add, 1 to change, 0 to destroy.

Please note, we only defined 3 tags, the Name one seems to be added automatically:

  tags_as_map = {
    Environment = "Development"
    Region      = "London"
    Managed     = "Terraform"
  }

Same thing happens if tags is used instead of tags_as_map.

Key_name parameter is not working as expected in launch configuration

I have build a Auto scaling group using this module. The problem is I am not able to login to the instance with the key_name mentioned in the launch configuration. In order to check keys I build an instance manually and I am able to login it using the same key name.

Please suggest what might me the issue..

C:\CMG\terraform_0.11.6_windows_amd64\vpc> terraform apply "./security-group\DevMgmt\terraform-devmgmt-sg.tfplan"
data.aws_security_group.devmgmt-bastion-public-sg: Refreshing state...
data.aws_security_group.devmgmt-proxy-public-sg: Refreshing state...
data.aws_security_group.devmgmt-alb-public-sg: Refreshing state...
data.aws_security_group.devmgmt-vpn-public-sg: Refreshing state...
module.autoscaling-bastion.aws_launch_configuration.this: Creating...
associate_public_ip_address: "" => "false"
ebs_block_device.#: "" => "1"
ebs_block_device.1324366927.delete_on_termination: "" => "true"
ebs_block_device.1324366927.device_name: "" => "/dev/xvdz"
ebs_block_device.1324366927.encrypted: "" => ""
ebs_block_device.1324366927.iops: "" => ""
ebs_block_device.1324366927.no_device: "" => ""
ebs_block_device.1324366927.snapshot_id: "" => ""
ebs_block_device.1324366927.volume_size: "" => "50"
ebs_block_device.1324366927.volume_type: "" => "gp2"
ebs_optimized: "" => "false"
enable_monitoring: "" => "true"
image_id: "" => "ami-c12dcda6"
instance_type: "" => "t2.micro"
key_name: "" => "MgmtKeyPair"
name: "" => ""
name_prefix: "" => "devmgmt-bastion-lc-"
placement_tenancy: "" => "default"
root_block_device.#: "" => "1"
root_block_device.0.delete_on_termination: "" => "true"
root_block_device.0.iops: "" => ""
root_block_device.0.volume_size: "" => "50"
root_block_device.0.volume_type: "" => "gp2"
security_groups.#: "" => "1"
security_groups.10987309: "" => "sg-07b8ae60d47656437"
user_data: "" => "b858cb282617fb0956d960215c8e84d1ccf909c6"
module.autoscaling-bastion.aws_launch_configuration.this: Creation complete after 1s (ID: devmgmt-bastion-lc-20180425145005923400000001)
module.autoscaling-bastion.aws_autoscaling_group.this: Modifying... (ID: devmgmt-bastion-asg-20180425134502895800000002)
launch_configuration: "devmgmt-bastion-lc-20180425143904380000000001" => "devmgmt-bastion-lc-20180425145005923400000001"
module.autoscaling-bastion.aws_autoscaling_group.this: Modifications complete after 0s (ID: devmgmt-bastion-asg-20180425134502895800000002)
module.autoscaling-bastion.aws_launch_configuration.this.deposed: Destroying... (ID: devmgmt-bastion-lc-20180425143904380000000001)
module.autoscaling-bastion.aws_launch_configuration.this.deposed: Destruction complete after 0s

Apply complete! Resources: 1 added, 1 changed, 1 destroyed.

Outputs:

devmgmt-vpn-public-sg = devmgmt-vpn-public-sg

Passing launch_configuration replies with Cannot fetch root device name for blank AMI ID

Hey,

I've set the following
launch_configuration = "my-existing-lc" (which was successfully created with a aws_launch_configuration resource)

And during terraform apply got the following:
aws_launch_configuration.this: Cannot fetch root device name for blank AMI ID.

I've added the image_id as a variable from the launch configurations, and then got the following:
aws_launch_configuration.this: Error creating launch configuration: InvalidParameter: 1 validation error(s) found.

  • minimum field size of 1, CreateLaunchConfigurationInput.InstanceType

I've passed the instance_type and so on.. until an entirely new one was created by the module, ending up it not using the already created one.

It looks like the launch_configuration is just being ignored.

Lifecycle hooks

Hi,
Firstly great module. I was just wondering if there would be any appetite to introduce the following terraform resource "aws_autoscaling_lifecycle_hook" into this module? If so I'll look to create a PR.

Cheers

Rob.

Terraform init throw: Unknown token: 2:21 IDENT null_resource.tags_as_list_of_maps

Terraform v0.11.13
Operating system OS X
Module Version 2.11.0

While doing terraform init, module download fails with the following error, we came across this error on a new clone of our terraform repo, we were running version 2.3.0 previously, trying to upgrade to 2.11.0 did not fix the problem.

Error downloading modules: Error loading modules: module autoscaling: Error parsing .terraform/modules/20205285a4a6ca42f94aa4bc1f64585e/locals.tf: At 2:21: Unknown token: 2:21 IDENT null_resource.tags_as_list_of_maps.

Changes in aws_alb_target_group group cause asg replacement

When creating a target group for an application load balancer, the property target_group_arns of the aws_autoscaling_group changes. This forces a replacement the next time terraform apply is ran. On this next apply because of the asg replacement, the old aws_alb_target_group is pointing to a null resource and it stops from routing traffic properly. Another terraform apply creates a new aws_autoscaling_attachment which allows traffic to be routed, again, but it also changes the property of target_group_arns on the aws_autoscaling_group... thus starting the cycle all over again.

I've overcome this by adding an ignore lifestyle changes to target)_group_arns like:

lifecycle {
    create_before_destroy = true
    ignore_changes = [target_group_arns]
  }

...but, I'd like to know if anyone has any better ideas that don't require me to fork the repo (since you can't pass lifecycle blocks in Terraform).

Support aws ALB

Hello

Currently, I see this module only support ELB so could we add feature support ALB

Thanks

create_lc=false causes errors asking for launch configuration arguments

Expected

create_lc=false will not cause the error as those arguments are defined in the LC.

Error: module "asg_public": missing required argument "image_id"
Error: module "asg_public": missing required argument "instance_type"
Error: module "asg_public": missing required argument "security_groups"

Breaks with 1.14 AWS provider if no user data is specified (2.2.1)

If user_data is not provided to the module, terraform will fail with the following error message

Error: module.autoscaling.aws_launch_configuration.this: expected length of user_data to be in the range (1 - 16384), got ```

Same terraform script verified working on 1.13

Error: Unsupported argument

Is this working with Terraform 0.12 ?

I'm getting the following errors:

Error: Incorrect attribute value type

  on .terraform/modules/bastion/terraform-aws-modules-terraform-aws-autoscaling-c5355e1/main.tf line 12, in resource "aws_launch_configuration" "this":
  12:   security_groups             = ["${var.security_groups}"]

Inappropriate value for attribute "security_groups": element 0: string
required.


Error: Unsupported argument

  on .terraform/modules/bastion/terraform-aws-modules-terraform-aws-autoscaling-c5355e1/main.tf line 19, in resource "aws_launch_configuration" "this":
  19:   ebs_block_device            = "${var.ebs_block_device}"

An argument named "ebs_block_device" is not expected here. Did you mean to
define a block of type "ebs_block_device"?


Error: Unsupported argument

  on .terraform/modules/bastion/terraform-aws-modules-terraform-aws-autoscaling-c5355e1/main.tf line 20, in resource "aws_launch_configuration" "this":
  20:   ephemeral_block_device      = "${var.ephemeral_block_device}"

An argument named "ephemeral_block_device" is not expected here. Did you mean
to define a block of type "ephemeral_block_device"?


Error: Unsupported argument

  on .terraform/modules/bastion/terraform-aws-modules-terraform-aws-autoscaling-c5355e1/main.tf line 21, in resource "aws_launch_configuration" "this":
  21:   root_block_device           = "${var.root_block_device}"

An argument named "root_block_device" is not expected here. Did you mean to
define a block of type "root_block_device"?

Terraform v0.12.0

  • provider.aws v2.12.0
  • provider.null v2.1.2
  • provider.random v2.1.2

Cycle errors on changing recreate_asg_when_lc_changes flag

Changing value of recreate_asg_when_lc_changes from true to false results into cycle errors between aws_autoscaling_group and random_pet resource. Can count be removed from the random_pet resource, that resolves the dependency issues

root_block_device is not expected here

Please see my report located: hashicorp/terraform-provider-aws#8855

I believe that issue is causing this issue.

Error: Unsupported argument

  on .terraform/modules/webserver_asg/terraform-aws-modules-terraform-aws-autoscaling-c5355e1/main.tf line 21, in resource "aws_launch_configuration" "this":
  21:   root_block_device           = "${var.root_block_device}"

An argument named "root_block_device" is not expected here. Did you mean to
define a block of type "root_block_device"?

This is a rough example of webserver-asg.tf:

module "webserver_asg" {
  source  = "terraform-aws-modules/autoscaling/aws"
  version = "2.9.1"

  name = "asg-${lower(var.PROJECT_NAME)}-${lower(var.ENVIRONMENT)}"

  # Launch configuration
  lc_name = "${lower(var.PROJECT_NAME)}-${upper(var.ENVIRONMENT)}"

  image_id        = "${var.AMI_ID}"
  instance_type   = "${var.EC2_INSTANCE_SIZE}"
  
 # Breaks no matter what, even commenting this out breaks ASG!
  root_block_device = [
    {
      volume_size           = "${var.EC2_ROOT_VOLUME_SIZE}"
      volume_type           = "${var.EC2_ROOT_VOLUME_TYPE}"
      delete_on_termination = "${var.EC2_ROOT_VOLUME_DELETE_ON_TERMINATION}"
    }
  ]

  # Auto scaling group
  asg_name                  = "${lower(var.PROJECT_NAME)}-${upper(var.ENVIRONMENT)}"
  vpc_zone_identifier       = ["${module.vpc.public_subnets}"]
  
  health_check_type         = "EC2"
  health_check_grace_period = 300
  
  # force_delete              = true
  min_size                  = 1
  max_size                  = 6
  desired_capacity          = 1
  wait_for_capacity_timeout = 0
}

Even if I remove root_block_device the error still happens.

Also, if I try to use a block (like very old versions used) I get this error:

Error: Unsupported block type

  on webserver-asg.tf line 26, in module "webserver_asg":
  26:   root_block_device {

Blocks of type "root_block_device" are not expected here. Did you mean to
define argument "root_block_device"? If so, use the equals sign to assign it a
value.

`ignore_changes` support

Hi, I am using this module in our infra. Thanks a lot!

However, our ECS instance count is increased or decrease based on ASG Policies
How should we handle the mismatch between terraform defined capacity (min, max, desired) and the actual capacity manipulated by ASG policies?

For instance, in aws resource in terraform there is a ignore_changes.
Is there tip or trick we can apply?

Thanks!

aws_autoscaling_group availability_zones is ignored

Hello

We're specifying an availability_zones for an aws_autoscaling_group. The goal is simple, instances must stick to the same AZ along with an EBS volume. Otherwise they're in a different AZ and there's an error calling aws ec2 attach-volume :

An error occurred (InvalidVolume.ZoneMismatch) when calling the AttachVolume operation: The volume 'vol-03YYYYYYYYYY' is not in the same availability zone as instance 'i-0fXXXXXXXXXXX42'` 

Here's our resource

resource "aws_autoscaling_group" "gdshjh" {
  availability_zones   = ["${data.terraform_remote_state.ebs.ebs_availability_zone}"]
  desired_capacity      = 1
  health_check_grace_period = 600
  launch_configuration  = "${aws_launch_configuration.fsdgh_instances.name}"
  load_balancers = ["${aws_elb.sdfsghfgf.id}"]
  max_size             = 1
  min_size             = 1
  name                 = "${module.component_id.fully_qualified_name}-instances"
  vpc_zone_identifier  = ["${data.terraform_remote_state.vpc.vpc_subnets[var.subnet_class]}"]
  wait_for_elb_capacity = 1

  lifecycle {
    create_before_destroy = true
  }

  // merging default module tags with provided tags
  tags = ["${concat(var.tags, list(
      map("key", "Name", "value", module.component_id.fully_qualified_name, "propagate_at_launch", true),
      map("key", "Terraform", "value", true, "propagate_at_launch", true),
      map("key", "Environment", "value", var.environment, "propagate_at_launch", true)
  ))}"]
}

And here's the terraform log. As you can see, there's nothing about availability zones.

aws_autoscaling_group.gitlab: Creating...
  arn:                            "" => "<computed>"
  default_cooldown:               "" => "<computed>"
  desired_capacity:               "" => "1"
  force_delete:                   "" => "false"
  health_check_grace_period:      "" => "600"
  health_check_type:              "" => "<computed>"
  launch_configuration:           "" => "dev-fqsdg-fsqdg-instances20171010095844203500000001"
  load_balancers.#:               "" => "1"
  load_balancers.4268081274:      "" => "dev-fsqd-fshg-fsdg"
  max_size:                       "" => "1"
  metrics_granularity:            "" => "1Minute"
  min_size:                       "" => "1"
  name:                           "" => "dev-gfdf-fqsdghfdg-qgdsf"
  protect_from_scale_in:          "" => "false"
  tags.#:                         "" => "3"
  tags.0.%:                       "" => "3"
  tags.0.key:                     "" => "Name"
  tags.0.propagate_at_launch:     "" => "1"
  tags.0.value:                   "" => "dev-gqfd-gqdf"
  tags.1.%:                       "" => "3"
  tags.1.key:                     "" => "Terraform"
  tags.1.propagate_at_launch:     "" => "1"
  tags.1.value:                   "" => "1"
  tags.2.%:                       "" => "3"
  tags.2.key:                     "" => "Environment"
  tags.2.propagate_at_launch:     "" => "1"
  tags.2.value:                   "" => "dev"
  target_group_arns.#:            "" => "<computed>"
  vpc_zone_identifier.#:          "" => "2"
  vpc_zone_identifier.3464678658: "" => "subnet-gxhvfcg"
  vpc_zone_identifier.584783251:  "" => "subnet-bwcgnhvxg"
  wait_for_capacity_timeout:      "" => "10m"
  wait_for_elb_capacity:          "" => "1"

Here are our versions :

  • Terraform v0.10.7
  • Module AWS 1.0.0

Best regards,

tags_as_map within custom module fails

I'm wrapping terraform-aws-autoscaling within my own module (mymodule).
Passing tags into mymodule -> terraform-aws-autoscaling tags_as_map fails with the following error:

   * module.mystack.module.mymodule.module.mymodule.null_resource.tags_as_list_of_maps: null_resource.tags_as_list_of_maps: value of 'count' cannot be computed

Any idea, what could be wrong?
I'm only able to pass "{}" as tags.

target_group_arns is asking for a list when passing in interpolation syntax

I have
target_group_arns = ["${data.terraform_remote_state.alb.target_group_arn}"]

and terraform plan returns
module.cb-asg.module.autoscaling_group.aws_autoscaling_group.this: target_group_arns: should be a list

when I put it to the output, I get a valid arn
output "target_group_arn" { value = "${data.terraform_remote_state.alb.target_group_arn}" }

then I can copy/paste that arn into here and it works just fine.
target_group_arns = ["arn-from-my-output"]

Scaling policies [question]

Hi all,

First off let me say thanks for all of the hard work, I'm using this module a fair bit and it's saved me an awful lot of boilerplate. I just wanted to know if anyone was working on adding scaling policies?

I've had a quick look around was able to more-or-less seamlessly integrate Unifio's work with the terraform-aws-autoscaling module, the only caveat being that you define desired_capacity here when it's technically optional: i.e. this module is scaling 'manually' versus 'dynamically'.

I just wanted to check whether scaling policies were in anyones sights already before I fork and use Unifio as inspiration; to avoid duplication of work and hacky code on my part.

Cheers,

Steph

ASG required Target Group to be defined

Error: Error running plan: 1 error(s) occurred:

* module.prod.module.asg.module.autoscaling_group.output.this_autoscaling_group_target_group_arns: Resource 'aws_autoscaling_group.this' does not have attribute 'target_group_arns' for variable 'aws_autoscaling_group.this.target_group_arns'

The ASG I'm setting up doesn't have a target group, but the output requires one.

Error applying plan

In the last month we've received several instances of a module that has failed on an apply and then run again a few minutes later with no changes and it works correctly.

The failure output is as follows:

Error: Error applying plan:

1 error(s) occurred:

  • module.wzd_autoscale.aws_autoscaling_group.this: aws_autoscaling_group.this: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Please include the following information in your report:

Terraform Version: 0.11.7
Resource ID: aws_autoscaling_group.this
Mismatch reason: diff RequiresNew; old: false, new: true
Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"tags.2.value":*terraform.ResourceAttrDiff{Old:"coreapi1", New:"coreapi1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.key":*terraform.ResourceAttrDiff{Old:"Tier", New:"Tier", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.key":*terraform.ResourceAttrDiff{Old:"Project", New:"Project", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.key":*terraform.ResourceAttrDiff{Old:"Name", New:"Name", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.value":*terraform.ResourceAttrDiff{Old:"pd-coreapi1", New:"pd-coreapi1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.#":*terraform.ResourceAttrDiff{Old:"4", New:"4", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.value":*terraform.ResourceAttrDiff{Old:"pd", New:"pd", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.key":*terraform.ResourceAttrDiff{Old:"AMI Version", New:"AMI Version", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.value":*terraform.ResourceAttrDiff{Old:"ami-09ac11d3cc32408b0", New:"ami-0a46f62300b0d271d", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}
Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"tags.0.value":*terraform.ResourceAttrDiff{Old:"pd-coreapi1", New:"pd-coreapi1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.#":*terraform.ResourceAttrDiff{Old:"8", New:"8", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "termination_policies.0":*terraform.ResourceAttrDiff{Old:"Default", New:"Default", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_zone_identifier.2001683959":*terraform.ResourceAttrDiff{Old:"subnet-df599084", New:"subnet-df599084", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.#":*terraform.ResourceAttrDiff{Old:"4", New:"4", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "health_check_grace_period":*terraform.ResourceAttrDiff{Old:"300", New:"300", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_zone_identifier.1487854244":*terraform.ResourceAttrDiff{Old:"subnet-f7b1f5be", New:"subnet-f7b1f5be", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "metrics_granularity":*terraform.ResourceAttrDiff{Old:"1Minute", New:"1Minute", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.3267518000":*terraform.ResourceAttrDiff{Old:"GroupTerminatingInstances", New:"GroupTerminatingInstances", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "termination_policies.#":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "max_size":*terraform.ResourceAttrDiff{Old:"15", New:"15", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "arn":*terraform.ResourceAttrDiff{Old:"arn:aws:autoscaling:us-west-2:733884197363:autoScalingGroup:35205620-6f76-44b6-afdf-8e3931a3fd24:autoScalingGroupName/pd-coreapi1-coreapi1-lc-20181128120406131100000001-20181128120947539500000001", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.4118539418":*terraform.ResourceAttrDiff{Old:"GroupMinSize", New:"GroupMinSize", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "default_cooldown":*terraform.ResourceAttrDiff{Old:"300", New:"300", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "health_check_type":*terraform.ResourceAttrDiff{Old:"ELB", New:"ELB", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "desired_capacity":*terraform.ResourceAttrDiff{Old:"5", New:"5", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "name_prefix":*terraform.ResourceAttrDiff{Old:"pd-coreapi1-coreapi1-lc-20181128120406131100000001-", New:"pd-coreapi1-coreapi1-lc-20181212120457898100000001-", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Sensitive:false, Type:0x0}, "target_group_arns.3847461211":*terraform.ResourceAttrDiff{Old:"arn:aws:elasticloadbalancing:us-west-2:733884197363:targetgroup/tg-ore-pd-coreapi1-80-wzpd-1-1/e433cae97f5394f2", New:"arn:aws:elasticloadbalancing:us-west-2:733884197363:targetgroup/tg-ore-pd-coreapi1-80-wzpd-1-1/e433cae97f5394f2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "target_group_arns.#":*terraform.ResourceAttrDiff{Old:"2", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "protect_from_scale_in":*terraform.ResourceAttrDiff{Old:"false", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.propagate_at_launch":*terraform.ResourceAttrDiff{Old:"1", New:"1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "wait_for_capacity_timeout":*terraform.ResourceAttrDiff{Old:"15m", New:"15m", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.1940933563":*terraform.ResourceAttrDiff{Old:"GroupTotalInstances", New:"GroupTotalInstances", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.119681000":*terraform.ResourceAttrDiff{Old:"GroupStandbyInstances", New:"GroupStandbyInstances", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.value":*terraform.ResourceAttrDiff{Old:"ami-09ac11d3cc32408b0", New:"ami-0a46f62300b0d271d", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.4136111317":*terraform.ResourceAttrDiff{Old:"GroupMaxSize", New:"GroupMaxSize", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "min_elb_capacity":*terraform.ResourceAttrDiff{Old:"2", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.3394537085":*terraform.ResourceAttrDiff{Old:"GroupDesiredCapacity", New:"GroupDesiredCapacity", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.%":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.value":*terraform.ResourceAttrDiff{Old:"coreapi1", New:"coreapi1", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "target_group_arns.1583413426":*terraform.ResourceAttrDiff{Old:"arn:aws:elasticloadbalancing:us-west-2:733884197363:targetgroup/tg-ore-pd-coreapi1-443-wzpd-1-1/07fd0747f48ca32b", New:"arn:aws:elasticloadbalancing:us-west-2:733884197363:targetgroup/tg-ore-pd-coreapi1-443-wzpd-1-1/07fd0747f48ca32b", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.3551801763":*terraform.ResourceAttrDiff{Old:"GroupInServiceInstances", New:"GroupInServiceInstances", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "launch_configuration":*terraform.ResourceAttrDiff{Old:"coreapi1-lc-20181128120406131100000001", New:"coreapi1-lc-20181212120457898100000001", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_zone_identifier.#":*terraform.ResourceAttrDiff{Old:"3", New:"3", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.value":*terraform.ResourceAttrDiff{Old:"pd", New:"pd", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.0.key":*terraform.ResourceAttrDiff{Old:"Name", New:"Name", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "vpc_zone_identifier.922816829":*terraform.ResourceAttrDiff{Old:"subnet-432e0224", New:"subnet-432e0224", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"pd-coreapi1-coreapi1-lc-20181128120406131100000001-20181128120947539500000001", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "enabled_metrics.308948767":*terraform.ResourceAttrDiff{Old:"GroupPendingInstances", New:"GroupPendingInstances", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.3.key":*terraform.ResourceAttrDiff{Old:"AMI Version", New:"AMI Version", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "min_size":*terraform.ResourceAttrDiff{Old:"4", New:"4", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "wait_for_elb_capacity":*terraform.ResourceAttrDiff{Old:"0", New:"0", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "force_delete":*terraform.ResourceAttrDiff{Old:"false", New:"false", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.2.key":*terraform.ResourceAttrDiff{Old:"Project", New:"Project", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "tags.1.key":*terraform.ResourceAttrDiff{Old:"Tier", New:"Tier", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:true, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}

Empty value EC2 tag will fail terraform apply

Hi guys,

This is my module definition:

module "service-auto-scaling-group" {
  source = "terraform-aws-modules/autoscaling/aws"
  version = "3.0.0"

  ...

  tags = [
   ...
    {
      key = "Reserve"
      value = ""
      propagate_at_launch = true
    }
  ]
}

This results in the following tf plan diff:

# blah.module.service-auto-scaling-group.aws_autoscaling_group.this[0] will be created
  + resource "aws_autoscaling_group" "this" {
      + ....
      + tags                      = [
          + {
              + "key"                 = "Reserve"
              + "propagate_at_launch" = "true"
            },
        ]
      + ...
    }

Notice that the "value" = "" is expected, but it's omitted for some reasons.

And when I run terraform apply, it spit out this error:

Error: blah-asg-blah: invalid tag attributes: value missing

 on blah.tf line 60, in resource "aws_autoscaling_group" "this":
  60: resource "aws_autoscaling_group" "this" {

09/28 edit:

Expected behavior:

in the example above,

+ resource "aws_autoscaling_group" "this" {
      + ....
      + tags                      = [
          + {
              + "key"                 = "Reserve"
              + "propagate_at_launch" = "true"
              + "value"                          =  ""    // empty value is correctly added
            },
        ]
      + ...
    }

Environment:
terraform 0.12.7
terraform-aws-modules/autoscaling/aws 3.0.0
OS: MacOS 10.13.6

Desired capacity should not be mandatory

Hello, first of all thanks for your module.

The desired_capacity parameter should not be mandatory, although I know that currently there is no way in Terraform to pass null values to a module.
My use case is that I don't want to set written in stone in Terraform a desired capacity value for my ASG, or otherwise I could not apply Terraform when the ASG has auto-scaled to a different value.

Terraform 12 Variables

What a mess, the upgrade doesnt even work....

#> terraform version
Terraform v0.12.23
+ provider.aws v2.53.0
+ provider.template v2.1.2

#> terraform 0.12upgrade
Would you like to upgrade the module in capacity/ecs?
  Only 'yes' will be accepted to confirm.

  Enter a value: yes

-----------------------------------------------------------------------------

Upgrade complete!

Something as simple as this variable template:

variable "env" {
  description = "Environment"
  type        = "string"
  default     = "env1"
}

variable "env_subnets" {
  description = "VPC subnets"

  default     = {
      "env1" = [
          "subnet-1",
          "subnet-2"
      ]
      "env2" = [
          "subnet-3",
          "subnet-4"
      ]
      "env3"  = [
          "subnet-5",
          "subnet-6"
      ]
  }
}

Which used to be called like this:
${var.env_subnets["${var.env}"]}

Now just gives an error, doesn't upgrade at all like SOME of the other tf files did, and has left my dev machine in a half broken state. (Yay for source control)

Can someone help out with this? I have searched high and low and nothing seems to answer how to solve this particular issue.

Even the docs are poorly written to accommodate this. https://www.terraform.io/docs/configuration/variables.html

Error: element() may not be used with an empty list when create_lc = false

Error

aws_autoscaling_group.this: element: element() may not be used with an empty list in:
${var.create_lc ? element(aws_launch_configuration.this.*.name, 0) : var.launch_configuration}

Cause

It appears that element() cannot be used for launch_configuration { count = 0 } for create_lc == false.

launch_configuration = "${var.create_lc ? element(aws_launch_configuration.this.*.name, 0) : var.launch_configuration}"

Workaround

35c35
<   launch_configuration = "${var.create_lc ? element(aws_launch_configuration.this.*.name, 0) : var.launch_configuration}"
---
>   launch_configuration = "${var.create_lc ?  element(concat(aws_launch_configuration.this.*.name, list("")), 0) : var.launch_configuration}"
77c77
<     lc_name = "${var.create_lc ? element(aws_launch_configuration.this.*.name, 0) : var.launch_configuration}"
---
>     lc_name = "${var.create_lc ? element(concat(aws_launch_configuration.this.*.name, list("")), 0) : var.launch_configuration}"

Unable to update tags after ASG launch

Hi,

Problem: During the initial launch, I supplied a set of 13 tags. Post launch and once my EC2 worker node is up and running, I updated my existing tag value to a different value. I see it in my plan output and post apply, I do see the new values in my state file for the null resource. However, the same is not reflected on the actual instances.

module.tableau_worker_asg.null_resource.tags_as_list_of_maps[23]

Regards
Keerthi

Instance IDs of instances in ASG?

Hi,

I'm trying to set Route53 aliases to the instances created with the autoscaling module, however, it doesn't seem like this module keeps track of its instances IDs. Is this expected, and is there any known workaround? I don't intend to use a load balancer, because in my use case it is superfluous.

Thank you.

var.tags type mismatch

The other modules accept a var.tags argument of type "map" that can be used to make sure all of the resources are tagged with the same things. This pattern is actually quite useful as it allows better discoverability in the AWS Console and to build various tools that can track all the resource usage for a specific terraform env.

Because this module "tags" variable has a type "list", it is not compatible with the other modules.

The reason why the type is different on this module is an implementation detail due to two different reasons:

(1) the autoscaling group is actually accepting a type list, which is why this is being used. and (2) the terraform interpolation language is not powerful enough to transform a map into a list of maps. I am assuming that all tags would be propagated at launch.

I think that for now it would make sense to rename the variable to "tags_list" to avoid ambiguity and allow to introduce a proper tags map once the language supports the transformation.

aws_launch_configuration.this (deposed #0): ResourceInUse: Cannot delete launch configuration because it is attached to AutoScalingGroup.

Hi,
When I try to add associate_public_ip_address to launch configuration, terraform apply failed with following error:

Error: Error applying plan:

2 error(s) occurred:

* module.zabbix_app_asg.module.launch_configuration.aws_launch_configuration.this (destroy): 1 error(s) occurred:

* aws_launch_configuration.this (deposed #0): 1 error(s) occurred:

* aws_launch_configuration.this (deposed #0): ResourceInUse: Cannot delete launch configuration zabbix-app-lc-20171125225647460700000002 because it is attached to AutoScalingGroup
	status code: 400, request id: 19197d51-d235-11e7-8d7b-19219f15fe4b
* module.bastion_ec2.aws_instance.this: aws_instance.this: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Terraform version

Terraform v0.11.0
+ provider.aws v1.3.1

Error Log

autoscaling_terraform.bug.log

Stemps to reproduce

  • terraform init
  • terraform apply
  • uncomment associate_public_ip_address properties in launch configuration
  • terraform apply (Error)

Example

TF-Example2.zip

Expected length of user_data not in range

Hello,

I have a bit of an issue with the last version, I've got the following error when I run terraform plan :

Error: module.X: expected length of user_data to be in the range (1 - 16384), got

I try to make a workaround by doing user_data = " " but got the same error. However user_data = "Test" worked"

Any Idea ?

Regards

Module fails when optional tags_as_map not present

Description:
When the new option for tags_as_map is not used the default empty map is passed to locals.tf and as part of the map building, element() is called on the resulting empty list and fails. I'm a bit new to Terraform but diving into the language syntax I don't see a particularly clean way to fix this without an additional conditional for each call that ensures local.tag_keys and local.tag_values have a length greater than 0.

Steps to reproduce:
Remove tags_as_map variable from examples/asg_ec2/main.tf, run terraform plan.

Result:

* module.example.local.list0: local.list0: element: element() may not be used with an empty list in:

${list(
      element(local.tag_keys, 0) != "" ? element(local.tag_keys, 0) : "",
      element(local.tag_values, 0) != "" ? element(local.tag_values, 0) : "",
      "true"
    )
  }

Lifecycle ignore?

I tried to ignore changes to userdata but terraform wants to recreate the AsG and launch configuration. What am I missing?

root_block_device should be a map

Hi,

The module defines the variable root_block_device as a list, but according to the terraform doc, it should be a map:
https://www.terraform.io/docs/providers/aws/r/launch_configuration.html#block-devices

Each of the *_block_device attributes controls a portion of the AWS Launch Configuration's "Block Device Mapping". It's a good idea to familiarize yourself with AWS's Block Device Mapping docs to understand the implications of using these attributes.

The root_block_device mapping supports the following:

volume_type - (Optional) The type of volume. Can be "standard", "gp2", or "io1". (Default: "standard").
volume_size - (Optional) The size of the volume in gigabytes.
iops - (Optional) The amount of provisioned IOPS. This must be set with a volume_type of "io1".
delete_on_termination - (Optional) Whether the volume should be destroyed on instance termination (Default: true).

Or am I getting it wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.