Skip to content

Commit

Permalink
Merge pull request #14886 from terraform-providers/td-opsworks-tests
Browse files Browse the repository at this point in the history
tech-debt: update opsworks_slack attr and tests and enumerated values in opsworks resources
  • Loading branch information
anGie44 authored Aug 28, 2020
2 parents f320590 + 11726ff commit 4940461
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 322 deletions.
26 changes: 6 additions & 20 deletions aws/resource_aws_opsworks_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,9 @@ func resourceAwsOpsworksApplication() *schema.Resource {
ForceNew: true,
},
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
opsworks.AppTypeAwsFlowRuby,
opsworks.AppTypeJava,
opsworks.AppTypeRails,
opsworks.AppTypePhp,
opsworks.AppTypeNodejs,
opsworks.AppTypeStatic,
opsworks.AppTypeOther,
}, false),
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(opsworks.AppType_Values(), false),
},
"stack_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -77,15 +69,9 @@ func resourceAwsOpsworksApplication() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
opsworks.SourceTypeGit,
opsworks.SourceTypeSvn,
opsworks.SourceTypeArchive,
opsworks.SourceTypeS3,
"other",
}, false),
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(append(opsworks.SourceType_Values(), "other"), false),
},

"url": {
Expand Down
46 changes: 17 additions & 29 deletions aws/resource_aws_opsworks_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,16 @@ func resourceAwsOpsworksInstance() *schema.Resource {
},

"architecture": {
Type: schema.TypeString,
Optional: true,
Default: "x86_64",
ValidateFunc: validation.StringInSlice([]string{
opsworks.ArchitectureX8664,
opsworks.ArchitectureI386,
}, false),
Type: schema.TypeString,
Optional: true,
Default: "x86_64",
ValidateFunc: validation.StringInSlice(opsworks.Architecture_Values(), false),
},

"auto_scaling_type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
opsworks.AutoScalingTypeLoad,
opsworks.AutoScalingTypeTimer,
}, false),
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(opsworks.AutoScalingType_Values(), false),
},

"availability_zone": {
Expand Down Expand Up @@ -223,14 +217,11 @@ func resourceAwsOpsworksInstance() *schema.Resource {
},

"root_device_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
opsworks.RootDeviceTypeEbs,
opsworks.RootDeviceTypeInstanceStore,
}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
ValidateFunc: validation.StringInSlice(opsworks.RootDeviceType_Values(), false),
},

"root_device_volume_id": {
Expand Down Expand Up @@ -305,14 +296,11 @@ func resourceAwsOpsworksInstance() *schema.Resource {
},

"virtualization_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
opsworks.VirtualizationTypeParavirtual,
opsworks.VirtualizationTypeHvm,
}, false),
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice(opsworks.VirtualizationType_Values(), false),
},

"ebs_block_device": {
Expand Down
5 changes: 3 additions & 2 deletions aws/resource_aws_opsworks_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ func resourceAwsOpsworksStack() *schema.Resource {
},

"custom_json": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: suppressEquivalentJsonDiffs,
},

"default_availability_zone": {
Expand Down
Loading

0 comments on commit 4940461

Please sign in to comment.