Skip to content

Commit

Permalink
Merge pull request #52 from oguzhan-yilmaz/elasticache-support
Browse files Browse the repository at this point in the history
Add terraform-import Elasticache support
  • Loading branch information
oguzhan-yilmaz committed Feb 2, 2024
2 parents 0332996 + dc31ef6 commit 4884405
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
78 changes: 78 additions & 0 deletions balcony/custom_tf_import_configs/elasticache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
maintainers:
- name: Oguzhan Yilmaz
import_configurations:
- service: elasticache
resource_node: CacheClusters
operation_name: DescribeCacheClusters
to_resource_type: aws_elasticache_cluster
jmespath_query: '[].CacheClusters[*].CacheClusterId[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: GlobalReplicationGroups
operation_name: DescribeGlobalReplicationGroups
to_resource_type: aws_elasticache_global_replication_group
jmespath_query: '[].GlobalReplicationGroups[*].GlobalReplicationGroupId[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: CacheParameterGroups
operation_name: DescribeCacheParameterGroups
to_resource_type: aws_elasticache_parameter_group
jmespath_query: '[].CacheParameterGroups[*].CacheParameterGroupName[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: ReplicationGroups
operation_name: DescribeReplicationGroups
to_resource_type: aws_elasticache_replication_group
jmespath_query: '[].ReplicationGroups[*].ReplicationGroupId[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: CacheSubnetGroups
operation_name: DescribeCacheSubnetGroups
to_resource_type: aws_elasticache_subnet_group
jmespath_query: '[].CacheSubnetGroups[*].CacheSubnetGroupName[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: Users
operation_name: DescribeUsers
to_resource_type: aws_elasticache_user
jmespath_query: '[].Users[*].UserId[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'

- service: elasticache
resource_node: UserGroups
operation_name: DescribeUserGroups
to_resource_type: aws_elasticache_user_group
jmespath_query: '[].UserGroups[*].UserGroupId[]'
to_resource_name_jinja2_template: '{{ item }}'
id_generator_jinja2_template: '{{ item }}'


- service: elasticache
resource_node: UserGroups
operation_name: DescribeUserGroups
to_resource_type: aws_elasticache_user_group_association
jmespath_query: '[].UserGroups[]'
multiline_output: true
to_resource_name_jinja2_template: "
{% for uid in item.UserIds %}
{{ item.UserGroupId }}_{{ uid }}
{% endfor %}
"
id_generator_jinja2_template: "
{% for uid in item.UserIds %}
{{ item.UserGroupId }},{{ uid }}
{% endfor %}
"


8 changes: 8 additions & 0 deletions docs/terraform-import-support-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
| aws_ecs_cluster | ecs | Clusters |
| aws_ecs_service | ecs | Services |
| aws_ecs_task_definition | ecs | TaskDefinition |
| aws_elasticache_cluster | elasticache | CacheClusters |
| aws_elasticache_parameter_group | elasticache | CacheParameterGroups |
| aws_elasticache_subnet_group | elasticache | CacheSubnetGroups |
| aws_elasticache_global_replication_group | elasticache | GlobalReplicationGroups |
| aws_elasticache_replication_group | elasticache | ReplicationGroups |
| aws_elasticache_user_group | elasticache | UserGroups |
| aws_elasticache_user_group_association | elasticache | UserGroups |
| aws_elasticache_user | elasticache | Users |
| aws_lb_listener_certificate | elbv2 | ListenerCertificates |
| aws_lb_listener | elbv2 | Listeners |
| aws_lb | elbv2 | LoadBalancers |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "balcony"
version = "0.2.3"
version = "0.2.5"
description = "Read any resource in your AWS Account. You can generate terraform code for them, too."
authors = ["Oguzhan Yilmaz <oguzhanylmz271@gmail.com>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 4884405

Please sign in to comment.