Skip to content

adding tgw-attachment resource #48

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions aws-ec2-transitgatewayattachment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# macOS
.DS_Store
._*
# Maven outputs
.classpath
# IntelliJ
*.iml
.idea
out.java
out/
.settings
.project
# auto-generated files
target/
# our logs
rpdk.log
# contains credentials
sam-tests/
build.gradle

Choose a reason for hiding this comment

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

remove build.gradle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

.idea/
/.integration-tests/
.integration-tests/
.sam-test/
/.sam-test/
sam-test/
/sam-test/
24 changes: 24 additions & 0 deletions aws-ec2-transitgatewayattachment/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"artifact_type": "RESOURCE",
"typeName": "AWS::EC2::TransitGatewayAttachment",
"language": "java",
"runtime": "java8",
"entrypoint": "com.aws.ec2.transitgatewayattachment.HandlerWrapper::handleRequest",
"testEntrypoint": "software.amazon.mwaa.environment.HandlerWrapper::handleRequest",
"settings": {
"version": false,
"subparser_name": null,
"verbose": 0,
"force": false,
"type_name": "Aws::EC2::TransitGatewayAttachment",
"namespace": [
"com",
"aws",
"ec2",
"transitgatewayattachment"
],
"codegen_template_path": "default",
"protocolVersion": "2.0.0"
},
"executableEntrypoint": "com.aws.ec2.transitgatewayattachment.HandlerWrapperExecutable"
}
12 changes: 12 additions & 0 deletions aws-ec2-transitgatewayattachment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Aws::EC2::TransitGatewayAttachment

Congratulations on starting development! Next steps:

1. Write the JSON schema describing your resource, `aws-ec2-transitgatewayattachment.json`
1. Implement your resource handlers.

The RPDK will automatically generate the correct resource model from the schema whenever the project is built via Maven. You can also do this manually with the following command: `cfn generate`.

> Please don't modify files under `target/generated-sources/rpdk`, as they will be automatically overwritten.

The code uses [Lombok](https://projectlombok.org/), and [you may have to install IDE integrations](https://projectlombok.org/setup/overview) to enable auto-complete for Lombok-annotated classes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"typeName": "AWS::EC2::TransitGatewayAttachment",
"description": "Resource Type definition for AWS::EC2::TransitGatewayAttachment",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-transitgateway",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"TransitGatewayId": {
"type": "string"
},
"VpcId": {
"type": "string"
},
"SubnetIds": {
"type": "array",
"uniqueItems": false,
"items": {
"type": "string"
}
},

Choose a reason for hiding this comment

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

is this AWS::EC2::TransitGatewayAttachment only for Vpc attachment or will also include VPN/Peering/DirectConnect attachment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only for VPCAttacment. Current Self-service resource is also for VPCAttachment but exists with the name AWS::EC2::TransitGatewayAttachment whereas the rest of them have their own individual names

Choose a reason for hiding this comment

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

we should probably add in TransitGatewayAttachmentResourceType

Copy link

@LaylaGou LaylaGou Feb 26, 2021

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

if only for VPCattachment, should we just name it to be AWS::EC2::TransitGatewayVpcAttachment

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 missing parameters are for 1:1 mapping with original

"Tags": {
"type": "array",
"uniqueItems": false,
"items": {
"$ref": "#/definitions/Tag"
}
}
},
"definitions": {
"Tag": {
"type": "object",
"additionalProperties": false,
"properties": {
"Key": {
"type": "string"
},
"Value": {
"type": "string"
}
},
"required": [
"Value",
"Key"
]
}
},
"required": [
"VpcId",
"SubnetIds",
"TransitGatewayId"
],
"createOnlyProperties": [
"/properties/Tags",
"/properties/TransitGatewayId",
"/properties/VpcId",
"/properties/SubnetIds"
],
"readOnlyProperties": [
"/properties/Id"
],
"primaryIdentifier": [
"/properties/Id"
],
"handlers": {
"create": {
"permissions": [
"ec2:CreateTransitGatewayVpcAttachment",
"ec2:CreateTags"
]
},
"read": {
"permissions": [
"ec2:DescribeTransitGatewayAttachments",
"ec2:DescribeTransitGatewayVpcAttachments",
"ec2:DescribeTags"
]
},
"delete": {
"permissions": [
"ec2:DeleteTransitGatewayVpcAttachment",
"ec2:DeleteTags"
]
},
"list": {
"permissions": [
"ec2:DescribeTransitGatewayAttachments",
"ec2:DescribeTransitGatewayVpcAttachments",
"ec2:DescribeTags"
]
}
}
}
84 changes: 84 additions & 0 deletions aws-ec2-transitgatewayattachment/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# AWS::EC2::TransitGatewayAttachment

