Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ECS semgrep prefer-aws-go-sdk-pointer-conversion-conditional errors #24472

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ rules:
include:
- internal/service
exclude:
- internal/service/ecs
- internal/service/elasticache
- internal/service/elasticbeanstalk
- internal/service/elb
Expand Down
3 changes: 1 addition & 2 deletions internal/service/ecs/task_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,7 @@ func expandVolumesDockerVolume(configList []interface{}) *ecs.DockerVolumeConfig
}

if v, ok := config["autoprovision"]; ok && v != "" {
scope := dockerVol.Scope
if scope == nil || *scope != ecs.ScopeTask || v.(bool) {
if dockerVol.Scope == nil || aws.StringValue(dockerVol.Scope) != ecs.ScopeTask || v.(bool) {
ewbankkit marked this conversation as resolved.
Show resolved Hide resolved
dockerVol.Autoprovision = aws.Bool(v.(bool))
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ecs/task_definition_equivalency.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ func (cd containerDefinitions) Reduce(isAWSVPC bool) error {

for i, def := range cd {
// Deal with special fields which have defaults
if def.Cpu != nil && *def.Cpu == 0 {
if def.Cpu != nil && aws.Int64Value(def.Cpu) == 0 {
def.Cpu = nil
}
if def.Essential == nil {
def.Essential = aws.Bool(true)
}
for j, pm := range def.PortMappings {
if pm.Protocol != nil && *pm.Protocol == "tcp" {
if pm.Protocol != nil && aws.StringValue(pm.Protocol) == "tcp" {
cd[i].PortMappings[j].Protocol = nil
}
if pm.HostPort != nil && *pm.HostPort == 0 {
if pm.HostPort != nil && aws.Int64Value(pm.HostPort) == 0 {
cd[i].PortMappings[j].HostPort = nil
}
if isAWSVPC && cd[i].PortMappings[j].HostPort == nil {
Expand Down