-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(examples): flexible bootstrap options #22
Merged
Merged
Changes from all commits
Commits
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 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
This file contains 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 |
---|---|---|
|
@@ -29,20 +29,17 @@ resource "local_file" "bootstrap_xml" { | |
) | ||
} | ||
|
||
resource "local_file" "init_cfg" { | ||
resource "local_sensitive_file" "init_cfg" { | ||
|
||
for_each = { for k, v in var.vmseries : k => v | ||
if can(v.bootstrap_template_map) | ||
} | ||
|
||
filename = "files/${each.key}/config/init-cfg.txt" | ||
content = templatefile("templates/init-cfg.tmpl", | ||
{ | ||
panorama-server = try(each.value.bootstrap_options.panorama-server, var.vmseries_common.bootstrap_options.panorama-server, "") | ||
type = try(each.value.bootstrap_options.type, var.vmseries_common.bootstrap_options.type, "") | ||
dns-primary = try(each.value.bootstrap_options.dns-primary, var.vmseries_common.bootstrap_options.dns-primary, "") | ||
dns-secondary = try(each.value.bootstrap_options.dns-secondary, var.vmseries_common.bootstrap_options.dns-secondary, "") | ||
}) | ||
content = templatefile( | ||
"templates/init-cfg.tmpl", | ||
{ bootstrap_options = merge(var.vmseries_common.bootstrap_options, each.value.bootstrap_options) } | ||
) | ||
} | ||
|
||
module "bootstrap" { | ||
|
@@ -56,8 +53,8 @@ module "bootstrap" { | |
service_account = module.iam_service_account[each.value.service_account_key].email | ||
location = each.value.location | ||
files = merge( | ||
{ for k, v in var.vmseries : "files/${k}/config/bootstrap.xml" => "${k}/config/bootstrap.xml" }, | ||
{ for k, v in var.vmseries : "files/${k}/config/init-cfg.txt" => "${k}/config/init-cfg.txt" }, | ||
{ for k, v in var.vmseries : "files/${k}/config/bootstrap.xml" => "${k}/config/bootstrap.xml" if can(v.bootstrap_template_map) }, | ||
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. How do we handle 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. Currently authcodes are not handled in the examples. |
||
{ for k, v in var.vmseries : "files/${k}/config/init-cfg.txt" => "${k}/config/init-cfg.txt" if can(v.bootstrap_template_map) }, | ||
) | ||
} | ||
|
||
|
This file contains 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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
%{ if panorama-server != "" ~} | ||
panorama-server=${panorama-server} | ||
%{ endif ~} | ||
%{ if type != "" ~} | ||
type=${type} | ||
%{ endif ~} | ||
%{ if dns-primary != "" ~} | ||
dns-primary=${dns-primary} | ||
%{ endif ~} | ||
%{ if dns-secondary != "" ~} | ||
dns-secondary=${dns-secondary} | ||
%{ endif ~} | ||
%{ for k, v in bootstrap_options ~} | ||
${k}=${v} | ||
%{ endfor ~} |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
%{ if panorama-server != "" ~} | ||
panorama-server=${panorama-server} | ||
%{ endif ~} | ||
%{ if type != "" ~} | ||
type=${type} | ||
%{ endif ~} | ||
%{ if dns-primary != "" ~} | ||
dns-primary=${dns-primary} | ||
%{ endif ~} | ||
%{ if dns-secondary != "" ~} | ||
dns-secondary=${dns-secondary} | ||
%{ endif ~} | ||
%{ for k, v in bootstrap_options ~} | ||
${k}=${v} | ||
%{ endfor ~} |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
%{ if panorama-server != "" ~} | ||
panorama-server=${panorama-server} | ||
%{ endif ~} | ||
%{ if type != "" ~} | ||
type=${type} | ||
%{ endif ~} | ||
%{ if dns-primary != "" ~} | ||
dns-primary=${dns-primary} | ||
%{ endif ~} | ||
%{ if dns-secondary != "" ~} | ||
dns-secondary=${dns-secondary} | ||
%{ endif ~} | ||
%{ for k, v in bootstrap_options ~} | ||
${k}=${v} | ||
%{ endfor ~} |
This file contains 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
This file contains 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
15 changes: 3 additions & 12 deletions
15
examples/vpc_peering_common_with_network_tags/templates/init-cfg.tmpl
This file contains 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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
%{ if panorama-server != "" ~} | ||
panorama-server=${panorama-server} | ||
%{ endif ~} | ||
%{ if type != "" ~} | ||
type=${type} | ||
%{ endif ~} | ||
%{ if dns-primary != "" ~} | ||
dns-primary=${dns-primary} | ||
%{ endif ~} | ||
%{ if dns-secondary != "" ~} | ||
dns-secondary=${dns-secondary} | ||
%{ endif ~} | ||
%{ for k, v in bootstrap_options ~} | ||
${k}=${v} | ||
%{ endfor ~} |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
%{ if panorama-server != "" ~} | ||
panorama-server=${panorama-server} | ||
%{ endif ~} | ||
%{ if type != "" ~} | ||
type=${type} | ||
%{ endif ~} | ||
%{ if dns-primary != "" ~} | ||
dns-primary=${dns-primary} | ||
%{ endif ~} | ||
%{ if dns-secondary != "" ~} | ||
dns-secondary=${dns-secondary} | ||
%{ endif ~} | ||
%{ for k, v in bootstrap_options ~} | ||
${k}=${v} | ||
%{ endfor ~} |
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.
Should we exclude some bootstrap_options here like
authcodes
for example?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.
Good point! However, simply excluding those will result in making licensing options not available.
To exclude sensitive data from output of plan/apply, which is definitely relevant if such logs are stored in, for example, some CI/CD system, I've updated resource to
local_sensitive_file
.Storing contents in the tfstate (eg. in a bucket) is a different story - you either have it or have no panorama licensing at all. This should be covered by local or bucket-level protection (encryption, appropriate access control).
Unless you have any proposal, I will mark this one as resolved.