Code D with a year suffix is used to indicate the year for which a make-up contribution for a prior year is made under the Uniformed Services Employment and Reemployment Rights Act of 1994 (USERRA). The "17" in code D17 refers to a contribution made for 2017 and is a redundant indication since code D by itself on a 2017 W-2 already means a contribution for 2017. Ignore the "17" and select code D from TurboTax's drop-down box.
The "D" code in box 12 relates to 401(k) contribution made by your employer to your retirement plan. (There should only be a code letter in box 12, the number may refer to the amount of your 401(k) contributions during the year.)
Both a 401(k) and a Traditional IRA are tax deferred types of retirement plans. However, you usually make 401(k) through your employer since these plans are generally set up by business. Whereas an IRA is a retirement plan that you can fund yourself and you can claim a deduction for contributions to an IRA up to $5,500 (or $6,500 for people over 50)
You will not be able to claim your 401(k) contributions listed on your W-2 as an IRA deduction.
For more information on retirement plans, please click on this link - https://www.irs.gov/retirement-plans