-
Notifications
You must be signed in to change notification settings - Fork 20
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
Get snapshots information from json file #341
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,100 @@ locals { | |
local_bamboo_chart_path = var.local_helm_charts_path != "" && var.bamboo_install_local_chart ? "${var.local_helm_charts_path}/bamboo" : "" | ||
local_agent_chart_path = var.local_helm_charts_path != "" && var.bamboo_install_local_chart ? "${var.local_helm_charts_path}/bamboo-agent" : "" | ||
local_crowd_chart_path = var.local_helm_charts_path != "" && var.crowd_install_local_chart ? "${var.local_helm_charts_path}/crowd" : "" | ||
|
||
# snapshots_json = var.snapshots_json_file_path != "" ? jsondecode(file(var.snapshots_json_file_path)) : jsondecode("{\"jira\": {\"versions\":[]},\"confluence\": {\"versions\":[]},\"crowd\": {\"versions\":[]},\"bitbucket\": {\"versions\":[]}}") | ||
snapshots_json = var.snapshots_json_file_path != "" ? jsondecode(file(var.snapshots_json_file_path)) : null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we put a sentence or two describing the filtering process and how the snapshot values are determined? I had to read it a couple of times to see how this is used, and I am sure I will forget it before I will see this code again :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
|
||
filtered_bitbucket_snapshots = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.bitbucket.versions : | ||
[for snapshot in version.data : | ||
merge({ version = version.version }, snapshot) | ||
] | ||
]) : [] | ||
|
||
bitbucket_rds_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_bitbucket_snapshots : | ||
snapshot.type == "rds" && snapshot.size == var.bitbucket_dataset_size && snapshot.version == var.bitbucket_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
bitbucket_ebs_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_bitbucket_snapshots : | ||
snapshot.type == "ebs" && snapshot.size == var.bitbucket_dataset_size && snapshot.version == var.bitbucket_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
filtered_confluence_snapshots = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.confluence.versions : | ||
[for snapshot in version.data : | ||
merge({ version = version.version }, snapshot) | ||
] | ||
]) : [] | ||
|
||
confluence_rds_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_confluence_snapshots : | ||
snapshot.type == "rds" && snapshot.size == var.confluence_dataset_size && snapshot.version == var.confluence_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
confluence_ebs_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_confluence_snapshots : | ||
snapshot.type == "ebs" && snapshot.size == var.confluence_dataset_size && snapshot.version == var.confluence_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
confluence_build_numbers = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.confluence.versions : | ||
version.version == var.confluence_version_tag ? version.build_number : "" | ||
]) : [] | ||
|
||
filtered_crowd_snapshots = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.crowd.versions : | ||
[for snapshot in version.data : | ||
merge({ version = version.version }, snapshot) | ||
] | ||
]) : [] | ||
|
||
crowd_rds_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_crowd_snapshots : | ||
snapshot.type == "rds" && snapshot.size == var.crowd_dataset_size && snapshot.version == var.crowd_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
crowd_ebs_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_crowd_snapshots : | ||
snapshot.type == "ebs" && snapshot.size == var.crowd_dataset_size && snapshot.version == var.crowd_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
crowd_build_numbers = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.crowd.versions : | ||
version.version == var.crowd_version_tag ? version.build_number : "" | ||
]) : [] | ||
|
||
filtered_jira_snapshots = local.snapshots_json != null ? flatten([ | ||
for version in local.snapshots_json.jira.versions : | ||
[for snapshot in version.data : | ||
merge({ version = version.version }, snapshot) | ||
] | ||
]) : [] | ||
|
||
jira_rds_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_jira_snapshots : | ||
snapshot.type == "rds" && snapshot.size == var.jira_dataset_size && snapshot.version == var.jira_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
jira_ebs_snapshot = local.snapshots_json != null ? [ | ||
for snapshot in local.filtered_jira_snapshots : | ||
snapshot.type == "ebs" && snapshot.size == var.jira_dataset_size && snapshot.version == var.jira_version_tag ? snapshot.snapshots[0][var.region] : "" | ||
] : [] | ||
|
||
jira_rds_snapshot_id = length(compact(local.jira_rds_snapshot)) > 0 ? compact(local.jira_rds_snapshot)[0] : var.jira_db_snapshot_id != null ? var.jira_db_snapshot_id : null | ||
jira_ebs_snapshot_id = length(compact(local.jira_ebs_snapshot)) > 0 ? compact(local.jira_ebs_snapshot)[0] : var.jira_shared_home_snapshot_id != null ? var.jira_shared_home_snapshot_id : null | ||
|
||
confluence_rds_snapshot_id = length(compact(local.confluence_rds_snapshot)) > 0 ? compact(local.confluence_rds_snapshot)[0] : var.confluence_db_snapshot_id != null ? var.confluence_db_snapshot_id : null | ||
confluence_ebs_snapshot_id = length(compact(local.confluence_ebs_snapshot)) > 0 ? compact(local.confluence_ebs_snapshot)[0] : var.confluence_shared_home_snapshot_id != null ? var.confluence_shared_home_snapshot_id : null | ||
confluence_db_snapshot_build_number = length(compact(local.confluence_build_numbers)) > 0 ? compact(local.confluence_build_numbers)[0] : var.confluence_db_snapshot_build_number != null ? var.confluence_db_snapshot_build_number : null | ||
|
||
crowd_rds_snapshot_id = length(compact(local.crowd_rds_snapshot)) > 0 ? compact(local.crowd_rds_snapshot)[0] : var.crowd_db_snapshot_id != null ? var.crowd_db_snapshot_id : null | ||
crowd_ebs_snapshot_id = length(compact(local.crowd_ebs_snapshot)) > 0 ? compact(local.crowd_ebs_snapshot)[0] : var.crowd_shared_home_snapshot_id != null ? var.crowd_shared_home_snapshot_id : null | ||
crowd_db_snapshot_build_number = length(compact(local.crowd_build_numbers)) > 0 ? compact(local.crowd_build_numbers)[0] : var.crowd_db_snapshot_build_number != null ? var.crowd_db_snapshot_build_number : null | ||
|
||
bitbucket_rds_snapshot_id = length(compact(local.bitbucket_rds_snapshot)) > 0 ? compact(local.bitbucket_rds_snapshot)[0] : var.bitbucket_db_snapshot_id != null ? var.bitbucket_db_snapshot_id : null | ||
bitbucket_ebs_snapshot_id = length(compact(local.bitbucket_ebs_snapshot)) > 0 ? compact(local.bitbucket_ebs_snapshot)[0] : var.bitbucket_shared_home_snapshot_id != null ? var.bitbucket_shared_home_snapshot_id : null | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,3 +111,43 @@ output "confluence_s3_bucket" { | |
description = "Confluence S3 bucket name" | ||
value = var.confluence_s3_attachments_storage ? "${local.cluster_name}-confluence-storage" : null | ||
} | ||
|
||
output "jira_rds_snapshot" { | ||
value = local.jira_rds_snapshot_id | ||
} | ||
|
||
output "jira_ebs_snapshot" { | ||
value = local.jira_ebs_snapshot_id | ||
} | ||
|
||
output "confluence_rds_snapshot" { | ||
value = local.confluence_rds_snapshot_id | ||
} | ||
|
||
output "confluence_ebs_snapshot" { | ||
value = local.confluence_ebs_snapshot_id | ||
} | ||
|
||
output "confluence_db_snapshot_build_number" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only Confluence and Crowd require build number? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
value = local.confluence_db_snapshot_build_number | ||
} | ||
|
||
output "bitbucket_rds_snapshot" { | ||
value = local.bitbucket_rds_snapshot_id | ||
} | ||
|
||
output "bitbucket_ebs_snapshot" { | ||
value = local.bitbucket_ebs_snapshot_id | ||
} | ||
|
||
output "crowd_rds_snapshot" { | ||
value = local.crowd_rds_snapshot_id | ||
} | ||
|
||
output "crowd_ebs_snapshot" { | ||
value = local.crowd_ebs_snapshot_id | ||
} | ||
|
||
output "crowd_db_snapshot_build_number" { | ||
value = local.crowd_db_snapshot_build_number | ||
} |
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.
Do we need this?