I'm currently in the process of building a CDK stack and I am fairly new to CDK. My goal is to create a Simple Email Service (SES) ConfigurationSet
followed by an EmailIdentity
. The issue I encountered is that the creation of the EmailIdentity
fails during the cloud formation step due to the ConfigurationSet
not being completed yet. I attempted to use
EmailIdentityConstructor.node.addDependency(ConfigurationSet)
to make sure cloud formation waits, but it doesn't seem to have any effect when added to the CDK.
What could I be doing wrong?
From a logical standpoint, this should all be within a single stack since it's essentially one set of SES resources I'm trying to establish.
const ConfigurationSetConstructor = new ses.ConfigurationSet(this, 'email-bi-config-set', {
sendingEnabled: true,
reputationMetrics: false,
suppressionReasons: ses.SuppressionReasons.BOUNCES_AND_COMPLAINTS,
tlsPolicy: ses.ConfigurationSetTlsPolicy.REQUIRE,
});
ConfigurationSetConstructor.applyRemovalPolicy(RemovalPolicy.DESTROY);
const myConfigSet = ses.ConfigurationSet.fromConfigurationSetName(this, id, 'email-bi-config-set');
const EmailIdentityConstructor = new ses.EmailIdentity(this, 'email-identity', {
identity: ses.Identity.domain(domain),
configurationSet: myConfigSet,
feedbackForwarding: true,
mailFromDomain: domain,
});
EmailIdentityConstructor.applyRemovalPolicy(RemovalPolicy.DESTROY);
EmailIdentityConstructor.node.addDependency(ConfigurationSetConstructor);