Skip to content

Commit

Permalink
Remove telemetry field from rancher2_bootstrap resource
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkpickering committed Nov 15, 2024
1 parent 51db8c5 commit fa75204
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 57 deletions.
1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ resource "rancher2_bootstrap" "admin" {
provider = "rancher2.bootstrap"
password = "blahblah"
telemetry = true
}
# Provider config for admin
Expand Down
5 changes: 0 additions & 5 deletions docs/resources/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Provides a Rancher v2 bootstrap resource. This can be used to bootstrap Rancher
This resource bootstraps a Rancher system by performing the following tasks:
- Updates the default admin password, provided by setting `password` or generating a random one.
- Sets `server-url` setting, based on `api_url`.
- Sets `telemetry-opt` setting.
- Creates a token for admin user with concrete TTL.

**Note:** Starting from Rancher v2.6.0, the Rancher2 installation is setting a random initial admin password by default. To specify the initial password during rancher2 installation, helm chart [`bootstrapPassword`](https://github.com/rancher/rancher/blob/release/v2.6/chart/values.yaml#L157) value for HA installation or docker env variable [`CATTLE_BOOTSTRAP_PASSWORD`](https://github.com/rancher/rancher/blob/release/v2.6/chart/templates/deployment.yaml#L135) for single node installation can be used. To properly use this resource for Rancher v2.6.0 and above, set the `initial_password` argument to the password generated or set during installation.
Expand All @@ -32,7 +31,6 @@ provider "rancher2" {
# Create a new rancher2_bootstrap
resource "rancher2_bootstrap" "admin" {
password = "blahblah"
telemetry = true
}
```

Expand All @@ -47,7 +45,6 @@ provider "rancher2" {
resource "rancher2_bootstrap" "admin" {
initial_password = "<INSTALL_PASSWORD>"
password = "blahblah"
telemetry = true
}
```

Expand All @@ -65,7 +62,6 @@ resource "rancher2_bootstrap" "admin" {
provider = "rancher2.bootstrap"
password = "blahblah"
telemetry = true
}
```

Expand All @@ -75,7 +71,6 @@ The following arguments are supported:

* `initial_password` - (Optional/Computed/Sensitive) Initial password for Admin user. Default: `admin` (string)
* `password` - (Optional/Computed/Sensitive) Password for Admin user or random generated if empty (string)
* `telemetry` - (Optional) Send telemetry anonymous data. Default: `false` (bool)
* `token_ttl` - (Optional) TTL in seconds for generated admin token. Default: `0` (int)
* `token_update` - (Optional) Regenerate admin token. Default: `false` (bool)
* `ui_default_landing` - (Optional) Default UI landing for k8s clusters. Available options: `ember` (cluster manager ui) and `vue` (cluster explorer ui). Default: `ember` (string)
Expand Down
7 changes: 0 additions & 7 deletions rancher2/0_provider_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ resource "rancher2_bootstrap" "foo" {
provider = rancher2.bootstrap
password = "` + testAccRancher2DefaultAdminPass + `"
telemetry = true
}
provider "rancher2" {
api_url = rancher2_bootstrap.foo.url
Expand All @@ -87,7 +86,6 @@ resource "rancher2_bootstrap" "foo" {
provider = rancher2.bootstrap
password = "` + testAccRancher2DefaultAdminPass + `"
telemetry = true
}
provider "rancher2" {
api_url = rancher2_bootstrap.foo.url
Expand Down Expand Up @@ -272,7 +270,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
testAccRancher2UpgradeVars(),
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
),
},
Expand All @@ -281,7 +278,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
Expand All @@ -296,7 +292,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
Expand All @@ -312,7 +307,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
Expand All @@ -328,7 +322,6 @@ func TestAccRancher2Upgrade(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2DefaultAdminPass),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "name", "foo-global"),
resource.TestCheckResourceAttr(testAccRancher2CatalogType+".foo-global", "description", "Terraform catalog acceptance test"),
Expand Down
34 changes: 0 additions & 34 deletions rancher2/resource_rancher2_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ func resourceRancher2BootstrapCreate(d *schema.ResourceData, meta interface{}) e
return err
}

// Set telemetry option
telemetry := "out"
if d.Get("telemetry").(bool) {
telemetry = "in"
}

err = meta.(*Config).SetSetting(bootstrapSettingTelemetry, telemetry)
if err != nil {
return err
}

// Set ui default landing option for rancher up to 2.5.0
if ok, _ := meta.(*Config).IsRancherVersionGreaterThanOrEqual(rancher2UILandingVersion); ok {
uiLanding := d.Get("ui_default_landing").(string)
Expand Down Expand Up @@ -142,18 +131,6 @@ func resourceRancher2BootstrapRead(d *schema.ResourceData, meta interface{}) err

d.Set("url", url)

// Get telemetry
telemetry, err := meta.(*Config).GetSettingValue(bootstrapSettingTelemetry)
if err != nil {
return err
}

if telemetry == "in" {
d.Set("telemetry", true)
} else {
d.Set("telemetry", false)
}

return bootstrapCleanUpTempToken(d, meta)
}

Expand All @@ -172,17 +149,6 @@ func resourceRancher2BootstrapUpdate(d *schema.ResourceData, meta interface{}) e
return err
}

// Set telemetry option
telemetry := "out"
if d.Get("telemetry").(bool) {
telemetry = "in"
}

err = meta.(*Config).SetSetting(bootstrapSettingTelemetry, telemetry)
if err != nil {
return err
}

// Update admin user password if needed
pass := d.Get("password").(string)
changedPass, newPass, adminUser, err := meta.(*Config).SetUserPasswordByName(bootstrapDefaultUser, pass)
Expand Down
4 changes: 0 additions & 4 deletions rancher2/resource_rancher2_bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ provider "rancher2" {
testAccRancher2BootstrapConfig = testAccRancher2ProviderConfig + `
resource "` + testAccRancher2BootstrapType + `" "foo" {
password = "` + testAccRancher2BootstrapPass + `"
telemetry = true
}
`

Expand All @@ -53,7 +52,6 @@ func TestAccRancher2Bootstrap_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "ui_default_landing", bootstrapUILandingManager),
),
Expand All @@ -63,7 +61,6 @@ func TestAccRancher2Bootstrap_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "false"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "ui_default_landing", bootstrapUILandingExplorer),
),
Expand All @@ -73,7 +70,6 @@ func TestAccRancher2Bootstrap_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRancher2BootstrapExists(testAccRancher2BootstrapType+".foo"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "telemetry", "true"),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "current_password", testAccRancher2BootstrapPass),
resource.TestCheckResourceAttr(testAccRancher2BootstrapType+".foo", "ui_default_landing", bootstrapUILandingManager),
),
Expand Down
6 changes: 0 additions & 6 deletions rancher2/schema_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const (
bootstrapDefaultTTL = "60000"
bootstrapSettingUILanding = "ui-default-landing"
bootstrapSettingURL = "server-url"
bootstrapSettingTelemetry = "telemetry-opt"
bootstrapUILandingExplorer = "vue"
bootstrapUILandingManager = "ember"
)
Expand Down Expand Up @@ -62,11 +61,6 @@ func bootstrapFields() map[string]*schema.Schema {
Optional: true,
Default: false,
},
"telemetry": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"ui_default_landing": {
Type: schema.TypeString,
Optional: true,
Expand Down

0 comments on commit fa75204

Please sign in to comment.