Skip to content

Commit

Permalink
Fix errors after merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Oct 23, 2024
1 parent 4ca4fcd commit 703262f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions internal/service/deploy/deployment_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ func resourceDeploymentConfig() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
names.AttrType: {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateDiagFunc: enum.Validate[types.MinimumHealthyHostsPerZoneType](),
},
"value": {
names.AttrValue: {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Expand Down Expand Up @@ -367,8 +367,8 @@ func expandZonalConfig(d *schema.ResourceData) *types.ZonalConfig {

func expandMinimumHealthyHostsPerZone(config map[string]interface{}) *types.MinimumHealthyHostsPerZone {
minimumHealthyHostsPerZone := types.MinimumHealthyHostsPerZone{
Type: types.MinimumHealthyHostsPerZoneType(config["type"].(string)),
Value: int32(config["value"].(int)),
Type: types.MinimumHealthyHostsPerZoneType(config[names.AttrType].(string)),
Value: int32(config[names.AttrValue].(int)),
}

return &minimumHealthyHostsPerZone
Expand Down Expand Up @@ -452,8 +452,8 @@ func flattenMinimumHealthHostsPerZone(config *types.MinimumHealthyHostsPerZone)
}

item := make(map[string]interface{})
item["type"] = string(config.Type)
item["value"] = config.Value
item[names.AttrType] = string(config.Type)
item[names.AttrValue] = config.Value

return append(result, item)
}
16 changes: 8 additions & 8 deletions internal/service/deploy/deployment_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func TestAccDeployDeploymentConfig_zonalConfig(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.CodeDeployEndpointID),
ErrorCheck: acctest.ErrorCheck(t, names.DeployServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckDeploymentConfigDestroy(ctx),
Steps: []resource.TestStep{
Expand All @@ -257,24 +257,24 @@ func TestAccDeployDeploymentConfig_zonalConfig(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckDeploymentConfigExists(ctx, resourceName, &config1),
resource.TestCheckResourceAttr(resourceName, "compute_platform", "Server"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.#", "1"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.first_zone_monitor_duration_in_seconds", "10"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.#", "1"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.first_zone_monitor_duration_in_seconds", acctest.Ct10),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.0.type", "FLEET_PERCENT"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.0.value", "20"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.monitor_duration_in_seconds", "10"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.monitor_duration_in_seconds", acctest.Ct10),
),
},
{
Config: testAccDeploymentConfigConfig_zonalConfig(rName, 20, "HOST_COUNT", 2, 20),
Check: resource.ComposeTestCheckFunc(
testAccCheckDeploymentConfigExists(ctx, resourceName, &config2),
resource.TestCheckResourceAttr(resourceName, "compute_platform", "Server"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.#", "1"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.first_zone_monitor_duration_in_seconds", "20"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.#", "1"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.#", acctest.Ct1),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.0.type", "HOST_COUNT"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.0.value", "2"),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.minimum_healthy_hosts_per_zone.0.value", acctest.Ct2),
resource.TestCheckResourceAttr(resourceName, "zonal_config.0.monitor_duration_in_seconds", "20"),
),
},
Expand Down

0 comments on commit 703262f

Please sign in to comment.