Skip to content

Regex for amazon-ami data source filter comments out part of the code #5

@feyzee

Description

@feyzee

Plugin is commenting out part of the code when it encounters the string - '/*'.

I'm using filters for data source amazon-ami to get an ubuntu image. Value for name key in the filter is "ubuntu/images/ubuntu-bionic-18.04-amd64-server-".

images/*ubuntu

Above part is the problematic one, as plugin assumes it is a comment. Following code is from Packer docs and valid. Tested using validate and build subcommands in Packer.

data "amazon-ami" "ubuntu" {
	filters = {
		virtualization-type = "hvm"
		name = "ubuntu/images/*ubuntu-bionic-18.04-amd64-server-*"
		root-device-type = "ebs"
	}
	owners = ["099720109477"]
        most_recent = true
	profile = var.aws_profile
	region = var.region
}

Here's a screenshot of the code above code.

image

And without "/*" part

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions