This repository was archived by the owner on Dec 5, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +24
-1
lines changed Expand file tree Collapse file tree 5 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ func resourceChefEnvironment() *schema.Resource {
3434 "default_attributes_json" : {
3535 Type : schema .TypeString ,
3636 Optional : true ,
37+ Default : "{}" ,
3738 StateFunc : jsonStateFunc ,
3839 },
3940 "override_attributes_json" : {
4041 Type : schema .TypeString ,
4142 Optional : true ,
43+ Default : "{}" ,
4244 StateFunc : jsonStateFunc ,
4345 },
4446 "cookbook_constraints" : {
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ func TestAccEnvironment_basic(t *testing.T) {
5959 ImportState : true ,
6060 ImportStateVerify : true ,
6161 },
62+ {
63+ Config : testAccEnvironmentConfig_basic2 ,
64+ ResourceName : "chef_environment.test" ,
65+ ImportState : true ,
66+ ImportStateVerify : true ,
67+ },
6268 },
6369 })
6470}
123129 }
124130}
125131`
132+ const testAccEnvironmentConfig_basic2 = `
133+ resource "chef_environment" "test" {
134+ name = "terraform-acc-test-basic"
135+ description = "Terraform Acceptance Tests"
136+ cookbook_constraints = {
137+ "terraform" = "= 1.0.0"
138+ }
139+ }
140+ `
Original file line number Diff line number Diff line change @@ -35,21 +35,25 @@ func resourceChefNode() *schema.Resource {
3535 Type : schema .TypeString ,
3636 Optional : true ,
3737 StateFunc : jsonStateFunc ,
38+ Default : "{}" ,
3839 },
3940 "normal_attributes_json" : {
4041 Type : schema .TypeString ,
4142 Optional : true ,
4243 StateFunc : jsonStateFunc ,
44+ Default : "{}" ,
4345 },
4446 "default_attributes_json" : {
4547 Type : schema .TypeString ,
4648 Optional : true ,
4749 StateFunc : jsonStateFunc ,
50+ Default : "{}" ,
4851 },
4952 "override_attributes_json" : {
5053 Type : schema .TypeString ,
5154 Optional : true ,
5255 StateFunc : jsonStateFunc ,
56+ Default : "{}" ,
5357 },
5458 "run_list" : {
5559 Type : schema .TypeList ,
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ resource "chef_environment" "test" {
118118}
119119resource "chef_node" "test" {
120120 name = "terraform-acc-test-basic"
121- environment_name = "terraform-acc- test-node-basic"
121+ environment_name = chef_environment. test.name
122122 automatic_attributes_json = <<EOT
123123{
124124 "terraform_acc_test": true
Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ func resourceChefRole() *schema.Resource {
3434 "default_attributes_json" : {
3535 Type : schema .TypeString ,
3636 Optional : true ,
37+ Default : "{}" ,
3738 StateFunc : jsonStateFunc ,
3839 },
3940 "override_attributes_json" : {
4041 Type : schema .TypeString ,
4142 Optional : true ,
43+ Default : "{}" ,
4244 StateFunc : jsonStateFunc ,
4345 },
4446 "run_list" : {
You can’t perform that action at this time.
0 commit comments