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

provider-aws: Creating Opsworks Stack fails with default OS Ubuntu 14.04 LTS and Chef version 11.10 #6221

Closed
janschumann opened this issue Apr 18, 2016 · 3 comments

Comments

@janschumann
Copy link
Contributor

janschumann commented Apr 18, 2016

Terraform Version

Terraform v0.6.15-dev (a3db932)

Affected Resource(s)

  • aws_opsworks_stack

Config

resource "aws_opsworks_stack" "stack" {
  name = "${var.name}"
  region = "${var.region}"
  service_role_arn = "${var.service_role_arn}"
  default_instance_profile_arn = "${var.instance_profile_arn}"
  default_os = "Ubuntu 14.04 LTS"
  configuration_manager_version = "11.10"
  manage_berkshelf = true
  berkshelf_version = "${var.berkshelf_version}"
  use_custom_cookbooks = true
  custom_cookbooks_source = {
    type = "${var.cookbook_source_type}"
    url = "${var.cookbook_source_url}"
    revision = "${var.cookbook_source_revision}"
    ssh_key = "${file("${var.deploy_ssh_key_file}")}"
  }
  default_root_device_type = "ebs"
  use_opsworks_security_groups = false
  vpc_id = "vpc-xxxxx"
  default_subnet_id = "subnet-xxxxx"
  custom_json = "{}"
}

Debug Output

module.website.aws_opsworks_stack.stack: Creating...
  berkshelf_version:                  "" => "3.2.0"
  configuration_manager_name:         "" => "Chef"
  configuration_manager_version:      "" => "11.10"
  custom_cookbooks_source.#:          "" => "1"
  custom_cookbooks_source.0.revision: "" => "develop"
  custom_cookbooks_source.0.ssh_key:  "" => "-----BEGIN RSA PRIVATE-----END RSA PRIVATE KEY-----\n"
  custom_cookbooks_source.0.type:     "" => "git"
  custom_cookbooks_source.0.url:      "" => "git@github.com:foo/bar.git"
  custom_json:                        "" => "{}"
  default_availability_zone:          "" => "<computed>"
  default_instance_profile_arn:       "" => "arn:aws:iam::..."
  default_os:                         "" => "Ubuntu 14.04 LTS"
  default_root_device_type:           "" => "ebs"
  default_subnet_id:                  "" => "subnet-xxxxxxxx"
  hostname_theme:                     "" => "Layer_Dependent"
  manage_berkshelf:                   "" => "1"
  name:                               "" => "website"
  region:                             "" => "eu-central-1"
  service_role_arn:                   "" => "arn:aws:iam::..."
  use_custom_cookbooks:               "" => "1"
  use_opsworks_security_groups:       "" => "0"
  vpc_id:                             "" => "vpc-xxxxxxxx"

Panic Output

Error applying plan:

1 error(s) occurred:

* aws_opsworks_stack.stack: ValidationException: Default Os: Ubuntu 14.04 LTS is unsupported with Chef::11.4. Please consult the AWS OpsWorks documentation at http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html to learn more about the current supported combinations.
    status code: 400, request id: e2b173e8-057d-11e6-8bc6-0bc8a82cebd4

Expected Behavior

The desired configuration should work, as it can be created via the aws console.

Actual Behavior

Stack creation fails due to the error described above. Please note that the error complains about Chef version 11.4 although 11.10 is configured in configuration_manager_version

@u2mejc
Copy link
Contributor

u2mejc commented Apr 18, 2016

I was docuemnting this too, I belive this is a known regression:

It actually breaks even more distos, including AWS linux distro, RHEL and anything dependent in the stack (newly merged instances and apps support, etc).

Related:

Debug Output

2016/04/15 11:45:42 [DEBUG] apply: aws_opsworks_stack.main: executing Apply
aws_opsworks_stack.main: Creating...
  berkshelf_version:             "" => "3.2.0"
  configuration_manager_name:    "" => "Chef"
  configuration_manager_version: "" => "11.10"
  custom_cookbooks_source.#:     "" => "<computed>"
  default_availability_zone:     "" => "<computed>"
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws: 2016/04/15 11:45:42 [DEBUG] Creating OpsWorks stack: {
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   DefaultInstanceProfileArn: "arn:aws:iam::*snip*:instance-profile/aws-opsworks-ec2-role-instance-profile",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   DefaultOs: "Ubuntu 14.04 LTS",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   DefaultSubnetId: "*snip*",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   Name: "awesome-stack-too",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   Region: "eu-west-1",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   ServiceRoleArn: "arn:aws:iam::*snip*:role/aws-opsworks-service-role",
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   UseOpsworksSecurityGroups: true,
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws:   VpcId: "vpc-*snip*"
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws: }
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws: 2016/04/15 11:45:42 [DEBUG] Waiting for state to become: [success]
2016/04/15 11:45:42 [DEBUG] terraform-provider-aws: 2016/04/15 11:45:42 [TRACE] Waiting 500ms before next try
  default_instance_profile_arn:  "" => "arn:aws:iam::*snip*:instance-profile/aws-opsworks-ec2-role-instance-profile"
  default_os:                    "" => "Ubuntu 14.04 LTS"
  default_root_device_type:      "" => "instance-store"
  default_subnet_id:             "" => "subnet-*snip*"
  hostname_theme:                "" => "Layer_Dependent"
  manage_berkshelf:              "" => "0"
  name:                          "" => "awesome-stack-too"
  region:                        "" => "eu-west-1"
  service_role_arn:              "" => "arn:aws:iam::*snip*:role/aws-opsworks-service-role"
  use_custom_cookbooks:          "" => "0"
  use_opsworks_security_groups:  "" => "1"
  vpc_id:                        "" => "vpc-*snip*"
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: 2016/04/15 11:45:43 [DEBUG] [aws-sdk-go] DEBUG: Request opsworks/CreateStack Details:
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: ---[ REQUEST POST-SIGN ]-----------------------------
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: POST / HTTP/1.1
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: Host: opsworks.us-east-1.amazonaws.com
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: User-Agent: terraform/0.6.14 () aws-sdk-go/1.1.12 (go1.6; darwin; amd64)
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: Content-Length: 360
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: Authorization: AWS4-HMAC-SHA256 Credential=*snip*us-east-1/opsworks/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=*snip*
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: Content-Type: application/x-amz-json-1.1
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: X-Amz-Content-Sha256: *snip*
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: X-Amz-Date: *snip*
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: X-Amz-Target: OpsWorks_*snip*.CreateStack
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: Accept-Encoding: gzip
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws:
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: {"DefaultInstanceProfileArn":"arn:aws:iam::*snip*:instance-profile/aws-opsworks-ec2-role-instance-profile","DefaultOs":"Ubuntu 14.04 LTS","DefaultSubnetId":"subnet-*snip*","Name":"awesome-stack-too","Region":"eu-west-1","ServiceRoleArn":"arn:aws:iam::*snip*:role/aws-opsworks-service-role","UseOpsworksSecurityGroups":true,"VpcId":"vpc-*snip*"}
2016/04/15 11:45:43 [DEBUG] terraform-provider-aws: -----------------------------------------------------
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: 2016/04/15 11:45:44 [DEBUG] [aws-sdk-go] DEBUG: Response opsworks/CreateStack Details:
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: ---[ RESPONSE ]--------------------------------------
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: HTTP/1.1 400 Bad Request
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: Connection: close
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: Content-Length: 288
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: Content-Type: application/x-amz-json-1.1
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: Date: Fri, 15 Apr 2016 18:45:44 GMT
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: X-Amzn-Requestid: *snip* 2016/04/15 11:45:44 [DEBUG] terraform-provider-aws:
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: {"__type":"ValidationException","message":"Default Os: Ubuntu 14.04 LTS is unsupported with Chef::11.4. Please consult the AWS OpsWorks documentation at http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os.html to learn more about the current supported combinations."}
2016/04/15 11:45:44 [DEBUG] terraform-provider-aws: -----------------------------------------------------

Terraform Configuration Files

https://gist.github.com/u2mejc/c504bd9b027a3bf14c9d0cda10a53589

aws_opsworks_stack is implicit, by not setting the Chef version in config during initial creation, AWS defaults to 11.4 which isn't supported in AWS Linux, Ubuntu 14.04 LTS, etc.

Work Around:

First Apply with (before launching instances):

default_os                    = "Ubuntu 12.04 LTS"
configuration_manager_version = "11.10"

Then edit and apply again with

default_os                    = "Ubuntu 14.04 LTS"
configuration_manager_version = "11.10"

The stack should update then to 14.04 LTS with Chef 11.10.

@stack72
Copy link
Contributor

stack72 commented Apr 19, 2016

Closed in #6244

@stack72 stack72 closed this as completed Apr 19, 2016
@ghost
Copy link

ghost commented Apr 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants