-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into fixed-rbac-for-reco…
…nciler Merge from main
- Loading branch information
Showing
8 changed files
with
149 additions
and
123 deletions.
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 +1,14 @@ | ||
# Branch Planner User Guide | ||
# Branch Planner Overview | ||
|
||
## Overview | ||
The GitOps methodology streamlines infrastructure provisioning and management, using Git as the source of truth. The Branch Planner, a component of TF-Controller, aims to take this a step further by allowing developers and operations teams to plan Terraform configurations on a branch that's separate from the `main` branch. This makes it easier to review and understand the potential impact of your changes before you run `terraform apply`. | ||
|
||
The Branch Planner, a new component of the Terraform Controller, is specifically designed to enhance the flexibility and robustness of Terraform Controller planning operations. This feature, currently in its technology preview phase, facilitates Terraform planning across branches, creating a streamlined and familiar PR-based workflow for users. | ||
The Branch Planner's most important feature is its seamless integration with the PR (Pull Request) user interface. When enabled through Helm values, it watches repositories that contain Terraform resources at regular intervals—checking their referenced Source, and polling for Pull Requests using GitHub's API and the provided token. When changes are proposed on a new branch, Branch Planner runs a plan in the cluster and displays the results directly as comments on your PR. Once you're satisfied with the results, you can merge your branch into the `main` branch to trigger the TF-Controller to reconcile the updated code. | ||
|
||
### How does it work? | ||
|
||
When the Branch Planner starts, it polls repositories that contain Terraform resources at regular intervals, in order to detect Pull Requests (PR) that change those resources. Upon detecting that a PR exists, the Branch Planner initialises a Terraform object in Plan Only mode for the corresponding branch. In this mode, Terraform Controller generates Terraform plans but does not apply them. Once the plan is generated, Branch Planner posts the plan under the PR as a comment enabling users to review the plan. When the Terraform files of the corresponding branch get updated, Branch Planner posts the updated plan under the PR as new comment, keeping the PR up-to-date with the latest Terraform plan. | ||
![branch planner](branch-planner.png) | ||
|
||
### Replan commands | ||
|
||
The Branch Planner also allows users to manually trigger the replan process. By simply commenting `!replan` under the PR, the Branch Planner will be instructed to generate a new plan and post it under the PR as a new comment. | ||
|
||
Now that you know what Branch Planner can do for you, follow the [guide to get started](./getting-started.md). | ||
Now that you know what Branch Planner can do for you, follow the [guide to get started](./branch-planner-getting-started.md). | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## Use TF-Controller with Azure | ||
|
||
This content was [provided](https://github.com/weaveworks/tf-controller/issues/561) by users [@mingmingshiliyu](https://github.com/mingmingshiliyu) and [@maciekdude](https://github.com/maciekdude). | ||
|
||
Use the OIDC flag and explicitly point to the token. Due to a bug in AzureRM 3.44.x, use version 3.47.x or later. | ||
|
||
Set env variables on the runner pod: | ||
|
||
``` | ||
- name: ARM_USE_OIDC | ||
value: "true" | ||
- name: ARM_OIDC_TOKEN_FILE_PATH | ||
value: "/var/run/secrets/azure/tokens/azure-identity-token" | ||
``` | ||
|
||
Example yaml: | ||
|
||
```yaml | ||
apiVersion: infra.contrib.fluxcd.io/v1alpha1 | ||
kind: Terraform | ||
metadata: | ||
name: terraformhello | ||
namespace: default | ||
spec: | ||
tfstate: | ||
forceUnlock: auto | ||
backendConfig: | ||
customConfiguration: | | ||
backend "azurerm" { | ||
resource_group_name = "l" | ||
storage_account_name = "" | ||
container_name = "tfstate" | ||
key = "helloworld.tfstate" | ||
use_oidc = true | ||
} | ||
interval: 1m | ||
serviceAccountName: service_account_registered_in_aad | ||
approvePlan: auto | ||
destroy: true | ||
path: ./tests/fixture | ||
sourceRef: | ||
kind: GitRepository | ||
name: terraformhello | ||
namespace: flux-system | ||
runnerPodTemplate: | ||
spec: | ||
image: azure_cli_runner.xxx | ||
env: | ||
- name: ARM_USE_OIDC | ||
value: "true" | ||
- name: ARM_SUBSCRIPTION_ID | ||
value: "" | ||
- name: ARM_TENANT_ID | ||
value: "" | ||
- name: ARM_CLIENT_ID | ||
value: "" | ||
- name: ARM_OIDC_TOKEN_FILE_PATH | ||
value: "/var/run/secrets/azure/tokens/azure-identity-token" | ||
``` | ||
Import existing resources to a tfstate file stored on a storage account. |
Oops, something went wrong.