Skip to content

Commit

Permalink
Add deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
mweagle committed Oct 9, 2021
1 parent 00aa242 commit 0a35d7d
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# THIS REPO IS NO LONGER SUPPORTED

Please upgrade to [goformation](https://github.com/awslabs/goformation) which has a larger community and is kept more current with Resource Definition releases.

---

[![Build Status](https://travis-ci.org/crewjam/go-cloudformation.svg?branch=master)](https://travis-ci.org/crewjam/go-cloudformation) [![](https://godoc.org/github.com/crewjam/go-cloudformation?status.png)](https://godoc.org/github.com/crewjam/go-cloudformation)

This package provides a schema and related functions that allow you to parse and serialize CloudFormation templates in golang. The package places an emphasis on type-safety so that the templates it produces are (slightly) more likely to be correct, and maybe you can avoid endless cycles of `UPDATE_ROLLBACK_IN_PROGRESS`.
Expand All @@ -7,7 +13,7 @@ Parsing example:
```go
t := Template{}
json.NewDecoder(os.Stdin).Decode(&t)
fmt.Printf("DNS name: %s\n", t.Parameters["DnsName"].Default)
fmt.Printf("DNS name: %s\n", t.Parameters["DnsName"].Default)
```

Producing Example:
Expand Down Expand Up @@ -41,28 +47,28 @@ problems, please submit a bug (or better yet, a pull request).
## Object Types

Top level objects in CloudFormation are called resources. They have
names like *AWS::S3::Bucket* and appear as values in the "Resources"
names like _AWS::S3::Bucket_ and appear as values in the "Resources"
mapping. We remove the punctuation and redundant words from the name
to derive a golang structure name like *S3Bucket*.
to derive a golang structure name like _S3Bucket_.

There are other non-resource structs that are refered to by resources or other non-resource structs. These objects have names with
spaces in them, like "Amazon S3 Versioning Configuration". To derive a golang
type name the non-letter characters and redundant words are removed to get
*S3VersioningConfiguration*.
_S3VersioningConfiguration_.

## Type System

CloudFormation uses three scalar types: *string*, *int* and *bool*. When
CloudFormation uses three scalar types: _string_, _int_ and _bool_. When
they appear as properties we represent them as `*StringExpr`, `*IntegerExpr`,
and `*BoolExpr` respectively.
and `*BoolExpr` respectively.

```go
type StringExpr struct {
Func StringFunc
Literal string
}

// StringFunc is an interface provided by objects that represent
// StringFunc is an interface provided by objects that represent
// CloudFormation functions that can return a string value.
type StringFunc interface {
Func
Expand All @@ -73,7 +79,7 @@ type StringFunc interface {
These types reflect that fact that a scalar type could be a literal value (`"us-east-1"`) or a JSON dictionary representing a "function call" (`{"Ref": "AWS::Region"}`).

Another vagary of the CloudFormation language is that in cases where
a list of objects is expected, a single object can provided. For example,
a list of objects is expected, a single object can provided. For example,
`AutoScalingLaunchConfiguration` has a property `BlockDeviceMappings` which is a list of `AutoScalingBlockDeviceMapping`. Valid CloudFormation documents can specify a single `AutoScalingBlockDeviceMapping` rather than a list. To model this, we use a custom type `AutoScalingBlockDeviceMappingList` which is just a `[]AutoScalingBlockDeviceMapping` with extra functions attached so that a single items an be unserialized. JSON produced by this package will always be in the list-of-objects form, rather than the single object form.

## Known Issues
Expand All @@ -82,8 +88,8 @@ The `cloudformation.String("foo")` is cumbersome for scalar literals. On balance

There are some types that are not parsed fully and appear as `interface{}`.

I worked through public template files I could find, making sure the
I worked through public template files I could find, making sure the
library could accurately serialize and unserialize them. In this process
I discovered some of the idiosyncracies described. This package works for our purposes, but I wouldn't be surprised if there are more idiosyncracies hidden in parts of CloudFormation we are not using.
I discovered some of the idiosyncracies described. This package works for our purposes, but I wouldn't be surprised if there are more idiosyncracies hidden in parts of CloudFormation we are not using.

Feedback, bug reports and pull requests are gratefully accepted.

0 comments on commit 0a35d7d

Please sign in to comment.