Skip to content

Commit

Permalink
Release prep (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
ichung08 authored Aug 13, 2024
1 parent 18a1cd1 commit 556d27e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
10 changes: 5 additions & 5 deletions internal/provider/models/api_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (data *ApiTokenDataSource) ReadFromResponse(ctx context.Context, apiToken *
if apiToken.EndAt != nil {
data.EndAt = types.StringValue(apiToken.EndAt.String())
} else {
data.EndAt = types.StringValue("")
data.EndAt = types.StringNull()
}
data.CreatedAt = types.StringValue(apiToken.CreatedAt.String())
data.UpdatedAt = types.StringValue(apiToken.UpdatedAt.String())
Expand All @@ -78,7 +78,7 @@ func (data *ApiTokenDataSource) ReadFromResponse(ctx context.Context, apiToken *
if apiToken.LastUsedAt != nil {
data.LastUsedAt = types.StringValue(apiToken.LastUsedAt.String())
} else {
data.LastUsedAt = types.StringValue("")
data.LastUsedAt = types.StringNull()
}
data.Roles, diags = utils.ObjectSet(ctx, apiToken.Roles, schemas.ApiTokenRoleAttributeTypes(), ApiTokenRoleTypesObject)
if diags.HasError() {
Expand All @@ -92,15 +92,15 @@ func (data *ApiTokenResource) ReadFromResponse(ctx context.Context, apiToken *ia
data.Id = types.StringValue(apiToken.Id)
data.Name = types.StringValue(apiToken.Name)
if apiToken.Description == "" {
data.Description = types.StringValue("")
data.Description = types.StringNull()
} else {
data.Description = types.StringValue(apiToken.Description)
}
data.ShortToken = types.StringValue(apiToken.ShortToken)
data.Type = types.StringValue(string(apiToken.Type))
data.StartAt = types.StringValue(apiToken.StartAt.String())
if apiToken.EndAt == nil {
data.EndAt = types.StringValue("")
data.EndAt = types.StringNull()
} else {
data.EndAt = types.StringValue(apiToken.EndAt.String())
}
Expand All @@ -118,7 +118,7 @@ func (data *ApiTokenResource) ReadFromResponse(ctx context.Context, apiToken *ia
data.ExpiryPeriodInDays = types.Int64Value(int64(*apiToken.ExpiryPeriodInDays))
}
if apiToken.LastUsedAt == nil {
data.LastUsedAt = types.StringValue("")
data.LastUsedAt = types.StringNull()
} else {
data.LastUsedAt = types.StringValue(apiToken.LastUsedAt.String())
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/models/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (data *TeamDataSource) ReadFromResponse(ctx context.Context, team *iam.Team
if team.RolesCount != nil {
data.RolesCount = types.Int64Value(int64(*team.RolesCount))
} else {
data.RolesCount = types.Int64Value(1)
data.RolesCount = types.Int64Value(0)
}

data.CreatedAt = types.StringValue(team.CreatedAt.String())
Expand Down
9 changes: 7 additions & 2 deletions internal/provider/resources/resource_api_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,11 @@ type apiTokenInput struct {
}

func apiToken(input apiTokenInput) string {
var description string
if input.Description != "" {
description = fmt.Sprintf("description = \"%v\"", input.Description)
}

roles := lo.Map(input.Roles, func(role apiTokenRole, _ int) string {
return fmt.Sprintf(`
{
Expand All @@ -783,11 +788,11 @@ func apiToken(input apiTokenInput) string {
return fmt.Sprintf(`
resource astro_api_token "%v" {
name = "%v"
description = "%s"
%v
type = "%s"
%v
expiry_period_in_days = %v
}`, input.Name, input.Name, input.Description, input.Type, rolesString, input.ExpiryPeriodInDays)
}`, input.Name, input.Name, description, input.Type, rolesString, input.ExpiryPeriodInDays)
}

type checkApiTokensExistenceInput struct {
Expand Down
8 changes: 0 additions & 8 deletions internal/provider/resources/resource_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,14 +861,6 @@ func validateHostedConfig(ctx context.Context, data *models.DeploymentResource)
)
}

// Need to check that is_development_mode is only for small schedulers with high_availability set to false
if data.IsDevelopmentMode.ValueBool() && (data.SchedulerSize.ValueString() != string(platform.DeploymentSchedulerSizeSMALL) || data.IsHighAvailability.ValueBool()) {
diags.AddError(
"is_development_mode is only supported for small schedulers with high_availability set to false",
"Either change the scheduler size to 'SMALL' and high_availability to false or set is_development_mode to true",
)
}

// Need to check that scaling_spec is only for is_development_mode set to true
if !data.IsDevelopmentMode.ValueBool() && !data.ScalingSpec.IsNull() {
diags.AddError(
Expand Down

0 comments on commit 556d27e

Please sign in to comment.