TagOptionAssociation
Learn how to create, update, and manage AWS ServiceCatalog TagOptionAssociations using Alchemy Cloud Control.
The TagOptionAssociation resource lets you manage AWS ServiceCatalog TagOption Associations which are used to associate TagOptions with resources in AWS Service Catalog.
Minimal Example
Section titled “Minimal Example”Create a basic TagOptionAssociation with required properties.
import AWS from "alchemy/aws/control";
const tagOptionAssociation = await AWS.ServiceCatalog.TagOptionAssociation("basicTagOptionAssociation", { TagOptionId: "tag-option-1234", ResourceId: "portfolio-5678", adopt: false // Default is false: Fail if the resource already exists});
Advanced Configuration
Section titled “Advanced Configuration”This example demonstrates how to create a TagOptionAssociation and adopt an existing resource if it already exists.
const advancedTagOptionAssociation = await AWS.ServiceCatalog.TagOptionAssociation("advancedTagOptionAssociation", { TagOptionId: "tag-option-4321", ResourceId: "product-8765", adopt: true // Adopt existing resource instead of failing});
Use Case: Associating Multiple TagOptions
Section titled “Use Case: Associating Multiple TagOptions”You can manage multiple TagOption associations by creating separate instances.
const firstTagOptionAssociation = await AWS.ServiceCatalog.TagOptionAssociation("firstTagOptionAssociation", { TagOptionId: "tag-option-1111", ResourceId: "portfolio-2222"});
const secondTagOptionAssociation = await AWS.ServiceCatalog.TagOptionAssociation("secondTagOptionAssociation", { TagOptionId: "tag-option-3333", ResourceId: "portfolio-2222"});
Use Case: Updating an Existing Association
Section titled “Use Case: Updating an Existing Association”While the TagOptionAssociation resource does not directly support updates, you can manage them by re-creating the association if needed.
const updateTagOptionAssociation = await AWS.ServiceCatalog.TagOptionAssociation("updateTagOptionAssociation", { TagOptionId: "tag-option-2222", ResourceId: "portfolio-3333", adopt: true // Adopt existing resource});