Draft
Conversation
These changes add simple support for defining mocks alongside a template.
Member
Author
|
@AaronFriel @iwahbe @lukehoban I wrote this up to do some local testing. I don't think that we want to take it as-is, but I wanted to capture the idea in a PR. |
Member
Author
|
here's an example of what this looks like in a template: resources:
securityGroup:
type: aws:ec2:SecurityGroup
properties:
ingress:
- protocol: tcp
fromPort: 0
toPort: 0
cidrBlocks:
- 0.0.0.0/0
server:
type: aws:ec2:Instance
properties:
tags:
Name: web-server-www
instanceType: t2.micro
securityGroups:
- ${securityGroup.name}
ami: ${ami}
userData: |
#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &
variables:
ami:
Fn::Invoke:
Function: aws::getAmi
Arguments:
filters:
- name: name
values:
- amzn-ami-hvm-*-x86_64-ebs
owners:
- 137112412989
mostRecent: true
Return: id
outputs:
publicIp: ${server.publicIp}
publicHostName: ${server.publicDns}
mocks:
resources:
securityGroup:
id: securityGroup
state:
name: securityGroup
server:
id: my-server
state:
publicIp: 1.2.3.4
publicDns: my-server.com
calls:
"aws::getAmi":
return:
id: some-ami-id |
Contributor
|
This would be very useful to put behind an env var and also as a helper method for tests. Very clean. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes add simple support for defining mocks alongside a
template.