Commit Graph

270 Commits

Author SHA1 Message Date
Bert Blommers
3e60cdf3eb
Techdebt: Unpin werkzeug (#5569) 2022-10-17 19:06:59 +00:00
Bert Blommers
3d913f8f15
MultiAccount support (#5192) 2022-08-13 09:49:43 +00:00
Sahil Shah
40eefb92d7
Add AWS::AutoScaling::ScheduledAction action cloudformation support (#5289) 2022-07-25 19:37:22 -03:00
szopen321
6b14d01f5d
EC2 - Add ami validation (#5160) 2022-05-26 16:04:36 +00:00
Bert Blommers
5d84eec79e
Enable more TF tests (#5148) 2022-05-19 11:08:02 +00:00
Bert Blommers
d60df32a25
Upgrade flake8 to 4.x (#5066) 2022-04-27 11:58:59 +00:00
Bert Blommers
be52b4d7a2
CF - detect changesets without changes (#5058) 2022-04-24 21:37:14 +00:00
Bert Blommers
10bd677cf2
Admin - enable more Pylint rules (#5037) 2022-04-18 20:44:56 +00:00
Panagiotis Irakleous
3718cde444
fix cloudformation arn account id (#4995) 2022-04-02 17:07:40 +00:00
Bert Blommers
47ce689cb7
ELB/ELBv2 improvements (#4956) 2022-03-21 19:55:19 -01:00
Bert Blommers
382ff2b1a9
Remove more DynamoDB2 references (#4933) 2022-03-11 21:29:16 -01:00
Bert Blommers
29d01c35bc
Update Black + formatting (#4926) 2022-03-10 13:39:59 -01:00
Cristopher Pinzón
c25aae0d9a
Allow "True" in SQS Queue boolean attributes (#4830) 2022-02-07 22:53:25 -01:00
Bert Blommers
aa70ee254d
Remove deprecated decorators + boto dependency (#4378) 2022-01-18 14:18:57 -01:00
Matt Ossman
cf2461a14e
add ap-southeast-3 zone (#4688) 2021-12-14 09:34:35 -01:00
Bert Blommers
5fa932c3cb
CloudFormation - Get/Set stack policy (no parsing) (#4628) 2021-11-24 08:54:38 -01:00
Bert Blommers
b355e0ada4
CloudFormation - verify shorthand Yaml-functions (#4556) 2021-11-10 12:01:55 -01:00
Bert Blommers
6e58dc3f12
CloudFormation - allow updates of unknown resources (#4538) 2021-11-07 15:01:39 -01:00
Bert Blommers
f923d0d1e0
Feature: Custom cloudformation resources (#4512) 2021-11-03 20:00:42 -01:00
Paul Roberts
6c9f959b94
Set the appropriate SNS subject when sending CloudFormation stack events (#4479) 2021-10-27 08:15:51 +00:00
nom3ad
12bd6af540
fix(cloudformation): missing Parameters key in get_template_summary() response (#4466) 2021-10-23 11:40:41 +00:00
Bert Blommers
14a69c7524
Techdebt: Enable pylint rules (#4432) 2021-10-18 19:44:29 +00:00
nom3ad
0953c11b92
feat(cloudformation): support logs resource policy (#4427) 2021-10-18 09:17:31 +00:00
nom3ad
080e7eba84
cloudformation: fix get_template_summary() related error (#4425) 2021-10-18 09:13:27 +00:00
Bert Blommers
dac33becbf
SNS:Topic: Add option to update/delete via CF (#4392) 2021-10-11 21:56:39 +00:00
Bert Blommers
e9a4100324
Rewrite deprecated CloudFormation tests (#3842) 2021-10-04 13:47:40 +00:00
teddylear
8c2d0b0557
feat: Adding validation to Cloudformation to reject same template_body (#4351) 2021-09-28 20:35:46 +00:00
Paul Roberts
65c29e1f5e
Fix CloudFormation create_stack returning stack_id with wrong region (#4302) 2021-09-17 22:45:11 +00:00
Paul Roberts
45b2684eb6
Publish messages to SNS when CloudFormation NotifcationARNs is set (#4295)
Co-authored-by: Paul Roberts <paroberts@guidewire.com>
2021-09-16 09:26:50 +00:00
Bert Blommers
1a42b33781
IAM - Delete Role/InstanceProfile via CloudFormation (#3591) 2021-08-28 11:00:05 +01:00
Timothy Klopotoski
cbbeaff23e
Throw ValidationError on null outputs section (#4221) 2021-08-26 06:01:01 +01:00
Bert Blommers
7acdfe4feb
Introduce Pylint to check for duplicate test method names (#3684) 2021-08-21 16:33:15 +01:00
Timothy Klopotoski
bd5ab53241
Fix bugs. Cloudformation updates are complex! (#4200)
* **Fix bug.** If a cloudformation stack is updated with a new
    parameter, that parameter should be honored. Several unit tests
    had bugs where they were not providing parameters required by the template.
* **Fix bug.** Do not update stack parameters until after deleting removed
    resources, so that any references to removed parameters can be resolved.
* **Fix bug.** Per the API, creation of a change set should not modify
    a stack. The `diff` method, called in the creation of a
    FakeChangeSet, was mutating the resource map which was problematic
2021-08-19 17:36:11 +01:00
Timothy Klopotoski
8743f81e15
CF: Raise ValidationError on bad resource id (#4186) 2021-08-18 18:41:02 +01:00
Kai Xia
9af1a96174 make FakeChangeSet a subclass of BaseModel, not FakeStack.
This fixes #4141, and pave ways for future changes around changeset.

We had subclassed FakeChangeSet from FakeStack, not from BaseModel. This made
us easier to send the response for describe_change_set calls, but when we are
handling the details of change set, the old approach won't work at all.
For example, when we were creating a changeset, we were actually creating a
stack without registering it (self.stacks), and future update onto this stack
is not really possible.

Signed-off-by: Kai Xia <kaix+github@fastmail.com>
2021-08-07 17:02:22 +10:00
Bert Blommers
79f0cc9e9e
Tech debt - remove dead DynamoDB code and add RDS tests (#4136) 2021-08-04 17:24:26 +01:00
Waldemar Hummer
f4f8527955
Merge LocalStack changes into upstream moto (#4082)
* fix OPTIONS requests on non-existing API GW integrations

* add cloudformation models for API Gateway deployments

* bump version

* add backdoor to return CloudWatch metrics

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* bump version

* minor fixes

* fix Number data_type for SQS message attribute

* fix handling of encoding errors

* bump version

* make CF stack queryable before starting to initialize its resources

* bump version

* fix integration_method for API GW method integrations

* fix undefined status in CF FakeStack

* Fix apigateway issues with terraform v0.12.21
* resource_methods -> add handle for "DELETE" method
* integrations -> fix issue that "httpMethod" wasn't included in body request (this value was set as the value from refer method resource)

* bump version

* Fix setting http method for API gateway integrations (#6)

* bump version

* remove duplicate methods

* add storage class to S3 Key when completing multipart upload (#7)

* fix SQS performance issues; bump version

* add pagination to SecretsManager list-secrets (#9)

* fix default parameter groups in RDS

* fix adding S3 metadata headers with names containing dots (#13)

* Updating implementation coverage

* Updating implementation coverage

* add cloudformation models for API Gateway deployments

* Updating implementation coverage

* Updating implementation coverage

* Implemented get-caller-identity returning real data depending on the access key used.

* make CF stack queryable before starting to initialize its resources

* bump version

* remove duplicate methods

* fix adding S3 metadata headers with names containing dots (#13)

* Update amis.json to support EKS AMI mocks (#15)

* fix PascalCase for boolean value in ListMultipartUploads response (#17); fix _get_multi_param to parse nested list/dict query params

* determine non-zero container exit code in Batch API

* support filtering by dimensions in CW get_metric_statistics

* fix storing attributes for ELBv2 Route entities; API GW refactorings for TF tests

* add missing fields for API GW resources

* fix error messages for Route53 (TF-compat)

* various fixes for IAM resources (tf-compat)

* minor fixes for API GW models (tf-compat)

* minor fixes for API GW responses (tf-compat)

* add s3 exception for bucket notification filter rule validation

* change the way RESTErrors generate the response body and content-type header

* fix lint errors and disable "black" syntax enforcement

* remove return type hint in RESTError.get_body

* add RESTError XML template for IAM exceptions

* add support for API GW minimumCompressionSize

* fix casing getting PrivateDnsEnabled API GW attribute

* minor fixes for error responses

* fix escaping special chars for IAM role descriptions (tf-compat)

* minor fixes and tagging support for API GW and ELB v2 (tf-compat)

* Merge branch 'master' into localstack

* add "AlarmRule" attribute to enable support for composite CloudWatch metrics

* fix recursive parsing of complex/nested query params

* bump version

* add API to delete S3 website configurations (#18)

* use dict copy to allow parallelism and avoid concurrent modification exceptions in S3

* fix precondition check for etags in S3 (#19)

* minor fix for user filtering in Cognito

* fix API Gateway error response; avoid returning empty response templates (tf-compat)

* support tags and tracingEnabled attribute for API GW stages

* fix boolean value in S3 encryption response (#20)

* fix connection arn structure

* fix api destination arn structure

* black format

* release 2.0.3.37

* fix s3 exception tests

see botocore/parsers.py:1002 where RequestId is removed from parsed

* remove python 2 from build action

* add test failure annotations in build action

* fix events test arn comparisons

* fix s3 encryption response test

* return default value "0" if EC2 availableIpAddressCount is empty

* fix extracting SecurityGroupIds for EC2 VPC endpoints

* support deleting/updating API Gateway DomainNames

* fix(events): Return empty string instead of null when no pattern is specified in EventPattern (tf-compat) (#22)

* fix logic and revert CF changes to get tests running again (#21)

* add support for EC2 customer gateway API (#25)

* add support for EC2 Transit Gateway APIs (#24)

* feat(logs): add `kmsKeyId` into `LogGroup` entity (#23)

* minor change in ELBv2 logic to fix tests

* feat(events): add APIs to describe and delete CloudWatch Events connections (#26)

* add support for EC2 transit gateway route tables (#27)

* pass transit gateway route table ID in Describe API, minor refactoring (#29)

* add support for EC2 Transit Gateway Routes (#28)

* fix region on ACM certificate import (#31)

* add support for EC2 transit gateway attachments (#30)

* add support for EC2 Transit Gateway VPN attachments (#32)

* fix account ID for logs API

* add support for DeleteOrganization API

* feat(events): store raw filter representation for CloudWatch events patterns (tf-compat) (#36)

* feat(events): add support to describe/update/delete CloudWatch API destinations (#35)

* add Cognito UpdateIdentityPool, CW Logs PutResourcePolicy

* feat(events): add support for tags in EventBus API (#38)

* fix parameter validation for Batch compute environments (tf-compat)

* revert merge conflicts in IMPLEMENTATION_COVERAGE.md

* format code using black

* restore original README; re-enable and fix CloudFormation tests

* restore tests and old logic for CF stack parameters from SSM

* parameterize RequestId/RequestID in response messages and revert related test changes

* undo LocalStack-specific adaptations

* minor fix

* Update CodeCov config to reflect removal of Py2

* undo change related to CW metric filtering; add additional test for CW metric statistics with dimensions

* Terraform - Extend whitelist of running tests

Co-authored-by: acsbendi <acsbendi28@gmail.com>
Co-authored-by: Phan Duong <duongpv@outlook.com>
Co-authored-by: Thomas Rausch <thomas@thrau.at>
Co-authored-by: Macwan Nevil <macnev2013@gmail.com>
Co-authored-by: Dominik Schubert <dominik.schubert91@gmail.com>
Co-authored-by: Gonzalo Saad <saad.gonzalo.ale@gmail.com>
Co-authored-by: Mohit Alonja <monty16597@users.noreply.github.com>
Co-authored-by: Miguel Gagliardo <migag9@gmail.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
2021-07-26 15:21:17 +01:00
Bert Blommers
7693d77333
Remove Py2 support (#3915) 2021-07-26 07:40:39 +01:00
Sahil Shah
70a7a7e0a0
SSM parameters in cloudformation (AWS::SSM::Parameter::) are not recognized and resolved for default values (#4042)
* Add ssm parsing support for cloudformation stacks
2021-06-29 18:28:52 +01:00
Sahil Shah
6977bba3e1
Add capability to update AWS::ElasticLoadBalancingV2(Listener and ListenerRule) resource (#4005)
* Add ssm parsing support for cloudformation stacks

* Start adding unit tests for ssm parameter parsing

* Add tests for code update

* Add tests to parse ssm parameters code

* Fix black lint errors

* Fix bug.

* Need to specify region_name

* region needs to be same

* Use ssm_backends[region] instead of ssm_backend

* StringList -> string

* Linting

* check if servermode tests are on

* Typo

* Added support for ListenerRule. Will remove cruft

* Pushing latest

* Something works

* Put back ripped out code

* Save point. Incase I need more validations

* Revert "Save point. Incase I need more validations"

This reverts commit dac4953335dd9335eddb7a91a63667bc3c17104c.

* Fixed validations and some refactor

* Fix formatting

* Linting

* Cannot refactor if I have to fix all tests

* Remove exceptions for now. Will do in another PR

* Remove validations. Will add in next PR

* Fix broken tests. Almost.:

* Fix all tests. Some sneaky for now.

* Python2 making me write bad code

* OrderedDict.move_to_end() does not work in python2

* Linting

* Add more checks to field in conditions later.

* Unwnated change in FakeListener

* Revert "Unwnated change in FakeListener"

This reverts commit 962c2fdfd76fce999de9feccf1dd1c3ec48c459f.

* Add back default listener rule

* Linting fix

* Fix priority sorting

* Add cloudformation test for edge case

* Add validation for ForwardConfig in Action of ListernRule CF

* use not in

* set the priority template correctly

* Check for boolean in condition

* One more check

* Implement update_from_cloudformation_json for Listener and ListenerRule

* Unwanted spaces

* Linting issues

* Add tests for code coverage

Co-authored-by: Bert Blommers <bblommers@users.noreply.github.com>
2021-06-11 21:56:28 +01:00
Sahil Shah
3f5408c9d0
Adding support for ForwardConfig property in ListernRule in CloudFormation (#3993)
* Add ssm parsing support for cloudformation stacks

* Start adding unit tests for ssm parameter parsing

* Add tests for code update

* Add tests to parse ssm parameters code

* Fix black lint errors

* Fix bug.

* Need to specify region_name

* region needs to be same

* Use ssm_backends[region] instead of ssm_backend

* StringList -> string

* Linting

* check if servermode tests are on

* Typo

* Added support for ListenerRule. Will remove cruft

* Pushing latest

* Something works

* Put back ripped out code

* Save point. Incase I need more validations

* Revert "Save point. Incase I need more validations"

This reverts commit dac4953335dd9335eddb7a91a63667bc3c17104c.

* Fixed validations and some refactor

* Fix formatting

* Linting

* Cannot refactor if I have to fix all tests

* Remove exceptions for now. Will do in another PR

* Remove validations. Will add in next PR

* Fix broken tests. Almost.:

* Fix all tests. Some sneaky for now.

* Python2 making me write bad code

* OrderedDict.move_to_end() does not work in python2

* Linting

* Add more checks to field in conditions later.

* Unwnated change in FakeListener

* Revert "Unwnated change in FakeListener"

This reverts commit 962c2fdfd76fce999de9feccf1dd1c3ec48c459f.

* Add back default listener rule

* Linting fix

* Fix priority sorting

* Add cloudformation test for edge case

* Add validation for ForwardConfig in Action of ListernRule CF

* use not in

* set the priority template correctly

* Check for boolean in condition

* One more check

Co-authored-by: Bert Blommers <bblommers@users.noreply.github.com>
2021-06-09 18:41:18 +01:00
Sahil Shah
b82096ba37
Add support for AWS::ElasticLoadBalancingV2::ListenerRule (#3969)
* Add ssm parsing support for cloudformation stacks

* Start adding unit tests for ssm parameter parsing

* Add tests for code update

* Add tests to parse ssm parameters code

* Fix black lint errors

* Fix bug.

* Need to specify region_name

* region needs to be same

* Use ssm_backends[region] instead of ssm_backend

* StringList -> string

* Linting

* check if servermode tests are on

* Typo

* Added support for ListenerRule. Will remove cruft

* Pushing latest

* Something works

* Put back ripped out code

* Save point. Incase I need more validations

* Revert "Save point. Incase I need more validations"

This reverts commit dac4953335dd9335eddb7a91a63667bc3c17104c.

* Fixed validations and some refactor

* Fix formatting

* Linting

* Cannot refactor if I have to fix all tests

* Remove exceptions for now. Will do in another PR

* Remove validations. Will add in next PR

* Fix broken tests. Almost.:

* Fix all tests. Some sneaky for now.

* Python2 making me write bad code

* OrderedDict.move_to_end() does not work in python2

* Linting

* Add more checks to field in conditions later.

* Unwnated change in FakeListener

* Revert "Unwnated change in FakeListener"

This reverts commit 962c2fdfd76fce999de9feccf1dd1c3ec48c459f.

* Add back default listener rule

* Linting fix

* Fix priority sorting

* Add cloudformation test for edge case

Co-authored-by: Bert Blommers <bblommers@users.noreply.github.com>
2021-06-05 10:04:04 +01:00
Sahil Shah
24fa8f25a1
SSM parameters in cloudformation (AWS::SSM::Parameter::) are not recognized and resolved (#3929)
* Add ssm parsing support for cloudformation stacks

* Start adding unit tests for ssm parameter parsing

* Add tests for code update

* Add tests to parse ssm parameters code

* Fix black lint errors

* Fix bug.

* Need to specify region_name

* region needs to be same

* Use ssm_backends[region] instead of ssm_backend

* StringList -> string

* Linting

* check if servermode tests are on

* Typo

Co-authored-by: Bert Blommers <bblommers@users.noreply.github.com>
2021-05-19 08:30:25 +01:00
David Baumgold
3af87963d1
Py3: use unittest.mock instead of mock (#3481)
* Py3: use unittest.mock instead of mock

* noqa

* oops

* just pull in patch()

* ignore RuntimeError when stopping patch

* ignore RuntimeError from default_session_mock.stop()
2021-04-06 10:22:42 +01:00
Ismael Fernandez Molina
04cbd1fa1a
adding physical_resource_id in SubnetRouteTableAssociation, Route and NatGW classes (#3789)
* adding physical_resource_id in SubnetRouteTableAssociation, Route and NatGW classes

* adding tests

* passing litern at test

* passsing black==19.10b0 as lintern

* passing test to python 2.7
2021-03-20 08:57:53 +00:00
Jakub Musko
c8c6b0bf58
Fix stackset describe/delete. Fix stackset update. (#3713)
* Fix stack set fetching and deleting.

* Also fix stackset update operation to accept previous values.

* Fix linting.

* Rename aliased test.
2021-02-21 09:47:10 +00:00
Jakub Musko
b6d7704b23
Update stackset create operation to correctly return the resource's ID. (#3709)
* Update stackset create operation to correctly return the resource's ID.

* Add test confirming create_stack_set response.
2021-02-18 18:04:12 +00:00
Anton Grübel
0211e9d78d
Add failures output to ecs.describe_services (#3641)
* Add failures output to ecs.describe_services

* Fix autoscaling tests
2021-02-01 12:19:46 +00:00
Brian Pandola
f4b81e69b8
Address pytest warnings (#3629)
* Address `boto` deprecation warnings

This commit eliminates the following warning:

../boto/ec2/connection.py:582:
  PendingDeprecationWarning: The current get_all_instances implementation will be replaced with get_all_reservations.

`boto` isn't likely to ever make good on this warning, but doing the replacement will
declutter the `moto` test output.

* Remove `invoke_lambda` tracebacks from unit test logging

If an exception is encountered, the details are returned in the response payload.
Printing the traceback was just adding noise to the pytest output.

* Use known AMIs in unit tests

This commit eliminates the following warning in the pytest output:

`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`

Known, pre-loaded AMI image ids are used instead of random ids that don't actually
exist in the moto backend.  The integrity of the tests is unaffected by this change.

A test has been added to provide explicit coverage of the PendingDeprecationWarning
raised when an invalid AMI image id is passed to moto.
2021-01-29 11:31:56 +00:00
Brian Pandola
9e1fcac9d4
Use known AMI in internal tests (#3620)
Moto's implementation of autoscaling:CreateLaunchConfiguration is a little too loose,
allowing the ImageId parameter to be omitted and defaulting it to None, which results
in dozens of deprecation warnings:

`PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.`

This commit refactors calls to CreateLaunchConfiguration to explicitly pass in a known
AMI ImageId in order to avoid these warnings.

The integrity of the tests is unaffected by this change.
2021-01-27 19:49:33 +00:00