1 Answer
- Newest
- Most votes
- Most comments
0
I tested it and it's working for me. I added this in my YAML-formatted CloudFormation template:
TestEuWest1Import: Type: 'AWS::WAFv2::IPSet' DeletionPolicy: 'Delete' Properties: Name: 'test-eu-west-1-import' Scope: 'REGIONAL' IPAddressVersion: 'IPV4' Addresses: ['192.0.2.0/24']
Then I created a CFN change set with the updated template in the template bucket URL https://CLOUDFORMATION-TEMPLATE-BUCKET/cfn-import-ipset.yaml with this CLI command:
aws cloudformation create-change-set \ --stack-name test-ipset --change-set-name ImportIpset \ --change-set-type IMPORT \ --template-url https://CLOUDFORMATION-TEMPLATE-BUCKET/cfn-import-ipset.yaml \ --resources-to-import '[{"ResourceType":"AWS::WAFv2::IPSet","LogicalResourceId":"TestEuWest1Import","ResourceIdentifier":{"Name":"test-eu-west-1-import","Id":"ed838102-f3ec-4076-aa01-d80942b28b4b","Scope":"REGIONAL"}}]'
The minified JSON passed with the --resources-to-import parameter contains the following:
[ { "ResourceType": "AWS::WAFv2::IPSet", "LogicalResourceId": "TestEuWest1Import", "ResourceIdentifier": { "Name": "test-eu-west-1-import", "Id": "ed838102-f3ec-4076-aa01-d80942b28b4b", "Scope": "REGIONAL" } } ]
The "Id" parameter value I obtained with this CLI command: aws wafv2 list-ip-sets --scope REGIONAL, which would've been aws wafv2 list-ip-sets --scope CLOUDFRONT --region us-east-1 if it had been scoped for CloudFront.
Executing the change set imported the IPSet successfully.
Relevant content
asked 4 years ago
asked 2 years ago
asked 2 years ago
asked 2 years ago
- AWS OFFICIALUpdated 8 months ago
