botocore icon indicating copy to clipboard operation
botocore copied to clipboard

AWS Config Data Model missing resource types

Open lorengordon opened this issue 4 years ago • 4 comments

Describe the bug I was looking for a definitive set of the resource types supported by AWS Config. However, it seems the API Docs, the Service Docs, and the Data Model are all out of sync. I first checked the API doc and collected the types there:

  • https://docs.aws.amazon.com/config/latest/APIReference/API_ResourceIdentifier.html

Then I found the Service Docs, so I grabbed those too:

  • https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html

Then a coworker said, surely this data is available in botocore, so I checked there also and found:

  • https://github.com/boto/botocore/blob/develop/botocore/data/config/2014-11-12/service-2.json

Steps to reproduce

Here's a hacky little script to collect the types from each so you can compare yourself:

import json
import pkgutil
import re
import urllib.request

import botocore

api_doc = "https://docs.aws.amazon.com/config/latest/APIReference/API_ResourceIdentifier.html"
service_doc = "https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html"

def load_config_types(url):
    with urllib.request.urlopen(url) as response:
        res = response.read().decode("utf-8")
        return re.findall(r"AWS::\w*::\w*", res)

resource_types_api = sorted(load_config_types(api_doc))
resource_types_service = sorted(load_config_types(service_doc))
resource_types_data_model = sorted(json.loads(pkgutil.get_data("botocore", "data/config/2014-11-12/service-2.json"))["shapes"]["ResourceType"]["enum"])
resource_types_all = sorted(set(resource_types_api + resource_types_service + resource_types_data_model))

set(resource_types_all) - set(resource_types_api)
# {'AWS::OpenSearch::Domain', 'AWS::EC2::TransitGateway', 'AWS::ECS::TaskSet', 'AWS::Kinesis::StreamConsumer', 'AWS::Kinesis::Stream'}
set(resource_types_all) - set(resource_types_service)
# {'AWS::WAFv2::IPSet', 'AWS::WAFv2::RegexPatternSet', 'AWS::EC2::RegisteredHAInstance'}
set(resource_types_all) - set(resource_types_data_model)
# {'AWS::ECS::TaskSet', 'AWS::Kinesis::Stream', 'AWS::EC2::TransitGateway', 'AWS::Kinesis::StreamConsumer'}

Expected behavior The data model of the latest botocore should always match the API and service docs.

Additional info I also opened a support ticket: Case ID 9057168721.

I am pretty sure the data models are generated, and this is really an issue for the service team. Just hoping to raise awareness with the issue here. Thanks!

lorengordon avatar Oct 15 '21 22:10 lorengordon

Hi @lorengordon,

Thanks for pointing this out! And thanks for the script— that's a huge time saver.

I double-checked the botocore Config service model and it does appear to be getting updates, but, like you pointed out, it looks like there about four resource types missing. I'll submit an internal ticket to the Config team to see if we can expedite your support request.

stobrien89 avatar Oct 18 '21 18:10 stobrien89

P54004750

stobrien89 avatar Oct 18 '21 18:10 stobrien89

keep in mind aws config has differential api support across the set of resources if purports to support, ie this repo classifies the half that are actually supported by select api https://github.com/awslabs/aws-config-resource-schema

kapilt avatar Oct 19 '21 22:10 kapilt

Hi @kapilt thanks for the update! I'm kinda struggling to understand how to use that info, or the project awslabs/aws-config-resource-schema... Can you clarify what you mean?

When I am using the API PutConfigurationRecorder, the resourceTypes argument accepts a list of resource types. What I'm looking for is a definitive list of accepted values for that argument. The three sources I've found so far (in the issue description) are all incomplete.

Ideally, the source and schema providing the accepted values would also identify whether each resource type was global or regional. That way I could construct the list per region and add global resource types to just a single region, while excluding resource types that I did not want to collect in any region.

lorengordon avatar Oct 19 '21 23:10 lorengordon