Skip to content

Commit

Permalink
fix(serverless-agent): mark the access key as optional (#299)
Browse files Browse the repository at this point in the history
Signed-off-by: francesco-racciatti <[email protected]>
  • Loading branch information
francesco-racciatti authored Oct 30, 2023
1 parent 59e69cb commit eebfad8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sysdig/data_source_sysdig_fargate_workload_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func dataSourceSysdigFargateWorkloadAgent() *schema.Resource {
"sysdig_access_key": {
Type: schema.TypeString,
Description: "the Sysdig access key",
Required: true,
Optional: true,
},
"workload_agent_image": {
Type: schema.TypeString,
Expand Down
35 changes: 32 additions & 3 deletions sysdig/data_source_sysdig_fargate_workload_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
"github.com/draios/terraform-provider-sysdig/sysdig"
)

func TestAccSysdigFargateWorkloadAgent(t *testing.T) {
// Direct connection mode has been deprecated in Prod envs
func TestAccSysdigFargateWorkloadAgentDirectConnection(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
ProviderFactories: map[string]func() (*schema.Provider, error){
"sysdig": func() (*schema.Provider, error) {
Expand All @@ -20,13 +21,13 @@ func TestAccSysdigFargateWorkloadAgent(t *testing.T) {
},
Steps: []resource.TestStep{
{
Config: getFargateWorkloadAgent(),
Config: getFargateWorkloadAgentDirectConnection(),
},
},
})
}

func getFargateWorkloadAgent() string {
func getFargateWorkloadAgentDirectConnection() string {
return `
data "sysdig_fargate_workload_agent" "test" {
container_definitions = "[]"
Expand All @@ -40,3 +41,31 @@ data "sysdig_fargate_workload_agent" "test" {
}
`
}

func TestAccSysdigFargateWorkloadAgentOrchestrated(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
ProviderFactories: map[string]func() (*schema.Provider, error){
"sysdig": func() (*schema.Provider, error) {
return sysdig.Provider(), nil
},
},
Steps: []resource.TestStep{
{
Config: getFargateWorkloadAgentOrchestrated(),
},
},
})
}

func getFargateWorkloadAgentOrchestrated() string {
return `
data "sysdig_fargate_workload_agent" "test" {
container_definitions = "[]"
orchestrator_host = "sysdig.orchestrator.agent.com"
orchestrator_port = 6667
workload_agent_image = "quay.io/sysdig/workload-agent:latest"
sysdig_logging = "info"
}
`
}
4 changes: 1 addition & 3 deletions website/docs/d/fargate_workload_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ data "sysdig_fargate_workload_agent" "instrumented_containers" {
image_auth_secret = ""
workload_agent_image = "quay.io/sysdig/workload-agent:latest"
sysdig_access_key = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
orchestrator_host = module.fargate-orchestrator-agent.orchestrator_host
orchestrator_port = module.fargate-orchestrator-agent.orchestrator_port
}
Expand All @@ -32,7 +31,6 @@ data "sysdig_fargate_workload_agent" "instrumented_containers" {
## Argument Reference

* `container_definitions` - (Required) The input Fargate container definitions to instrument with the Sysdig workload agent.
* `sysdig_access_key` - (Required) The Sysdig Access Key (Agent token).
* `orchestrator_host` - (Required) The orchestrator host to connect to.
* `orchestrator_port` - (Required) The orchestrator port to connect to.
* `workload_agent_image` - (Required) The Sysdig workload agent image.
Expand Down

0 comments on commit eebfad8

Please sign in to comment.