Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intriniscs Design Doc #1260

Merged
merged 9 commits into from
Aug 9, 2019
Merged

Conversation

viksrivat
Copy link
Contributor

Issue #, if available:

Description of changes:

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@viksrivat viksrivat changed the title Initial Design Intriniscs Design Doc Jul 9, 2019
@viksrivat viksrivat mentioned this pull request Jul 9, 2019
6 tasks
designs/intrinsics_design.md Outdated Show resolved Hide resolved
designs/intrinsics_design.md Outdated Show resolved Hide resolved
designs/intrinsics_design.md Outdated Show resolved Hide resolved
designs/intrinsics_design.md Outdated Show resolved Hide resolved
designs/intrinsics_design.md Outdated Show resolved Hide resolved

### AWS::AccountId

This property will be resolved by running an aws command to figure out the configuration. If there is an error, a randomly such as non-authenticated, a randomly generated string will take its place.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? We have a default value already, why are we reaching out to the cloud for this?


### AWS::StackId

Currently, there is no real way to figure this one out. It will be a randomly generated String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static to remain consistent with what we do now. Also we should just state here what the static values are.

You should do a pass through all of these Pseudo Parameters and apply this feedback to each.


## Implementing the Code

This can be seperated into a Intrinsics resolver and a SymbolResolver.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an Intrinsics resolver is but should define what a SymbolResolver is and what it does.

designs/intrinsics_design.md Outdated Show resolved Hide resolved

## Integration into SAM-CLI

This can be very easily plugged into the current SAM-CLI code. This needs to be run after the SamBaseTranslator runs in the ApiProvider. This will go through every property and check if it requires intrinsic resolution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SamBaseTranslator runs in any provider not just the ApiProvider.

Copy link
Contributor Author

@viksrivat viksrivat Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was talking about how it can be integrated into the current codebase and where this can be added into the ApiProvider

@jfuss jfuss self-assigned this Jul 15, 2019
* Customers can use tools such as AWS CDK to generate a template. The templates will have intrinsic properties. The customer can create their AWS CDK project with `cdk init app` and then generate their CloudFormation code using `cdk synth.`They can input their CloudFormation code to test it locally using the SAM CLI command.
* Customers can author CloudFormation resources and test them locally by inputting their templates into sam local start-api.

Once the user has their CloudFormation code, they will be running `sam local start-api --template /path/to/template.yaml`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment above still holds. This looks like it was from your other design and not sure how it relates to the intrinsic support.


This intrinsic function is very similar to the Fn::And function, but will check that at least one of the items in the last returns a truthy value.

## Pseudo Parameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add what each of the Pseudo Parameters resolve to?

}
```

* common_attribute_resolver: resolves common attributes that will be true across all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used for helping resolve Fn::GetAtt for all the 'common' attributes a resource could typically have?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

```


First pseudo types are checked. If item is present in the logical_id_translator it is returned. Otherwise, it falls back to the default_pseudo_resolver. Then the default_type_resolver is checked, which has common attributes and functions for each types. Then the common_attribute_resolver is run, which has functions that are common for each attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this is for Pseudo Parameters? Pseudo parameters are all predefined. Seems like a lot of extra work that isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraph might need to be clarified. The paragraph describes the flow of logic for resolving symbol table attributes.

processed_template[processed_key] = processed_resource
```

If there is an error with the resource, the item will be ignored and processed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by error with the resource? Without understanding what you mean, it's hard to tell if this really should just ignore or bubble up the error to the customer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to not break any workflows for unresolved symbol table or reference errors. Currently, in SAM these properties are ignored and wouldn't cause any errors, so by ignoring the errors we are using the same functionality. This is true for refs that exist to cloud instances. To ignore the error, we just copy the resource as is.
I will update this in the description.

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jfuss jfuss added the stage/accepted Accepted and will be fixed label Aug 7, 2019
@jfuss jfuss merged commit 2f96a9a into aws:develop Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/accepted Accepted and will be fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants