Refactor terraform. Automatically.

Overview

Logo

Manage Terraform scripts. Automatically.

ci Apache 2.0 Maven Central

What is this?

This project implements a Rewrite module that performs common tasks when managing Terraform scripts.

Comments
  • HCL2, migration type information on variables of map or list

    HCL2, migration type information on variables of map or list

    Change type information on variables from "map" to become "map(string)" on all equivalent collection types.

    That is: map -> map(string) list -> list(string) ((?) set -> set(string) unsure of type set)

    If the upgrade0.12 terraform cli command is used as reference, we can just assume all upgraded types will become X(string). As per https://github.com/hashicorp/terraform/blob/ffe5f7c4e60b8d759b1251ce81a2cb44c7190b8f/configs/configupgrade/upgrade_native.go#L115-L129

    opened by aegershman 1
  • HCL2, references to list(

    HCL2, references to list("") should use bracket notation [""]

    Changing type information referencing vpc_id = "${element(concat(aws_vpc.this.*.id, list("")), 0)}" to vpc_id = element(concat(aws_vpc.this.*.id, [""]), 0) -- note the change of list("") to [""]

    opened by aegershman 1
  • Upgrade to tf0.12 from tf0.11

    Upgrade to tf0.12 from tf0.11

    Work in progress, using this issue as a placeholder.

    • https://www.terraform.io/upgrade-guides/0-12.html

    Note, many of these examples come from running terraform 0.12upgrade -yes -force on [email protected]

    Things to be done:

    • Be able to determine if in variable, output, locals, data, etc, separately from one another
      • partially, https://github.com/openrewrite/rewrite-terraform/issues/3
    • https://github.com/openrewrite/rewrite-terraform/issues/12
      • Bonus, maybe: ChangeVariableName. The thing that's unnerving about this is that often a variable name change will involve destroying/recreating a resource of some sort. But, that's just off my memory. Not sure how true that is.
    • https://github.com/openrewrite/rewrite-terraform/issues/5
    • https://github.com/openrewrite/rewrite-terraform/issues/6
    • Possibly just a bonus: ability to format using new 0.12 format rules
    • https://github.com/openrewrite/rewrite-terraform/issues/7
    • Handling of index addressing, e.g. vpc_id = "${aws_vpc.this.id}" becomes vpc_id = aws_vpc.this[0].id
    • Possibly just a bonus: ingress = "${var.default_network_acl_ingress}" changing to a dynamic block, e.g. dynamic "ingress" {...
    • https://github.com/openrewrite/rewrite-terraform/issues/4
    • https://github.com/openrewrite/rewrite-terraform/issues/8
    • Removal of unnecessary parenthesis, such as nat_gateway_ips = "${split(",", (var.reuse_nat_ips ? join(",", var.external_nat_ip_ids) : join(",", aws_eip.nat.*.id)))}" -> nat_gateway_ips = split(",",var.reuse_nat_ips ? join(",", var.external_nat_ip_ids) : join(",", aws_eip.nat.*.id))
    • https://github.com/openrewrite/rewrite-terraform/issues/9

    For helpful cross-reference, see:

    • https://github.com/hashicorp/terraform/tree/v0.12.31/configs/configupgrade
    • terraform vpc module upgrade PR: https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/265/files
    wontfix 
    opened by aegershman 1
  • chore(ci): bump styfle/cancel-workflow-action from 0.8.0 to 0.9.1

    chore(ci): bump styfle/cancel-workflow-action from 0.8.0 to 0.9.1

    Bumps styfle/cancel-workflow-action from 0.8.0 to 0.9.1.

    Release notes

    Sourced from styfle/cancel-workflow-action's releases.

    0.9.1

    Patches

    • Fix: cancelling jobs from different repos where two branches have the same name: #105
    • Fix: use getBooleanInput instead of getInput: #92
    • Chore: add permissions configuration in the README.md: #96
    • Chore: add prettier config, format file, add lint workflow: #63
    • Chore: create dependabot.yml: #68
    • Bump typescript from 4.1.5 to 4.2.4: #71
    • Bump actions/setup-node requirement to v2.1.5: #69
    • Bump @​vercel/ncc to 0.28.3: #73
    • Bump @​actions/core from 1.2.6 to 1.2.7: #74
    • Bump @​vercel/ncc from 0.28.3 to 0.28.5: #81
    • Bump @​actions/core from 1.2.7 to 1.3.0: #90
    • Bump prettier from 2.2.1 to 2.3.0: #85
    • Bump @​vercel/ncc from 0.28.5 to 0.28.6: #95
    • Bump typescript from 4.2.4 to 4.3.2: #94
    • Bump prettier from 2.3.0 to 2.3.1: #97
    • Bump typescript from 4.3.2 to 4.3.4: #99
    • Bump prettier from 2.3.1 to 2.3.2: #100
    • Bump typescript from 4.3.4 to 4.3.5: #101
    • Bump husky from 6.0.0 to 7.0.0: #102
    • Bump husky from 7.0.0 to 7.0.1: #103

    Credits

    Huge thanks to @​mikehardy, @​MichaelDeBoey, @​Warashi, @​adrienbernede, and @​spaceface777 for helping!

    0.9.0

    Minor Changes

    • Add all_but_latest flag - cancel all workflows but the latest: #35
    • Cleanup all_but_latest: #67

    Credits

    Huge thanks to @​thomwiggers for helping!

    Commits
    • a40b884 0.9.1
    • a66ae1f fix cancelling jobs from different repos where two branches have the same nam...
    • b54f1a5 Bump husky from 7.0.0 to 7.0.1 (#103)
    • cc6225c Bump husky from 6.0.0 to 7.0.0 (#102)
    • c94109d Bump typescript from 4.3.4 to 4.3.5 (#101)
    • fc3581b Bump prettier from 2.3.1 to 2.3.2 (#100)
    • 6f9f8b4 Bump typescript from 4.3.2 to 4.3.4 (#99)
    • 6135c0f Bump prettier from 2.3.0 to 2.3.1 (#97)
    • 531a036 chore: add permissions configuration in the README.md (#96)
    • 1f10757 Bump typescript from 4.2.4 to 4.3.2 (#94)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Include more expected changes content, more UpgradeExpression

    Include more expected changes content, more UpgradeExpression

    Scooting content along. See individual commit lines. Part of https://github.com/openrewrite/rewrite-terraform/issues/1

    Includes content addressing

    • https://github.com/openrewrite/rewrite-terraform/issues/4
    • https://github.com/openrewrite/rewrite-terraform/issues/6
    • https://github.com/openrewrite/rewrite-terraform/issues/7
    • https://github.com/openrewrite/rewrite-terraform/issues/8
    enhancement 
    opened by aegershman 0
  • TF012; Normalize number literals to decimals

    TF012; Normalize number literals to decimals

    As per https://github.com/hashicorp/terraform/commit/26c1e40ad775297cc89b32794508f4d596615d5a

    before:

    locals {
      decimal_int          = 1
      decimal_float        = 1.5
      decimal_float_tricky = 0.1
      hex_int              = 0xff
      octal_int            = 0777
    }
    

    after:

    locals {
      decimal_int          = 1
      decimal_float        = 1.5
      decimal_float_tricky = 0.1
      hex_int              = 255
      octal_int            = 511
    }
    
    wontfix 
    opened by aegershman 0
  • TF012; search using FindInputVariable + ability to identify newly-reserved variable names

    TF012; search using FindInputVariable + ability to identify newly-reserved variable names

    Similar to FindResource, this requires FindVariable:

    https://www.terraform.io/upgrade-guides/0-12.html#reserved-variable-names

    In preparation for new features planned for future releases, Terraform 0.12 reserves some additional names that can no longer be used as input variable names for modules. These reserved names are:

    count
    depends_on
    for_each
    lifecycle
    providers
    source
    

    When any of these names is used as the label of a variable block, Terraform will now generate the following error:

    Error: Invalid variable name

    on reserved-variable-names.tf line 2, in variable "count": 2: variable "count" {

    The variable name "count" is reserved due to its special meaning inside module blocks.

    good first issue wontfix 
    opened by aegershman 0
  • Use updated variable type syntax [#5]

    Use updated variable type syntax [#5]

    Continuing to refine structure, etc.

    Part of https://github.com/openrewrite/rewrite-terraform/issues/5 Part of https://github.com/openrewrite/rewrite-terraform/issues/1

    opened by aegershman 0
  • Basic remove curly braces from templates to migrate to expressions as a first-class language feature [#6]

    Basic remove curly braces from templates to migrate to expressions as a first-class language feature [#6]

    Starts the ball rolling. Putting out scaffolding.

    Part of https://github.com/openrewrite/rewrite-terraform/issues/1 Part of https://github.com/openrewrite/rewrite-terraform/issues/6

    enhancement 
    opened by aegershman 0
  • HCL2, replacement of `!` for

    HCL2, replacement of `!` for "false" with literal false keyword

    Replacement of ! for "false" with false, e.g. count = "${var.create_vpc && (var.enable_nat_gateway && ! var.reuse_nat_ips) ? local.nat_gateway_count : 0}" becomes count = var.create_vpc && var.enable_nat_gateway && false == var.reuse_nat_ips ? local.nat_gateway_count : 0

    wontfix 
    opened by aegershman 0
  • HCL2, updates to `lookup` function parameters

    HCL2, updates to `lookup` function parameters

    Changing referencing of functions on lookup, e.g. rule_number = "${lookup(var.public_inbound_acl_rules[count.index], "rule_number")}" becomes rule_number = var.public_inbound_acl_rules[count.index]["rule_number"]

    opened by aegershman 0
Releases(v1.15.0)
  • v1.15.0(Dec 12, 2022)

    What's Changed

    • Update with rewrite 7.33.0
    • chore: update suppressions for new false positives by @natedanner in https://github.com/openrewrite/rewrite-terraform/pull/23

    Full Changelog: https://github.com/openrewrite/rewrite-terraform/compare/v1.14.0...v1.15.0

    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(Nov 17, 2022)

  • v1.13.0(Oct 20, 2022)

    What's Changed

    • Update to use rewrite 7.32.0
    • chore: suppress jackson-databind by @natedanner in https://github.com/openrewrite/rewrite-terraform/pull/20

    New Contributors

    • @natedanner made their first contribution in https://github.com/openrewrite/rewrite-terraform/pull/20

    Full Changelog: https://github.com/openrewrite/rewrite-terraform/compare/v1.10.0...v1.13.0

    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Oct 11, 2022)

  • v1.11.1(Sep 22, 2022)

  • v1.11.0(Sep 22, 2022)

  • v1.10.0(Sep 2, 2022)

  • v1.9.1(Aug 6, 2022)

  • v1.9.0(Aug 5, 2022)

  • v1.8.0(Jul 7, 2022)

  • v.1.7.0(Jun 2, 2022)

  • v1.6.0(May 11, 2022)

  • v1.5.0(Apr 27, 2022)

  • v1.4.2(Apr 7, 2022)

  • v1.4.1(Apr 5, 2022)

  • v1.4.0(Apr 4, 2022)

    What's Changed

    • Updated with rewrite version 7.21.0

    Full Changelog: https://github.com/openrewrite/rewrite-terraform/compare/V1.1.0...v1.4.0

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Mar 23, 2022)

  • v1.2.0(Feb 26, 2022)

  • v1.1.0(Feb 10, 2022)

    What's Changed

    • Updated with rewrite version 7.18.0

    Full Changelog: https://github.com/openrewrite/rewrite-terraform/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jan 7, 2022)

    Enhancements

    • Updated with rewrite version 7.17.0

    Full Changelog: https://github.com/openrewrite/rewrite-terraform/compare/v0.8.0...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Oct 26, 2021)

  • v0.7.0(Oct 5, 2021)

  • v0.6.0(Sep 14, 2021)

    Enhancements:

    • Updated with rewrite version 7.14.0
    • Add SecureRandomRecipe (https://github.com/openrewrite/rewrite-terraform/commit/1ada2499f0d12ee7bba546a9b096d89c152bf585)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Sep 3, 2021)

  • v0.4.0(Aug 21, 2021)

    Enhancements:

    • Updated with rewrite 7.12.0
    • Added ~100+ Terraform recipes for more-securely operating on AWS, GCP, and Azure IaaSes, such as Ensure IAM password policy requires at least one uppercase letter, Encrypt EBS volumes, Encrypt Azure VM data disk with ADE/CMK, Ensure GCP Kubernetes cluster node auto-repair configuration is enabled, and many more.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Aug 13, 2021)

  • v0.2.0(Jul 28, 2021)

  • v0.1.0(Jul 16, 2021)

    Enhancements:

    • Updated with rewrite 7.9.0
    • Updated with rewrite-testing-frameworks 1.8.0
    • Recipe - Add Terraform Configuration
    • Recipe - Find Terraform resource
    • Recipe - Best practices for AWS
    • Recipe - Use HTTPS for Cloudfront distribution
    • Recipe - Encrypt EBS volume launch configurations
    • Recipe - Encrypt EBS snapshots
    • Recipe - Encrypt RDS clusters
    • Recipe - Scan images pushed to ECR
    • Recipe - Enable point-in-time recovery for DynamoDB
    • Recipe - Encrypt Aurora clusters
    • Recipe - Encrypt ElastiCache Redis at rest
    • Recipe - Encrypt ElastiCache Redis in transit
    • Recipe - Encrypt Neptune storage
    • Recipe - Encrypt DAX storage at rest
    • Recipe - Make ECR tags immutable
    • Recipe - Encrypt DAX storage at rest
    • Recipe - Encrypt Neptune storage
    • Recipe - Encrypt CodeBuild projects
    • Recipe - Enable API gateway caching
    Source code(tar.gz)
    Source code(zip)
Owner
OpenRewrite
Semantic code search and transformation
OpenRewrite
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Grantland Chew 4.2k Jan 8, 2023
DuGuang 1k Dec 14, 2022
Automatically manipulates the duration of animations dependent on view count. Quicksand .. the more you struggle.

QuickSand When showing a really enchanting explanatory animation to your users, but you know that after a while it'll get tedious and would stop users

Paul Blundell 385 Sep 9, 2022
Parallax scrolling either by offset or automatically.

ParallaxScrollingView Parallax Scrolling View. automatic scrolling with different speeds minimal integration gpu accelerated supports vector drawables

Jan Rabe 100 Nov 21, 2022
A customized video view that will automatically pause video is user is not looking at device screen!!!!!

UserAwareVideoView Featured in: Medium What is this library for? UserAwareVideoView is a customizable VideoView that smartly play and pause the video

Keval Patel 51 Jun 27, 2021
Android Studio plugin which automatically generates drawable selectors from appropriately named resources.

SelectorChapek for Android This Android Studio plugin automatically generates drawable selectors from appropriately named Android resources. How to in

Inmite s.r.o. 1.6k Dec 29, 2022
A TextView that automatically resizes text to fit perfectly within its bounds.

AutoFitTextView A TextView that automatically resizes text to fit perfectly within its bounds. Usage dependencies { compile 'me.grantland:autofitt

Grantland Chew 4.2k Jan 1, 2023
AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URLs (http://), Phone and Email automatically detecting and ability to handle clicks.

AutoLinkTextView Deprecated Please use the new version of AutoLinkTextView AutoLinkTextView is TextView that supports Hashtags (#), Mentions (@) , URL

Arman 1.1k Nov 23, 2022
Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platform the code is running.

Trail Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platfor

Mauricio Togneri 13 Aug 29, 2022
A TextView that automatically fit its font and line count based on its available size and content

AutoFitTextView A TextView that automatically fit its font and line count based on its available size and content This code is heavily based on this S

null 899 Jan 2, 2023
A TextView that changes its content automatically every few seconds

FadingTextView A TextView that changes its content automatically every few seconds Demo app A demo app is available on Google Play: Usage Add this to

Tomer Rosenfeld 1.7k Dec 9, 2022
Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Dipien 142 Dec 29, 2022
Examples of custom recycler view items. Automatically detecting a dominant color of an image using Picasso and Palette libraries

custom-image-list-item Examples of custom RecyclerView items using Data Binding Features: Loading images urls with the help of a Picasso library Autom

Alina Stepanova 2 Sep 12, 2022
AutoPlayer - A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

Kishan Singh 6 Aug 14, 2022
Automatically filled the declared non-null field is missing or null with default value.

[TOC] Moshi-kotlin-nullsafe 中文版 1. moshi-kotlin moshi-kotlin support kotlin type safe check. When parsing json, fields declared as non-null types may

null 4 Oct 26, 2022
Automatically empty the trash in all of your Plex libraries

Plex Auto Trash Automatically empty the trash in all of your Plex libraries. If you disable automatic trash emptying (and you probably should) trash s

Jake Wharton 25 Aug 11, 2022
Just a simple tool to turn on/off DND(Do Not Disturb) automatically when using specified apps.

AutoDND Just a simple tool to turn on/off DND(Do Not Disturb) automatically when using specified apps. Ever feel disturbed by notifications and maybe

null 6 May 24, 2022
An android app will start when boot and exit after 1s. Develop for Redmi K40 to enable DC dimming automatically.

An android app will start when boot and exit after 1s. Develop for Redmi K40 to enable DC dimming automatically.

Ovear 4 May 13, 2022
Automatically generates UI demos which allow users to call any function with any parameters

Automatically generates UI demos which allow users to call any function (including composable ones) with any parameters. Useful for building demo screens in playground apps of various design systems.

Anton Popov 3 Jul 28, 2022
Attend HoYoLAB Check-in events automatically

Croissant Attend HoYoLAB Check-in events automatically https://play.google.com/store/apps/details?id=com.joeloewi.croissant Stacks Room Database Hilt

joeloewi 2 Nov 23, 2022