-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Encountering undefined method `[]' for nil:NilClass trying to create and attach aws_ebs_volume #242
Comments
I am also experiencing this. |
This happened to me. You might be missing a value for node['ec2']['instance_id']. Older cookbook versions used a 'query_instance_id' method to lookup the instance_id. This was modified from versions 3.0.0 and up with the intention that Ohai would provide the values. Try running the aws::ec2_hints recipe. I believe that is what is supposed to supply the required values now. |
Adding |
Cookbook version
aws cookbook is version 3.3.2
Chef-client version
root@hgtv-aws-test2-publish cookbooks]# chef-client -v
Chef: 12.6.0
Platform Details
Linux hgtv-aws-test2-publish 4.4.8-20.46.amzn1.x86_64 #1 SMP Wed Apr 27 19:28:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
running on AWS
Scenario:
I am trying to create and attach a volume on to one of my EC2 instances. The recipe works fine with the 2.9.3 version of the cookbook. When I try to use any of the 3.x versions, I get the error listed above.
Steps to Reproduce:
I have tried the following simple recipe and it fails.
vol_path = node[:instance][:vol_path]
aws_ebs_volume 'cq_vol' do
device "/dev/sdf"
size 100
volume_type "gp2"
snapshot_id "my-snapshot" #id obscured for security reasons
action [:create, :attach]
end
aws_resource_tag 'vol_tags' do
resource_id lazy { node[:aws][:ebs_volume][:cq_vol][:volume_id] }
tags ({"auto-cq5-volume" => "",
"subdomain" => node[:instance][:subdomain],
"cqservertype" => node[:instance][:role]
})
action :update
end
mount vol_path do
device '/dev/sdf'
fstype 'xfs'
action [:mount, :enable]
end
Expected Result:
I am expecting to have a volume created, attached, and mounted to my system.
Actual Result:
I get the following error.
The text was updated successfully, but these errors were encountered: