AWSTemplateFormatVersion: "2010-09-09" Description: This template describes an example resource type for an AWS::EC2::VPC resource lookup operation, and an IAM role assumed by CloudFormation to perform resource lookup operations on your behalf. Parameters: Env: Description: Name of the environment you plan to use. Type: String AllowedValues: - dev - alpha - beta - prod Default: beta JmesPathQuery: Description: Specify the query, in JMESPath format, that you wish to run to filter results. Type: String Default: Tags[?Key == 'Owner' && Value == 'contract-test-only-test-team-beta'] MinLength: 1 LookupSerialNumber: Description: Optional, numeric integer value (such as `1`, `2`), that you can specify to induce a new search on e.g., stack updates without modifying the value for `JmesPathQuery`. Specify a value that is different from the previous one to induce the update; note that either adding this property to the resource if not present before an update, or removing it if previously added to the resource, will yield the same effect of changing the property value and will induce an update. Type: String Default: "1" AllowedPattern: ^[0-9]*$ ResourceModel: Description: 'The model of the resource you''re using: this additional information is needed if you''re using a resource shown here: https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-list.html#resource-operations-list-containers .' Type: String Default: "" AllowedPattern: ^[\s\S]*$ TypeName: Description: Specify the type name you wish to use for the lookup operation. Type: String Default: AWS::EC2::VPC AllowedPattern: ^[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}$ Conditions: ResourceModelEmpty: !Equals - !Ref 'ResourceModel' - "" Resources: ResourceLookup: Type: AwsCommunity::Resource::Lookup DependsOn: TestVpc Properties: JmesPathQuery: !Ref 'JmesPathQuery' LookupSerialNumber: !Ref 'LookupSerialNumber' ResourceLookupRoleArn: !GetAtt ResourceLookupRole.Arn ResourceModel: !If - ResourceModelEmpty - !Ref 'AWS::NoValue' - !Ref 'ResourceModel' Tags: AppName: TestOnlyApp Env: !Ref 'Env' Name: TestOnly TypeName: !Ref 'TypeName' ResourceLookupRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: cloudformation.amazonaws.com Version: "2012-10-17" ManagedPolicyArns: - !Sub 'arn:${AWS::Partition}:iam::aws:policy/ReadOnlyAccess' Path: / RoleName: !Sub 'awscommunity-resource-lookup-integ-${Env}-${AWS::Region}' Tags: - Key: Name Value: AwsCommunityResourceLookup-LookupRole - Key: AppName Value: AwsCommunityResourceLookup - Key: Env Value: !Ref 'Env' TestVpc: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0/16 EnableDnsHostnames: true EnableDnsSupport: true Tags: - Key: Name Value: TestOnly - Key: AppName Value: TestOnlyApp - Key: Env Value: !Ref 'Env' - Key: Owner Value: !Sub 'contract-test-only-test-team-${Env}' Outputs: ResourceIdentifier: Description: The resource identifier result of the lookup operation. Value: !GetAtt ResourceLookup.ResourceIdentifier ResourceLookupId: Description: The ID of the resource lookup operation. Value: !Ref 'ResourceLookup' ResourceProperties: Description: The properties of the resource you looked up. Value: !GetAtt ResourceLookup.ResourceProperties