You can’t “attach” codes to Opportunities, but you can decide whether you’d like to offer unique discount codes to creators participating in an Opportunity. To offer a creator a discount code, follow the steps HERE.
If you would like to remove codes after the Opportunity has wrapped, you’ll need to manually remove the discount codes from creators’ talent cards at the end of the Opportunity.