pulumi / pulumi-policy-aws

A policy pack of rules to enforce AWS best practices for security, reliability, cost, and more!
https://www.pulumi.com
Apache License 2.0
33 stars 6 forks source link

Creation ACM Certificate Fails Validation if Certificate has yet to be Created #79

Closed phillipedwards closed 2 years ago

phillipedwards commented 2 years ago

Hello!

Issue details

As a developer, I want to apply AWS Guard policies to my stack that creates AWS ACM Certificates, to ensure my policies do not expire without me knowing.

Policy pack attempts to retrieve the ACM Certificate from the specified AWS region, however, Certificate does not exist and SDK call fails.

Steps to reproduce

  1. Create a new Pulumi Typescript project. pulumi new aws-typescript
  2. mkdir awsguard && cd awsguard
  3. pulumi policy new awsguard-typescript
  4. Add: new AwsGuard({ all: "advisory" }); to the index.ts file in the awsguard directory
  5. In your main program's index.ts add:
    new aws.acm.Certificate("cert", {
    domainName: "some-domain.com",
    validationMethod: "DNS"
    });
  6. pulumi preview --policy-pack awsguard

Expected: ACM Certificate is validated by AWSGuard policy pack and is successfully created. Actual: Stack fails and ACM Certificate cannot be created.