Build Scenarios #125
Replies: 14 comments 20 replies
-
This is what we want and think about build method or provision method to clear confusion |
Beta Was this translation helpful? Give feedback.
-
Hi @agriffit79, thank you so much for the detailed write-up!
True, and IMO one of the most important points to consider in the discussion around the build-flag. Re-building a host with Foreman, without destroying the resource via Terraform, should be kept out of the Terraform plugin. Users that need this use case should use the Foreman UI (using the "Build" button on the host's page) or the Foreman API directly. @agriffit79 would you consider implementing your use case outside of Terraform? Triggering the build flag for ENC certificate creation? From my POV this scenario would be better covered by Tools like Puppet/Chef/Ansible than Terraform. |
Beta Was this translation helpful? Give feedback.
-
@agriffit79 when we are expecting with all these features to test it out? officially in terraform provider registry |
Beta Was this translation helpful? Give feedback.
-
From the beginning since @lhw has forked from https://github.com/wayfair/terraform-provider-foreman, our main concern in further development of the provider was the deployment of bare-metal machines without any manual intervention. For this purpose @lhw has extended the provider with the functions of power management (BMC), amongst many other helpful things. Our machines are either completely built using Foreman templates or configured with Ansible after built. We use the same build workflow for pre-production enviroments, but with the difference that we use the virtualization layer in Foreman (VMware) instead. As @lhw already wrote we don't use Puppet at all with Foreman. In order to put the provider development on a broader basis, @lhw moved the code base to a public repository when he left our company. But the changes like deprecation of method and introduction of build and managed flags since the first 0.5 release have caused insecurities in our production environment. Since then every code change was potentially dangerous because of toggling the build flag of foreman_host resources. In the early days of using 0.5 releases at least more than once a machine was unintenionally rebuilt after reboot (caused by power outage e.g.). I think this behaviour is absolutely inacceptable for production environments! To fix these (and further) issues we have asked @bitkeks a while ago to work on the provider. We still appreciate if a broader community will develop the provider furthermore. But at first we need to consolidate the code regarding this issue - i think. |
Beta Was this translation helpful? Give feedback.
-
one more thing: I saw the official terraform provider I saw there needs an upgrade for SDK any insights on the official provider for that? |
Beta Was this translation helpful? Give feedback.
-
@agriffit79 picking up your comment in https://github.com/terraform-coop/terraform-provider-foreman/pull/122/files#r1199028040
Referring to https://theforeman.org/manuals/3.6/index.html#4.4.6Workflow, you probably mean this stage?:
See #125 (comment) I'm therefore continuing with the PR as-is and we will find a way to support the ENC-only use-case in the next release iteration 👍 |
Beta Was this translation helpful? Give feedback.
-
Moving on to release v0.6.0 From my POV we covered all open discussions around use cases and the issue of the host build/method arguments. @agriffit79 unfortunately, you seem to be the only available reviewer right now. Do you have capacity to approve my PRs? 😅 The tests might fail due to an existing error in the master branch, as mentioned in #124. |
Beta Was this translation helpful? Give feedback.
-
@agriffit79 are we pushing to an official provider registry |
Beta Was this translation helpful? Give feedback.
-
Just curious @bitkeks @agriffit79 if we are changing the subnet id and network of the existing machine it should destroy and recreate the machine but looks like terraform lifecycle messed up this one ideally it should destroy as change. Thoughts?
|
Beta Was this translation helpful? Give feedback.
-
Hi, "Re-building a host with Foreman, without destroying the resource via Terraform, should be kept out of the Terraform plugin. Users that need this use case should use the Foreman UI" I introduced the build argument. It is needed because the world has shifted from snowflake servers that are built once and then endlessly configured (often manually) to immutable phoenix servers. Instead of endlessly configuring, upgrading, and patching, hoping new problems\bugs aren't introduced, you replace\rebuild, testing in less critical environments first, and can quickly return to a known good state when problems arise. This approach is in keeping with modern software development practices (eg 12 factor app). My company has remained on the version of this provider with my build argument, so we haven't tested @bitkeks subsequent PR and I'm just catching up with this discussion. I think build's removal was done without knowledge of how the this flag is used. When this provider is run with The Cobbler provider for terraform, which I also contributed to, supports rebuilds, and I believe this provider should too. Phoenix cattle servers are good, endlessly groomed pet servers are a legacy mindset. Rebuilding should be a frequent\routine operation that is supported by this provider. I agree terraform is declarative and should not accommodate an intermediate state, but the desired end-state is immutable infrastructure, which the build flag facilitated. Seems the only way to achieve immutability now (>= v6) is by point-and-click in the webui, rather than Terraform. Removal of the ability to rebuild is anti-infrastructure-as-code. We'll stay on < v6 for the time being. I hope it's possible to somehow reinstate the ability to rebuild hosts using this provider. Would you accept a new argument on Cheers. |
Beta Was this translation helpful? Give feedback.
-
OK, I'm with you on changing default from true to false. If there are no objections, I'll reintroduce
Only downside vs pre-v6's If there are no objections, I'll transfer the outcome of this discussion into a new issue: "Re-add ability to rebuild". Re your PPS, TBH, with the name |
Beta Was this translation helpful? Give feedback.
-
@bitkeks Another just idea is after creating VM resource how do we ensure VM is up can't we add local exec to check uptime whether the VM is fully up and running. ? |
Beta Was this translation helpful? Give feedback.
-
rather then creating another null_resource for maintaining it. |
Beta Was this translation helpful? Give feedback.
-
In the absence of further comments on the rebuild subject, I've created issue #130. @bitkeks, I probably won't have time to deliver a PR for some weeks, so seeing as we are aligned, happy for you to step in if you've more bandwidth. |
Beta Was this translation helpful? Give feedback.
-
We've had some churn in the code-base the last year with conflicting PRs around the
foreman_host
resource. PRs were submitted and accepted to make changes to the build process which broke some build scenarios. PRs were then submitted by other contributors to revert those changes. The root-cause seems to be that there are a number of different ways of using Foreman to build/manage hosts and it's sometimes difficult for contributors to understand how their proposed changes will impact build methods they don't personally use.What I would like to achieve in this discussion is to list all the possible build scenarios, the desired behaviour of the plugin in each case and what the resource declaration should look like. Below is a list of what I believe to be the possible scenarios. Please comment if there are any I have missed.
It's also my opinion that host rebuilds should not be orchestrated through the plugin. My view is that Terraform declarations should be idempotent and requesting a transitional state like "rebuild" fundamentally conflicts with that.
Beta Was this translation helpful? Give feedback.
All reactions