Skip to content

Commit

Permalink
feat(lh-84382): Correct FTD device onboarding to 3 minutes (#141)
Browse files Browse the repository at this point in the history
* feat(lh-84382): Correct FTD device onboarding to 3 minutes

* fix: linter versino

* fix: linter versino

* fix: lint

---------

Co-authored-by: Weilue Luo <[email protected]>
  • Loading branch information
jerestre and weilueluo authored Aug 23, 2024
1 parent 3e599d3 commit 8e06993
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
uses: golangci/golangci-lint-action@v6
with:
version: latest
version: v1.60
working-directory: provider
skip-pkg-cache: true
skip-cache: true
scan-for-secrets:
name: Scan for Secrets
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/ftd_device_onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "cdo_ftd_device_onboarding Resource - cdo"
subcategory: ""
description: |-
This resource is meant to be in conjunction with the cdo_ftd_device resource to complete the onboarding process of an FTD to a cdFMC. The cdo_ftd_device creates an FTD device on CDO and generates a command with the registration key that should be pasted into the FTD device's CLI over SSH (see step 10 here https://docs.defenseorchestrator.com/c_onboard-an-ftd.html#!t-onboard-an-ftd-device-with-regkey.html). This resource waits for you to finish pasting the registration command, and onboards the FTD to CDO. If you are spinning up an FTDv using Terraform, you can pass the output of the cdo_ftd_device through to the FTDv. If you are using a manually deployed FTDv or a physical FTD, you cannot add this resource to your Terraform code until after you have applied the cdo_ftd_device resource, retrieved the generated_command from the resource, and pasted it into the FTD device's CLI. This resource will time out if the registration command is not applied on the FTD CLI within 30 minutes of it starting to poll.
This resource is meant to be in conjunction with the cdo_ftd_device resource to complete the onboarding process of an FTD to a cdFMC. The cdo_ftd_device creates an FTD device on CDO and generates a command with the registration key that should be pasted into the FTD device's CLI over SSH (see step 10 here https://docs.defenseorchestrator.com/c_onboard-an-ftd.html#!t-onboard-an-ftd-device-with-regkey.html). This resource waits for you to finish pasting the registration command, and onboards the FTD to CDO. If you are spinning up an FTDv using Terraform, you can pass the output of the cdo_ftd_device through to the FTDv. If you are using a manually deployed FTDv or a physical FTD, you cannot add this resource to your Terraform code until after you have applied the cdo_ftd_device resource, retrieved the generated_command from the resource, and pasted it into the FTD device's CLI. This resource will time out if the registration command is not applied on the FTD CLI within 3 minutes of it starting to poll.
---

# cdo_ftd_device_onboarding (Resource)

This resource is meant to be in conjunction with the `cdo_ftd_device` resource to complete the onboarding process of an FTD to a cdFMC. The `cdo_ftd_device` creates an FTD device on CDO and generates a command with the registration key that should be pasted into the FTD device's CLI over SSH (see **step 10** [here](https://docs.defenseorchestrator.com/c_onboard-an-ftd.html#!t-onboard-an-ftd-device-with-regkey.html)). This resource waits for you to finish pasting the registration command, and onboards the FTD to CDO. If you are spinning up an FTDv using Terraform, you can pass the output of the `cdo_ftd_device` through to the FTDv. If you are using a manually deployed FTDv or a physical FTD, you cannot add this resource to your Terraform code until after you have applied the `cdo_ftd_device` resource, retrieved the `generated_command` from the resource, and pasted it into the FTD device's CLI. This resource will time out if the registration command is not applied on the FTD CLI within 30 minutes of it starting to poll.
This resource is meant to be in conjunction with the `cdo_ftd_device` resource to complete the onboarding process of an FTD to a cdFMC. The `cdo_ftd_device` creates an FTD device on CDO and generates a command with the registration key that should be pasted into the FTD device's CLI over SSH (see **step 10** [here](https://docs.defenseorchestrator.com/c_onboard-an-ftd.html#!t-onboard-an-ftd-device-with-regkey.html)). This resource waits for you to finish pasting the registration command, and onboards the FTD to CDO. If you are spinning up an FTDv using Terraform, you can pass the output of the `cdo_ftd_device` through to the FTDv. If you are using a manually deployed FTDv or a physical FTD, you cannot add this resource to your Terraform code until after you have applied the `cdo_ftd_device` resource, retrieved the `generated_command` from the resource, and pasted it into the FTD device's CLI. This resource will time out if the registration command is not applied on the FTD CLI within 3 minutes of it starting to poll.



Expand Down
2 changes: 1 addition & 1 deletion provider/internal/device/ftd/ftdonboarding/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp
"This resource waits for you to finish pasting the registration command, and onboards the FTD to CDO. " +
"If you are spinning up an FTDv using Terraform, you can pass the output of the `cdo_ftd_device` through to the FTDv. " +
"If you are using a manually deployed FTDv or a physical FTD, you cannot add this resource to your Terraform code until after you have applied the `cdo_ftd_device` resource, retrieved the `generated_command` from the resource, and pasted it into the FTD device's CLI. " +
"This resource will time out if the registration command is not applied on the FTD CLI within 30 minutes of it starting to poll.",
"This resource will time out if the registration command is not applied on the FTD CLI within 3 minutes of it starting to poll.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "The unique identifier of this FTD onboarding resource, it is the registration key of the FTD.",
Expand Down
2 changes: 1 addition & 1 deletion provider/internal/util/togo.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TFStringSetToGoStringList(ctx context.Context, s types.Set) ([]string, erro
stringList := make([]string, len(elements))
d := s.ElementsAs(ctx, &stringList, false)
if d.HasError() {
return nil, fmt.Errorf(DiagSummary(d))
return nil, fmt.Errorf("%s", DiagSummary(d))
}
return stringList, nil
}
Expand Down
6 changes: 3 additions & 3 deletions provider/validators/cdo_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ func extractRoleFromToken(tokenString string) (string, error) {

parts := strings.Split(tokenString, ".")
if len(parts) != 3 {
return "", fmt.Errorf(ErrInvalidTokenFormat)
return "", fmt.Errorf("%s", ErrInvalidTokenFormat)
}

payloadBytes, err := base64.RawURLEncoding.DecodeString(parts[1])
if err != nil {
return "", fmt.Errorf(ErrDecodeFailed)
return "", fmt.Errorf("%s", ErrDecodeFailed)
}

var claims jwt.MapClaims
Expand All @@ -90,7 +90,7 @@ func extractRoleFromToken(tokenString string) (string, error) {
}
}

return "", fmt.Errorf(ErrNoRolesFound)
return "", fmt.Errorf("%s", ErrNoRolesFound)
}

// OneOfRoles checks that the JWT token roles String held in the attribute
Expand Down

0 comments on commit 8e06993

Please sign in to comment.