Skip to content

Commit

Permalink
Adds support for Elasticache Parameter Groups (for redis)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSeptimus-Klotho committed May 2, 2024
1 parent d99d77c commit b60231d
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/infra/iac/templates/aws/elasticache_cluster/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface Args {
SecurityGroups: aws.ec2.SecurityGroup[]
NodeType: string
NumCacheNodes: number
ParameterGroupName?: string
Tags: ModelCaseWrapper<Record<string, string>>
}

Expand All @@ -17,6 +18,9 @@ function create(args: Args): aws.elasticache.Cluster {
engine: args.Engine,
nodeType: args.NodeType,
numCacheNodes: args.NumCacheNodes,
//TMPL {{- if .ParameterGroupName }}
parameterGroupName: args.ParameterGroupName,
//TMPL {{- end }}
logDeliveryConfigurations: [
{
destination: args.CloudwatchGroup.name,
Expand Down
31 changes: 31 additions & 0 deletions pkg/infra/iac/templates/aws/elasticache_parameter_group/factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as aws from '@pulumi/aws'
import { ModelCaseWrapper } from '../../wrappers'

interface Args {
Name: string
Description: string
Family: string
Parameters: Record<string, string>
Tags: ModelCaseWrapper<Record<string, string>>
}

function create(args: Args): aws.elasticache.SubnetGroup {
return new aws.elasticache.ParameterGroup(args.Name, {
name: args.Name,
family: args.Family,
description: args.Description,
//TMPL {{- if .Parameters }}
parameters: args.Parameters,
//TMPL {{- end }}
//TMPL {{- if .Tags }}
tags: args.Tags,
//TMPL {{- end }}
})
}

function properties(object: aws.elasticache.ParameterGroup, args: Args) {
return {
Arn: object.arn,
Name: object.name,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "elasticache_parameter_group",
"dependencies": {
"@pulumi/aws": "^5.37.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source: aws:elasticache_cluster
target: aws:elasticache_parameter_group
9 changes: 9 additions & 0 deletions pkg/templates/aws/resources/elasticache_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ properties:
type: int
default_value: 1
description: The number of cache nodes that the cache cluster should have.
ParameterGroupName:
type: string
description: The name of the parameter group associated with the cluster.
operational_rule:
step:
direction: downstream
resources:
- aws:elasticache_parameter_group
use_property_ref: Name
aws:tags:
type: model
Port:
Expand Down
45 changes: 45 additions & 0 deletions pkg/templates/aws/resources/elasticache_parameter_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
qualified_type_name: aws:elasticache_parameter_group
display_name: ElastiCache Parameter Group

properties:
Family:
type: string
description: The family of the parameter group corresponding to an engine version.
# TODO: make version configurable on elasticache clusters and determine the family based on the version
default_value: "redis7"
required: true
allowed_values:
- redis4.0
- redis5.0
- redis6.x
- redis7
Description:
type: string
Parameters:
type: list
properties:
Name:
type: string
description: The name of the ElastiCache parameter.
Value:
type: string
description: The value of the ElastiCache parameter.
aws:tags:
type: model
Arn:
type: string
description: The Amazon Resource Name (ARN) of the parameter group.
configuration_disabled: true
deploy_time: true
required: true

delete_context:
requires_no_upstream: true
views:
dataflow: small

deployment_permissions:
deploy:
[
'elasticache:*ParameterGroup',
]

0 comments on commit b60231d

Please sign in to comment.