Resource Type definition for AWS::EC2::TransitGatewayAttachment

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"Type" : "AWS::EC2::TransitGatewayAttachment",
"Properties" : {
"<a href="#transitgatewayid" title="TransitGatewayId">TransitGatewayId</a>" : <i>String</i>,
"<a href="#vpcid" title="VpcId">VpcId</a>" : <i>String</i>,
"<a href="#subnetids" title="SubnetIds">SubnetIds</a>" : <i>[ String, ... ]</i>,
"<a href="#tags" title="Tags">Tags</a>" : <i>[ <a href="tag.md">Tag</a>, ... ]</i>
}
}
</pre>

### YAML

<pre>
Type: AWS::EC2::TransitGatewayAttachment
Properties:
<a href="#transitgatewayid" title="TransitGatewayId">TransitGatewayId</a>: <i>String</i>
<a href="#vpcid" title="VpcId">VpcId</a>: <i>String</i>
<a href="#subnetids" title="SubnetIds">SubnetIds</a>: <i>
- String</i>
<a href="#tags" title="Tags">Tags</a>: <i>
- <a href="tag.md">Tag</a></i>
</pre>

## Properties

#### TransitGatewayId

_Required_: Yes

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### VpcId

_Required_: Yes

_Type_: String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### SubnetIds

_Required_: Yes

_Type_: List of String

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

#### Tags

_Required_: No

_Type_: List of <a href="tag.md">Tag</a>

_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return Values

### Ref

When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the Id.

### Fn::GetAtt

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).

#### Id

Returns the <code>Id</code> value.
39 changes: 39 additions & 0 deletions aws-ec2-transitgatewayattachment/docs/tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# AWS::EC2::TransitGatewayAttachment Tag

## Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

### JSON

<pre>
{
"<a href="#key" title="Key">Key</a>" : <i>String</i>,
"<a href="#value" title="Value">Value</a>" : <i>String</i>
}
</pre>

### YAML

<pre>
<a href="#key" title="Key">Key</a>: <i>String</i>
<a href="#value" title="Value">Value</a>: <i>String</i>
</pre>

## Properties

#### Key

_Required_: Yes

_Type_: String

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

#### Value

_Required_: Yes

_Type_: String

_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
13 changes: 13 additions & 0 deletions aws-ec2-transitgatewayattachment/inputs/inputs_1_create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"TransitGatewayId": "tgw-06d4b2a0e616906f5",
"VpcId": "vpc-0b6fefef4e752f0fd",
"SubnetIds": [
"subnet-0a00435ae85165f31"
],
"Tags": [
{
"Key": "key1",
"Value": "value1"
}
]
}
15 changes: 15 additions & 0 deletions aws-ec2-transitgatewayattachment/inputs/inputs_1_invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Id": "tgw-attach-09017663fea56c134",
"TransitGatewayId": "tgw-02c783c4653c2bdad",
"VpcId": "vpc-0e32b4e0c1ca43f43",
"SubnetIds": [
"subnet-0d2d2e34a920cd263",
"subnet-0c1dcbe37e3db157b"
],
"Tags": [
{
"Key": "key1",
"Value": "value1"
}
]
}
1 change: 1 addition & 0 deletions aws-ec2-transitgatewayattachment/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lombok.addLombokGeneratedAnnotation = true
Loading