Skip to content

Add example with templated and bind mounted config file #68

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

Merged
merged 3 commits into from
Oct 5, 2020

Conversation

karlkfi
Copy link
Contributor

@karlkfi karlkfi commented Sep 30, 2020

Fixes #66

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

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

Could you also add this example to the fixtures/tests?

@karlkfi karlkfi force-pushed the feature/config-file-example branch from feaa4a8 to 49a1c5d Compare October 2, 2020 01:50
@karlkfi karlkfi requested a review from morgante October 2, 2020 01:52
@karlkfi
Copy link
Contributor Author

karlkfi commented Oct 2, 2020

Added fixture and integration tests.
Tests passed.
Squashed related changes.

Copy link
Contributor

@morgante morgante left a comment

Choose a reason for hiding this comment

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

Just a minor nit.

default = "8080"
}

variable "restart_policy" {
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI in general we shouldn't really need so many variables for examples - often they should just be hardcoded. I know many of the existing examples overuse variables, but the variables should really only be for things which actually need to change like project ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copied it from instance_with_attached_disk. Should I remove it here or in both places?
Unlike instance_with_attached_disk, I set a default here so it doesn't actually need to be defined.

Copy link
Contributor

@morgante morgante Oct 2, 2020

Choose a reason for hiding this comment

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

Just because you started with an example doesn't mean you need to copy it exactly - try to make it better as you add new ones at least. Either remove it here or both places if you want to do more.

http_address = attribute('http_address')
port = attribute('http_port')

# Test disabled due to flappiness - because this makes live network requests, it is prone to sporadic failure.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just remove this test if it's too flaky.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was copied from instance_with_attached_disk, which exposes many of the same outputs specifically to enable this test. I haven't actually run this test at all. I assumed that either we should have it in both places or remove it in both places, but I wasn't sure if there was an issue in the backlog to clean up the technical debt.

I could probably add a retry loop to make it less flaky, but I don't know how to quickly judge the flakiness before PR merge.

Do you want me to remove it here AND remove the outputs it needed, or also remove it from the other example test(s), or try to make it more robust (and take longer to fail)?

Copy link
Contributor

@morgante morgante Oct 2, 2020

Choose a reason for hiding this comment

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

Incremental improvement, try to leave the codebase better than you found it. You can leave the old one but no need to copy over the commented code here. (Also go ahead and remove the outputs.)

@karlkfi karlkfi force-pushed the feature/config-file-example branch from 0b8e48d to 715ccf6 Compare October 2, 2020 20:54
@karlkfi
Copy link
Contributor Author

karlkfi commented Oct 2, 2020

Removed the unused www test (copied tech debt).
Removed a few inputs and outputs to simplify the example.
Tests passed.
Squashed related changes.

@karlkfi karlkfi requested a review from morgante October 2, 2020 20:56
- `terraform apply` to apply the infrastructure changes
- `terraform destroy` to tear down the created infrastructure

## Debugging
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this, nice touch!

@morgante morgante merged commit 730b4bb into master Oct 5, 2020
@karlkfi karlkfi deleted the feature/config-file-example branch October 6, 2020 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Host directory mount example is missing
2 participants