Is buying an index ETF which contains my company insider trading?
If you make the decision to buy based on material, non-public information, then yes. Legally, buying an ETF that contains non-trivial quantities of a company's stock is the same as buying the company's stock for insider trading purposes.
If I buy this ETF is it will be considered insider trading or break the rule in my contract?
To know if it breaks the rule in your contract, we'd have to closely analyze the wording of the contract. I'd suspect it doesn't because you suggest that the contract only prohibits you from having a direct interest in the company stock. I suspect it probably would cover, for example, creating an LLC or trust and using it to buy the stock, but I doubt it would cover an ETF that is mostly not this company's stock.
If yes, then what should I do if I bought this ETF a few weeks before my company started to belong to that index and now I have this ETF with my company?
Since the contract probably only prohibits you from buying the stock itself (or something substantially equivalent to it, which the ETF isn't), there's probably nothing special you need to do. And, in any event, you didn't buy the ETF while you were bound by the contract anyway.
However, the bigger problem is not complying with the contract but complying with the laws on insider trading. I would strongly caution you not to sell the ETF at any time when you have material, non-public information about your company. If you pretty much always do and want to sell the ETF, use some safe harbor mechanism permitted by law, such as using a trading plan.