-
Notifications
You must be signed in to change notification settings - Fork 3
BCSS-23458 TERRAFORM MODULE: COGNITO #49
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
Open
DeepikaDK001
wants to merge
5
commits into
main
Choose a base branch
from
feature/BCSS-23458-create-terraform-module-cognito
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4ce865f
BCSS-23458 TERRAFORM MODULE: COGNITO
DeepikaDK001 9a32682
Merge branch 'main' into feature/BCSS-23458-create-terraform-module-c…
DeepikaDK001 e19de1f
check-in for failed checks
DeepikaDK001 765ffb2
Code clean-up
DeepikaDK001 e745da1
code clean-up
DeepikaDK001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| # | ||
| # ONLY EDIT THIS FILE IN github.com/NHSDigital/screening-terraform-modules-aws/infrastructure/modules/tags | ||
| # All other instances of this file should be a copy of that one | ||
| # | ||
| # | ||
| # Copy this file from https://github.com/NHSDigital/screening-terraform-modules-aws/blob/master/infrastructure/modules/tags/exports/context.tf | ||
| # and then place it in your Terraform module to automatically get | ||
| # tag module standard configuration inputs suitable for passing | ||
| # to other modules. | ||
| # | ||
| # curl -sL https://raw.githubusercontent.com/NHSDigital/screening-terraform-modules-aws/master/infrastructure/modules/tags/exports/context.tf -o context.tf | ||
| # | ||
| # Modules should access the whole context as `module.this.context` | ||
| # to get the input variables with nulls for defaults, | ||
| # for example `context = module.this.context`, | ||
| # and access individual variables as `module.this.<var>`, | ||
| # with final values filled in. | ||
| # | ||
| # For example, when using defaults, `module.this.context.delimiter` | ||
| # will be null, and `module.this.delimiter` will be `-` (hyphen). | ||
| # | ||
|
|
||
| module "this" { | ||
| source = "git::https://github.com/NHSDigital/screening-terraform-modules-aws.git//infrastructure/modules/tags?ref=v2.6.0" | ||
|
|
||
| enabled = coalesce(var.enabled, lookup(var.context, "enabled", true)) | ||
| service = coalesce(var.service, lookup(var.context, "service", null)) | ||
| project = coalesce(var.project, lookup(var.context, "project", null)) | ||
| region = lookup(var.context, "region", null) | ||
| environment = coalesce(var.environment, lookup(var.context, "environment", null)) | ||
| stack = lookup(var.context, "stack", null) | ||
| workspace = lookup(var.context, "workspace", null) | ||
| name = coalesce(var.name, lookup(var.context, "name", null)) | ||
| delimiter = lookup(var.context, "delimiter", null) | ||
| attributes = lookup(var.context, "attributes", []) | ||
| tags = merge(lookup(var.context, "tags", {}), var.tags) | ||
| additional_tag_map = lookup(var.context, "additional_tag_map", {}) | ||
| label_order = lookup(var.context, "label_order", []) | ||
| regex_replace_chars = lookup(var.context, "regex_replace_chars", null) | ||
| id_length_limit = lookup(var.context, "id_length_limit", null) | ||
| label_key_case = lookup(var.context, "label_key_case", null) | ||
| label_value_case = lookup(var.context, "label_value_case", null) | ||
| terraform_source = coalesce(var.terraform_source, lookup(var.context, "terraform_source", null), path.module) | ||
| descriptor_formats = lookup(var.context, "descriptor_formats", {}) | ||
| labels_as_tags = toset(lookup(var.context, "labels_as_tags", ["unset"])) | ||
|
|
||
| context = var.context | ||
| } | ||
|
|
||
| variable "aws_region" { | ||
| type = string | ||
| description = "AWS region used for derived Cognito hosted UI outputs." | ||
| default = "eu-west-2" | ||
|
|
||
| validation { | ||
| condition = contains(["eu-west-1", "eu-west-2", "us-east-1"], var.aws_region) | ||
| error_message = "AWS Region must be one of eu-west-1, eu-west-2, us-east-1" | ||
| } | ||
| } | ||
|
|
||
| variable "context" { | ||
| type = any | ||
| default = { | ||
| enabled = true | ||
| service = null | ||
| project = null | ||
| region = null | ||
| environment = null | ||
| stack = null | ||
| workspace = null | ||
| name = null | ||
| delimiter = null | ||
| attributes = [] | ||
| tags = {} | ||
| additional_tag_map = {} | ||
| regex_replace_chars = null | ||
| label_order = [] | ||
| id_length_limit = null | ||
| label_key_case = null | ||
| label_value_case = null | ||
| terraform_source = null | ||
| descriptor_formats = {} | ||
| labels_as_tags = ["unset"] | ||
| } | ||
| description = <<-EOT | ||
| Single object for setting entire context at once. | ||
| See description of individual variables for details. | ||
| Leave string and numeric variables as `null` to use default value. | ||
| Individual variable settings (non-null) override settings in context object, | ||
| except for attributes, tags, and additional_tag_map, which are merged. | ||
| EOT | ||
|
|
||
| validation { | ||
| condition = lookup(var.context, "label_key_case", null) == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"]) | ||
| error_message = "Allowed values: `lower`, `title`, `upper`." | ||
| } | ||
|
|
||
| validation { | ||
| condition = lookup(var.context, "label_value_case", null) == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"]) | ||
| error_message = "Allowed values: `lower`, `title`, `upper`, `none`." | ||
| } | ||
| } | ||
|
|
||
| variable "terraform_source" { | ||
| type = string | ||
| default = null | ||
| description = "Source location to record in the Terraform_source tag. Defaults to the caller module path when not set." | ||
| } | ||
|
|
||
| variable "enabled" { | ||
| type = bool | ||
| default = null | ||
| description = "Set to false to prevent the module from creating any resources." | ||
| } | ||
|
|
||
| variable "service" { | ||
| type = string | ||
| default = null | ||
| description = "Service identifier used by the shared tags module." | ||
| } | ||
|
|
||
| variable "project" { | ||
| type = string | ||
| default = null | ||
| description = "Project identifier used by the shared tags module." | ||
| } | ||
|
|
||
| variable "environment" { | ||
| type = string | ||
| default = null | ||
| description = "Environment identifier used by the shared tags module." | ||
| } | ||
|
|
||
| variable "name" { | ||
| type = string | ||
| default = null | ||
| description = "Name identifier used by the shared tags module." | ||
| } | ||
|
|
||
| variable "tags" { | ||
| type = map(string) | ||
| default = {} | ||
| description = "Additional tags merged with any tags supplied through the context object." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing something here do we need "var.create" doesn't the module.this.enabled toggle already provides this exact capability