Skip to content

Commit ead4a25

Browse files
committed
Setting embedded_manifest to true and repo visibility to private.
Signed-off-by: Steven Wade <[email protected]>
1 parent 990e3dd commit ead4a25

File tree

13 files changed

+63
-31
lines changed

13 files changed

+63
-31
lines changed

.github/workflows/pre-commit.yaml

+29-3
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,42 @@ jobs:
3636
matrix:
3737
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
3838
steps:
39+
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
40+
- name: Delete huge unnecessary tools folder
41+
run: |
42+
rm -rf /opt/hostedtoolcache/CodeQL
43+
rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk
44+
rm -rf /opt/hostedtoolcache/Ruby
45+
rm -rf /opt/hostedtoolcache/go
3946
- name: Checkout
40-
uses: actions/checkout@v4
47+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
48+
- name: Setup Go
49+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
50+
with:
51+
go-version-file: 'go.mod'
52+
cache: true
53+
cache-dependency-path: |
54+
**/go.sum
55+
**/go.mod
56+
- name: Build provider
57+
run: |
58+
make build
59+
make terraformrc
60+
TF_IN_AUTOMATION=true
61+
TF_PLUGIN_VERSION="99.0.0"
62+
TF_PLUGIN_BINARY_NAME="terraform-provider-flux"
63+
TF_PLUGIN_BINARY_PATH="${HOME}/.terraform.d/plugins/registry.terraform.io/fluxcd/flux/$TF_PLUGIN_VERSION/$(go env GOOS)_$(go env GOARCH)/"
64+
65+
if [ ! -f $TF_PLUGIN_BINARY_PATH ]; then
66+
mkdir -p $TF_PLUGIN_BINARY_PATH
67+
fi
4168
69+
cp ./bin/$TF_PLUGIN_BINARY_NAME $TF_PLUGIN_BINARY_PATH
4270
- name: Terraform min/max versions
4371
id: minMax
4472
uses: clowdhaus/[email protected]
4573
with:
4674
directory: ${{ matrix.directory }}
47-
4875
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
4976
# Run only validate pre-commit check on min version supported
5077
if: ${{ matrix.directory != '.' }}
@@ -54,7 +81,6 @@ jobs:
5481
tflint-version: ${{ env.TFLINT_VERSION }}
5582
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
5683
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
57-
5884
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
5985
# Run only validate pre-commit check on min version supported
6086
if: ${{ matrix.directory == '.' }}

.pre-commit-config.yaml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-byte-order-marker
66
- id: check-case-conflict
@@ -23,7 +23,7 @@ repos:
2323
- id: go-unit-tests
2424
- id: golangci-lint
2525
- repo: https://github.com/antonbabenko/pre-commit-terraform
26-
rev: v1.88.0
26+
rev: v1.88.2
2727
files: examples
2828
hooks:
2929
- id: terraform_fmt
@@ -33,18 +33,19 @@ repos:
3333
- '--args=--lockfile=false'
3434
- id: terraform_tflint
3535
args:
36-
- '--args=--only=terraform_deprecated_interpolation'
37-
- '--args=--only=terraform_deprecated_index'
38-
- '--args=--only=terraform_unused_declarations'
3936
- '--args=--only=terraform_comment_syntax'
37+
- '--args=--only=terraform_deprecated_index'
38+
- '--args=--only=terraform_deprecated_interpolation'
4039
- '--args=--only=terraform_documented_outputs'
4140
- '--args=--only=terraform_documented_variables'
42-
- '--args=--only=terraform_typed_variables'
4341
- '--args=--only=terraform_module_pinned_source'
4442
- '--args=--only=terraform_naming_convention'
45-
- '--args=--only=terraform_required_version'
4643
- '--args=--only=terraform_required_providers'
44+
- '--args=--only=terraform_required_version'
4745
- '--args=--only=terraform_standard_module_structure'
46+
- '--args=--only=terraform_typed_variables'
47+
- '--args=--only=terraform_unused_declarations'
48+
- '--args=--only=terraform_unused_required_providers'
4849
- '--args=--only=terraform_workspace_remote'
4950
- repo: https://github.com/FalcoSuessgott/tfplugindocs
5051
rev: v0.0.2

examples/github-self-managed-ssh-keypair/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "kind_cluster" "this" {
4040
resource "github_repository" "this" {
4141
name = var.github_repository
4242
description = var.github_repository
43-
visibility = "public"
43+
visibility = "private"
4444
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
4545
}
4646

@@ -98,6 +98,7 @@ resource "kubernetes_secret" "ssh_keypair" {
9898
resource "flux_bootstrap_git" "this" {
9999
depends_on = [github_repository_deploy_key.this, kubernetes_secret.ssh_keypair]
100100

101-
path = "clusters/my-cluster"
102101
disable_secret_creation = true
102+
embedded_manifests = true
103+
path = "clusters/my-cluster"
103104
}

examples/github-via-pat/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "kind_cluster" "this" {
3232
resource "github_repository" "this" {
3333
name = var.github_repository
3434
description = var.github_repository
35-
visibility = "public"
35+
visibility = "private"
3636
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
3737
}
3838

@@ -43,5 +43,6 @@ resource "github_repository" "this" {
4343
resource "flux_bootstrap_git" "this" {
4444
depends_on = [github_repository.this]
4545

46-
path = "clusters/my-cluster"
46+
embedded_manifests = true
47+
path = "clusters/my-cluster"
4748
}

examples/github-via-ssh-with-gpg/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "github_repository" "this" {
3737
name = var.github_repository
3838
description = var.github_repository
39-
visibility = "public"
39+
visibility = "private"
4040
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
4141
}
4242

@@ -63,5 +63,6 @@ resource "github_repository_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [github_repository_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
66+
embedded_manifests = true
67+
path = "clusters/my-cluster"
6768
}

examples/github-via-ssh/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "github_repository" "this" {
3737
name = var.github_repository
3838
description = var.github_repository
39-
visibility = "public"
39+
visibility = "private"
4040
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
4141
}
4242

@@ -63,5 +63,6 @@ resource "github_repository_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [github_repository_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
66+
embedded_manifests = true
67+
path = "clusters/my-cluster"
6768
}

examples/github-with-customizations/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "github_repository" "this" {
3737
name = var.github_repository
3838
description = var.github_repository
39-
visibility = "public"
39+
visibility = "private"
4040
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
4141
}
4242

@@ -63,10 +63,11 @@ resource "github_repository_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [github_repository_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
6766
components_extra = [
6867
"image-reflector-controller",
6968
"image-automation-controller"
7069
]
70+
embedded_manifests = true
7171
kustomization_override = file("${path.root}/resources/flux-kustomization-patch.yaml")
72+
path = "clusters/my-cluster"
7273
}

examples/github-with-inline-customizations/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "github_repository" "this" {
3737
name = var.github_repository
3838
description = var.github_repository
39-
visibility = "public"
39+
visibility = "private"
4040
auto_init = true # This is extremely important as flux_bootstrap_git will not work without a repository that has been initialised
4141
}
4242

@@ -63,10 +63,11 @@ resource "github_repository_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [github_repository_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
6766
components_extra = [
6867
"image-reflector-controller",
6968
"image-automation-controller"
7069
]
70+
embedded_manifests = true
7171
kustomization_override = templatefile("${path.root}/resources/flux-kustomization-patch.tftpl", { role_arn = var.role_arn })
72+
path = "clusters/my-cluster"
7273
}

examples/gitlab-via-ssh-with-gpg/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "gitlab_project" "this" {
3737
name = var.gitlab_project
3838
description = "flux-bootstrap"
39-
visibility_level = "public"
39+
visibility_level = "private"
4040
initialize_with_readme = true # This is extremely important as Flux expects an initialised repository
4141
}
4242

@@ -63,5 +63,6 @@ resource "gitlab_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [gitlab_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
66+
embedded_manifests = true
67+
path = "clusters/my-cluster"
6768
}

examples/gitlab-via-ssh/main.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "kind_cluster" "this" {
3636
resource "gitlab_project" "this" {
3737
name = var.gitlab_project
3838
description = "flux-bootstrap"
39-
visibility_level = "public"
39+
visibility_level = "private"
4040
initialize_with_readme = true # This is extremely important as Flux expects an initialised repository
4141
}
4242

@@ -63,5 +63,6 @@ resource "gitlab_deploy_key" "this" {
6363
resource "flux_bootstrap_git" "this" {
6464
depends_on = [gitlab_deploy_key.this]
6565

66-
path = "clusters/my-cluster"
66+
embedded_manifests = true
67+
path = "clusters/my-cluster"
6768
}

examples/helm-install/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ However, using the Flux Helm chart is a better option when Flux needs to be inst
1414
| Name | Version |
1515
|------|---------|
1616
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.7.0 |
17-
| <a name="requirement_flux"></a> [flux](#requirement\_flux) | >= 1.2 |
1817
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 6.1 |
1918
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.12 |
2019
| <a name="requirement_kind"></a> [kind](#requirement\_kind) | >= 0.4 |

examples/helm-install/main.tf

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ terraform {
22
required_version = ">= 1.7.0"
33

44
required_providers {
5-
flux = {
6-
source = "fluxcd/flux"
7-
version = ">= 1.2"
8-
}
95
github = {
106
source = "integrations/github"
117
version = ">= 6.1"

internal/provider/resource_bootstrap_git.go

+2
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ func (r *bootstrapGitResource) Schema(ctx context.Context, req resource.SchemaRe
203203
"embedded_manifests": schema.BoolAttribute{
204204
Description: "When enabled, the Flux manifests will be extracted from the provider binary instead of being downloaded from github.com. Defaults to `false`.",
205205
Optional: true,
206+
Computed: true,
207+
Default: booldefault.StaticBool(false),
206208
},
207209
"id": schema.StringAttribute{
208210
Computed: true,

0 commit comments

Comments
 (0)