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

Add flag to enable/disable creation of resources #15

Merged
merged 1 commit into from
Jun 20, 2018

Conversation

jinnko
Copy link
Contributor

@jinnko jinnko commented Jun 14, 2018

When this module is used with terraform workspaces we may choose to
enable/disable creation of resources based on various conditions. Since
terraform modules don't support the count attribute we must pass in the
parameter and apply it to each resource within the module.

Unfortunately we also need to perform magic around various references to
paramaters for each resource when it doesn't get created. We do this by
applying defaults with a combination of interpolation functions in a
very hacky way. Not something to be proud of.

When this module is used with terraform workspaces we may choose to
enable/disable creation of resources based on various conditions.  Since
terraform modules don't support the count attribute we must pass in the
parameter and apply it to each resource within the module.

Unfortunately we also need to perform magic around various references to
paramaters for each resource when it doesn't get created.  We do this by
applying defaults with a combination of interpolation functions in a
very hacky way.  Not something to be proud of.
@antonbabenko
Copy link
Member

Thank you Jinn for this contribution.

@antonbabenko antonbabenko merged commit 82e108f into terraform-aws-modules:master Jun 20, 2018
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1.7.0 has been released.

function_name changes is out of scope for this PR and in general for this repo (I suppose)


name = "${var.sns_topic_name}"
}

locals {
sns_topic_arn = "${element(compact(concat(aws_sns_topic.this.*.arn, data.aws_sns_topic.this.*.arn)), 0)}"
sns_topic_arn = "${element(compact(concat(aws_sns_topic.this.*.arn, data.aws_sns_topic.this.*.arn, list(var.enable))), 0)}"
function_name_base = "${format("%s-%s", var.lambda_function_name, var.sns_topic_name)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name can be passed to the module as an argument if you want to customize it. The function itself does not belong to specific SNS topic, so it can be not bound to just one.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants