-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from PeyGis/elasticache
Add ECR repo and Elasticache cluster to template asset
- Loading branch information
Showing
9 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
terraform { | ||
required_providers { | ||
port-labs = { | ||
source = "port-labs/port-labs" | ||
version = "0.10.4" | ||
} | ||
} | ||
} | ||
|
||
resource "port-labs_blueprint" "ecr_repository" { | ||
title = "ECR Repository" | ||
icon = "Service" | ||
identifier = "ecr_repository" | ||
|
||
properties { | ||
identifier = "link" | ||
type = "string" | ||
format = "url" | ||
title = "Link" | ||
} | ||
|
||
properties { | ||
identifier = "imageTagMutability" | ||
type = "string" | ||
title = "Image Tag Mutability" | ||
} | ||
|
||
properties { | ||
identifier = "repositoryArn" | ||
type = "string" | ||
title = "Repository ARN" | ||
} | ||
|
||
properties { | ||
identifier = "repositoryUri" | ||
type = "string" | ||
title = "Repository URI" | ||
} | ||
|
||
properties { | ||
identifier = "scanningConfiguration" | ||
type = "object" | ||
title = "Scanning Configuration" | ||
} | ||
|
||
properties { | ||
identifier = "encryptionConfiguration" | ||
type = "object" | ||
title = "Encryption Configuration" | ||
} | ||
|
||
properties { | ||
identifier = "lifecyclePolicy" | ||
type = "object" | ||
title = "Lifecycle Policy" | ||
} | ||
|
||
properties { | ||
identifier = "tags" | ||
type = "array" | ||
title = "Tags" | ||
} | ||
|
||
relations { | ||
target = "region" | ||
title = "Region" | ||
identifier = "region" | ||
many = false | ||
required = false | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"kind":"AWS::ECR::Repository", | ||
"port":{ | ||
"entity":{ | ||
"mappings":[ | ||
{ | ||
"identifier":".RepositoryName", | ||
"title":".RepositoryName", | ||
"blueprint":"ecr_repository", | ||
"properties":{ | ||
"imageTagMutability":".ImageTagMutability", | ||
"scanningConfiguration":".ImageScanningConfiguration", | ||
"repositoryArn":".Arn", | ||
"link":"\"https://console.aws.amazon.com/go/view?arn=\" + .Arn", | ||
"repositoryUri":".RepositoryUri", | ||
"encryptionConfiguration":".EncryptionConfiguration", | ||
"lifecyclePolicy":".LifecyclePolicy", | ||
"tags":".Tags" | ||
}, | ||
"relations":{ | ||
"region":".Arn | split(\":\") | .[3]" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
ECRRepositoryEventRule: | ||
Type: AWS::Events::Rule | ||
Properties: | ||
EventBusName: default | ||
EventPattern: | ||
detail-type: | ||
- AWS API Call via CloudTrail | ||
source: | ||
- aws.ecr | ||
detail: | ||
eventSource: | ||
- ecr.amazonaws.com | ||
eventName: | ||
- prefix: CreateRepository | ||
- prefix: DeleteRepository | ||
- prefix: DeleteLifecyclePolicy | ||
- prefix: PutLifecyclePolicy | ||
Name: port-aws-exporter-sync-ecr-trails | ||
State: ENABLED | ||
Targets: | ||
- Id: PortAWSExporterEventsQueue | ||
Arn: | ||
Fn::ImportValue: | ||
Fn::Sub: ${PortAWSExporterStackName}-EventsQueueARN | ||
InputTransformer: | ||
InputPathsMap: | ||
awsRegion: $.detail.awsRegion | ||
eventName: $.detail.eventName | ||
repositoryName: $.detail.requestParameters.repositoryName | ||
InputTemplate: >- | ||
{ | ||
"resource_type": "AWS::ECR::Repository", | ||
"region": "\"<awsRegion>\"", | ||
"identifier": "\"<repositoryName>\"", | ||
"action": "if \"<eventName>\" | startswith(\"DeleteRepository\") then \"delete\" else \"upsert\" end" | ||
} | ||
ECRRepositoryTagRule: | ||
Type: AWS::Events::Rule | ||
Properties: | ||
EventBusName: default | ||
EventPattern: | ||
source: | ||
- aws.ecr | ||
detail-type: | ||
- AWS API Call via CloudTrail | ||
detail: | ||
eventSource: | ||
- ecr.amazonaws.com | ||
eventName: | ||
- prefix: TagResource | ||
- prefix: UntagResource | ||
Name: port-aws-exporter-sync-ecr-tags-trails | ||
State: ENABLED | ||
Targets: | ||
- Id: PortAWSExporterEventsQueue | ||
Arn: | ||
Fn::ImportValue: | ||
Fn::Sub: ${PortAWSExporterStackName}-EventsQueueARN | ||
InputTransformer: | ||
InputPathsMap: | ||
awsRegion: $.detail.awsRegion | ||
eventName: $.detail.eventName | ||
resourceArn: $.detail.requestParameters.resourceArn | ||
InputTemplate: |- | ||
{ | ||
"resource_type": "AWS::ECR::Repository", | ||
"region": "\"<awsRegion>\"", | ||
"identifier": "\"<resourceArn>\" | split(\"/\") | .[-1]", | ||
"action": "\"upsert\"" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
"ecr:DescribeRepositories", | ||
"ecr:GetLifecyclePolicy", | ||
"ecr:GetRepositoryPolicy", | ||
"ecr:ListTagsForResource" | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
terraform { | ||
required_providers { | ||
port-labs = { | ||
source = "port-labs/port-labs" | ||
version = "0.10.4" | ||
} | ||
} | ||
} | ||
|
||
resource "port-labs_blueprint" "elasticache_cluster" { | ||
title = "Elasticache Cluster" | ||
icon = "AWS" | ||
identifier = "elasticache_cluster" | ||
|
||
properties { | ||
identifier = "status" | ||
type = "string" | ||
title = "Status" | ||
} | ||
|
||
properties { | ||
identifier = "engine" | ||
type = "string" | ||
title = "Engine" | ||
} | ||
|
||
properties { | ||
identifier = "engineVersion" | ||
type = "string" | ||
title = "Engine Version" | ||
} | ||
|
||
properties { | ||
identifier = "preferredAvailabilityZone" | ||
type = "string" | ||
title = "Preferred Availability Zone" | ||
} | ||
|
||
properties { | ||
identifier = "createdDate" | ||
type = "string" | ||
format = "date-time" | ||
title = "Created Date" | ||
} | ||
|
||
properties { | ||
identifier = "arn" | ||
type = "string" | ||
title = "ARN" | ||
} | ||
|
||
properties { | ||
identifier = "transitEncryptionEnabled" | ||
type = "boolean" | ||
title = "Transit Encryption Enabled" | ||
} | ||
|
||
properties { | ||
identifier = "atRestEncryptionEnabled" | ||
type = "boolean" | ||
title = "At Rest Encryption Enabled" | ||
} | ||
|
||
properties { | ||
identifier = "nodeType" | ||
type = "string" | ||
title = "Node Type" | ||
} | ||
|
||
properties { | ||
identifier = "link" | ||
type = "string" | ||
title = "Link" | ||
format = "url" | ||
} | ||
|
||
properties { | ||
identifier = "subnetGroupName" | ||
type = "string" | ||
title = "Subnet Group Name" | ||
} | ||
|
||
properties { | ||
identifier = "numNodes" | ||
type = "number" | ||
title = "Number of Nodes" | ||
} | ||
|
||
properties { | ||
identifier = "securityGroups" | ||
type = "array" | ||
title = "Security Groups" | ||
} | ||
|
||
properties { | ||
identifier = "tags" | ||
type = "array" | ||
title = "Tags" | ||
} | ||
|
||
relations { | ||
target = "region" | ||
title = "Region" | ||
identifier = "region" | ||
many = false | ||
required = false | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"kind":"AWS::ElastiCache::CacheCluster", | ||
"port":{ | ||
"entity":{ | ||
"mappings":[ | ||
{ | ||
"identifier":".CacheClusterId", | ||
"title":".CacheClusterId", | ||
"blueprint":"elasticache_cluster", | ||
"properties":{ | ||
"engine": ".Engine", | ||
"engineVersion": ".EngineVersion", | ||
"preferredAvailabilityZone": ".PreferredAvailabilityZone", | ||
"createdDate": ".CacheClusterCreateTime", | ||
"arn": ".ARN", | ||
"transitEncryptionEnabled": ".TransitEncryptionEnabled", | ||
"atRestEncryptionEnabled": ".AtRestEncryptionEnabled", | ||
"link": "\"https://console.aws.amazon.com/go/view?arn=\" + .ARN", | ||
"nodeType": ".CacheNodeType", | ||
"status": ".CacheClusterStatus", | ||
"tags": ".Tags", | ||
"numNodes": ".NumCacheNodes", | ||
"securityGroups": ".CacheSecurityGroups", | ||
"subnetGroupName": ".CacheSubnetGroupName" | ||
}, | ||
"relations":{ | ||
"region":".ARN | split(\":\") | .[3]" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.