Skip to content

Commit

Permalink
TER-233: Update ghost app resource to match ghost app API specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Caussat authored and Jordan Caussat committed Mar 19, 2018
1 parent c2dfba7 commit a1c83be
Showing 1 changed file with 119 additions and 40 deletions.
159 changes: 119 additions & 40 deletions ghost/resource_ghost_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,22 @@ func resourceGhostApp() *schema.Resource {
Type: schema.TypeString,
Required: true,
},

"region": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"vpc_id": {
Type: schema.TypeString,
Required: true,
},
"instance_type": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"detailled_monitoring": {
Type: schema.TypeBool,
Optional: true,
Default: 0,
},

"autoscale": {
Type: schema.TypeList,
Required: true,
Expand All @@ -54,27 +51,24 @@ func resourceGhostApp() *schema.Resource {
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"metrics": {
"enable_metrics": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"min": {
Type: schema.TypeInt,
Optional: true,
Default: 1,
},
"max": {
Type: schema.TypeInt,
Optional: true,
Default: 3,
},
},
},
},

"load_balancer": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -115,14 +109,17 @@ func resourceGhostApp() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"ami_name": {
Type: schema.TypeString,
Optional: true,
},
"subnet_id": {
Type: schema.TypeString,
Required: true,
},
},
},
},

"environment_infos": {
Type: schema.TypeList,
Required: true,
Expand All @@ -131,15 +128,16 @@ func resourceGhostApp() *schema.Resource {
Schema: map[string]*schema.Schema{
"instance_profile": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"key_name": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"public_ip": {
"public_ip_address": {
Type: schema.TypeBool,
Required: true,
Optional: true,
Default: true,
},
"root_block_device": {
Type: schema.TypeMap,
Expand All @@ -149,7 +147,6 @@ func resourceGhostApp() *schema.Resource {
"size": {
Type: schema.TypeInt,
Optional: true,
Default: 20,
},
"name": {
Type: schema.TypeString,
Expand All @@ -169,11 +166,11 @@ func resourceGhostApp() *schema.Resource {
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
"tag_name": {
Type: schema.TypeString,
Required: true,
},
"value": {
"tag_value": {
Type: schema.TypeString,
Required: true,
},
Expand All @@ -191,25 +188,23 @@ func resourceGhostApp() *schema.Resource {
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
"device_name": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
"type": {
"volume_type": {
Type: schema.TypeString,
Optional: true,
Default: "gp2",
Required: true,
},
"size": {
"volume_size": {
Type: schema.TypeInt,
Optional: true,
Default: 20,
Required: true,
},
"iops": {
Type: schema.TypeInt,
Optional: true,
},
"attach_volume_during_buildimage": {
"launch_block_device_mappings": {
Type: schema.TypeBool,
Optional: true,
},
Expand All @@ -219,7 +214,6 @@ func resourceGhostApp() *schema.Resource {
},
},
},

"environment_variables": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -236,13 +230,52 @@ func resourceGhostApp() *schema.Resource {
},
},
},

"log_notifications": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
},

"blue_green": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enable_blue_green": {
Type: schema.TypeBool,
Optional: true,
},
"color": {
Type: schema.TypeString,
Optional: true,
},
"is_online": {
Type: schema.TypeBool,
Optional: true,
},
"hooks": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"post_swap": {
Type: schema.TypeString,
Optional: true,
},
"pre_swap": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"alter_ego_id": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"features": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -254,23 +287,30 @@ func resourceGhostApp() *schema.Resource {
},
"version": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"parameters": {
Type: schema.TypeString,
Optional: true,
},
"provisioner": {
Type: schema.TypeString,
Optional: true,
},
},
},
},

"lifecycle_hooks": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pre_build_image": {
"pre_buildimage": {
Type: schema.TypeString,
Optional: true,
},
"post_build_image": {
"post_buildimage": {
Type: schema.TypeString,
Optional: true,
},
Expand All @@ -285,7 +325,6 @@ func resourceGhostApp() *schema.Resource {
},
},
},

"modules": {
Type: schema.TypeList,
Required: true,
Expand All @@ -303,17 +342,21 @@ func resourceGhostApp() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"uid": {
"scope": {
Type: schema.TypeString,
Required: true,
},
"uid": {
Type: schema.TypeInt,
Optional: true,
},
"gid": {
Type: schema.TypeString,
Type: schema.TypeInt,
Optional: true,
},
"scope": {
Type: schema.TypeString,
Required: true,
"initialized": {
Type: schema.TypeBool,
Optional: true,
},
"build_pack": {
Type: schema.TypeString,
Expand All @@ -331,6 +374,42 @@ func resourceGhostApp() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"last_deployment": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"safe_deployment": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ha_backend": {
Type: schema.TypeString,
Optional: true,
},
"load_balancer_type": {
Type: schema.TypeString,
Optional: true,
},
"app_tag_value": {
Type: schema.TypeString,
Optional: true,
},
"api_port": {
Type: schema.TypeInt,
Optional: true,
},
"wait_before_deploy": {
Type: schema.TypeInt,
Optional: true,
},
"wait_after_deploy": {
Type: schema.TypeInt,
Optional: true,
},
},
},
},
Expand Down

0 comments on commit a1c83be

Please sign in to comment.