Skip to content
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

colored syntax highlighting breaking at different points #54

Open
xork242 opened this issue Jan 14, 2022 · 3 comments
Open

colored syntax highlighting breaking at different points #54

xork242 opened this issue Jan 14, 2022 · 3 comments
Labels
Milestone

Comments

@xork242
Copy link

xork242 commented Jan 14, 2022

I have a long .tf file where the syntax highlighting is breaking at 2 different points.

In this first snippet, I get an error that no matching bracket is found and the color highlighting changes afterwards, all bracket matching afterwards breaks:

screen1

resource "aws_iam_role_policy" "attach-inline-policy-1" {
    name = "xxx"
    role = aws_iam_role.execution-role.name
    policy = jsonencode({
        Version = "2012-10-17"
        "Statement": [
            {
                "Action": [
                    "lambda:InvokeFunction",
                    "lambda:InvokeAsync"
                ],
                "Resource": "arn:aws:lambda:*:*:function:${var.environment}-xxx",
                "Effect": "Allow"
            }
        ]
    })
}

resource "aws_iam_role_policy" "attach-inline-policy-2" {
    name = "xxx"
    role = aws_iam_role.execution-role.name
    policy = jsonencode({
        Version = "2012-10-17"
        "Statement": [
            {
                "Action": [
                    "sns:Publish"
                ],
                "Resource": [
                    "arn:aws:sns:us-east-1:${var.aws_account_id}:${var.environment}-xxx",
                    "arn:aws:sns:us-east-1:${var.aws_account_id}:${var.environment}-xxx"
                ],
                "Effect": "Allow"
            }
        ]
    })
}

In this second section, all color highlighting completely goes away:

screen2

resource "aws_iam_role_policy" "attach-inline-policy-10" {
    name = "xxx"
    role = aws_iam_role.execution-role.name
    policy = jsonencode({
        Version = "2012-10-17"
        "Statement": [
            {
                "Action": [
                    "s3:Get*",
                    "s3:List*",
                    "s3:PutObject",
                    "ec2:DescribeTags",
                    "logs:*"
                ],
                "Resource": [
                    "arn:aws:s3:::xxx-*",
                    "arn:aws:s3:::xxx-*/*"
                ],
                "Effect": "Allow"
            }
        ]
    })
}

resource "aws_iam_role_policy" "attach-inline-policy-11" {
    name = "xxx"
    role = aws_iam_role.execution-role.name
    policy = jsonencode({
        Version = "2012-10-17"
        "Statement": [
            {
                "Action": [
                    "sns:Publish"
                ],
                "Resource": [
                    "arn:aws:sns:us-east-1:${var.aws_account_id}:${var.environment}_xxx",
                    "arn:aws:sns:us-east-1:${var.aws_account_id}:${var.environment}_xxx"
                ],
                "Effect": "Allow"
            }
        ]
    })
}

Would it be possible to update the plugin to account for this usage? Any other suggestions?

Thanks!

@TerminalFi
Copy link

This got me today as well.

@larstobi
Copy link

I have switched to a fork of this repo, and with that the code above is correctly highlighted:
https://github.com/tmichel/sublime-terraform

@FichteFoll
Copy link
Member

For the record, it breaks on the line with "Statement": [.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants