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

local AMI vars should override data sources #308

Merged
merged 1 commit into from Jul 10, 2019

Conversation

Projects
None yet
2 participants
@strcrzy
Copy link

commented Jul 9, 2019

hi!

thank you for building detection lab!

when setting this up on AWS, i wanted to use my own AMIs built using your instructions. however, during the terraform step, terraform plan always returned the community AMIs rather than the ones i had just taken the time to build:

--
  # aws_instance.dc will be created
  + resource "aws_instance" "dc" {
      + ami                          = "ami-03e2df055c632a0dd" # not my AMI
--
  # aws_instance.logger will be created
  + resource "aws_instance" "logger" {
      + ami                          = "ami-0ad16744583f21877" # not my AMI
--
  # aws_instance.wef will be created
  + resource "aws_instance" "wef" {
      + ami                          = "ami-03c82482c03a740c5" # not my AMI
--
  # aws_instance.win10 will be created
  + resource "aws_instance" "win10" {
      + ami                          = "ami-0a4644e74768900f7" # not my AMI

i believe this is unintended behavior, but per the terraform documentation, coalesce takes any number of arguments and returns the first one that isn't null or an empty string. in this case it will always choose the data source over the user provided override. this patch should enable the functionality you intended with the local variable overrides

@clong

This comment has been minimized.

Copy link
Owner

commented Jul 10, 2019

Hi @strcrzy - thank you for fixing this!

@clong clong merged commit 0a7f7a1 into clong:master Jul 10, 2019

1 of 2 checks passed

ci/circleci: workflow/hold Your job is on hold on CircleCI!
Details
ci/circleci: verify Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.