moto icon indicating copy to clipboard operation
moto copied to clipboard

fix(add owner to service): set self.current_account as VPC Service Endpoint Owner

Open MrCloudSec opened this issue 3 years ago • 2 comments

Regarding https://github.com/spulec/moto/issues/5605 since the owner in VPC Service Endpoints are always empty, set self.current_account as VPC Service Endpoint Owner.

MrCloudSec avatar Oct 26 '22 11:10 MrCloudSec

Codecov Report

Merging #5606 (de4f043) into master (dc368fb) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #5606   +/-   ##
=======================================
  Coverage   96.20%   96.20%           
=======================================
  Files         742      742           
  Lines       72631    72631           
=======================================
  Hits        69872    69872           
  Misses       2759     2759           
Flag Coverage Δ
servertests 36.91% <0.00%> (+<0.01%) :arrow_up:
unittests 96.13% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
moto/ec2/responses/vpcs.py 98.71% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Oct 26 '22 20:10 codecov-commenter

The default services will always have owner=amazon, so this solution is not correct. To verify this, see the output for the cassandra service:

aws ec2 describe-vpc-endpoint-services --filters '[{"Name":"service-name","Values":["com.amazonaws.us-east-1.cassandra"]}]'

From the issue you opened: So, when I use the describe_vpc_endpoint_services function, the created service does not show any owner and I expect to be the mocked account id. As far as I can tell, our describe--endpoint doesn't yet return user-created (non-default) services? From the docs:

[X] describe_vpc_endpoint_services 
Return info on services to which you can create a VPC endpoint.

    Currently only the default endpoing services are returned.

http://docs.getmoto.org/en/latest/docs/services/ec2.html

So we would have to implement that first, to actually return user-created configurations, and then we can change the Owner-field to be either amazon or the account ID.

bblommers avatar Oct 26 '22 22:10 bblommers