Skip to content

Commit

Permalink
Merge pull request #279 from mergenci/fix-ec2-instance-panic
Browse files Browse the repository at this point in the history
Fix EC2 instance panic
  • Loading branch information
mergenci authored Jan 2, 2025
2 parents 997a60e + b935e46 commit c0eb961
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/tags/key_value_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,10 @@ func GetAnyAttr(value cty.Value, attr string, shouldReturnSetElement func(string
return cty.NilVal, fmt.Errorf("invalid index: %s", indexStr)
}

if value.Type().IsListType() && (value.IsNull() || !value.IsKnown()) {
return cty.NilVal, fmt.Errorf("list attribute %s is unknown or null", attrName)
}

if index >= value.LengthInt() {
return cty.NilVal, fmt.Errorf("index %d out of range for attribute %s", index, attrName)
}
Expand Down

0 comments on commit c0eb961

Please sign in to comment.