Skip to content

Commit

Permalink
Add single container type to sidecar resource (#265)
Browse files Browse the repository at this point in the history
* Add single container type to sidecar resource

* Add tests
  • Loading branch information
VictorGFM authored Aug 6, 2022
1 parent a87999b commit 3f673f4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cyral/resource_cyral_sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func resourceSidecar() *schema.Resource {
Required: true,
},
"deployment_method": {
Description: "Deployment method that will be used by this sidecar (valid values: `docker`, `cloudFormation`, `terraform`, `helm`, `helm3`, `automated`, `custom`, `terraformGKE`).",
Description: "Deployment method that will be used by this sidecar (valid values: `docker`, `cloudFormation`, `terraform`, `helm`, `helm3`, `automated`, `custom`, `terraformGKE` and `singleContainer`).",
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"docker", "cloudFormation", "terraform", "helm", "helm3",
"automated", "custom", "terraformGKE",
"automated", "custom", "terraformGKE", "singleContainer",
}, false),
},
"labels": {
Expand Down
15 changes: 15 additions & 0 deletions cyral/resource_cyral_sidecar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ var tfSidecarConfig *SidecarData = &SidecarData{
CertificateBundleSecrets: getTestCBS(),
}

var singleContainerSidecarConfig *SidecarData = &SidecarData{
Name: "tf-provider-TestAccSidecarResource-singleContainer",
Labels: []string{"test5"},
SidecarProperty: NewSidecarProperty("singleContainer"),
UserEndpoint: "some.singleContainer.user.endpoint",
CertificateBundleSecrets: getTestCBS(),
}

var failoverSidecarConfig *SidecarData = &SidecarData{
Name: "tf-provider-TestAccSidecarResource-failoverSidecar",
SidecarProperty: NewSidecarProperty("terraform"),
Expand Down Expand Up @@ -77,6 +85,9 @@ func TestAccSidecarResource(t *testing.T) {
testUpdateConfigDocker, testUpdateFuncDocker := setupSidecarTest(dockerSidecarConfig)
testUpdateConfigHelm, testUpdateFuncHelm := setupSidecarTest(helmSidecarConfig)
testUpdateConfigTF, testUpdateFuncTF := setupSidecarTest(tfSidecarConfig)
testUpdateConfigSingleContainer, testUpdateFuncSingleContainer := setupSidecarTest(
singleContainerSidecarConfig,
)
testUpdateConfigPassthrough, testUpdateFuncPassthrough := setupSidecarTest(passthroughSidecarConfig)
testUpdateConfigFailover, testUpdateFuncFailover := setupSidecarTest(failoverSidecarConfig)

Expand All @@ -99,6 +110,10 @@ func TestAccSidecarResource(t *testing.T) {
Config: testUpdateConfigTF,
Check: testUpdateFuncTF,
},
{
Config: testUpdateConfigSingleContainer,
Check: testUpdateFuncSingleContainer,
},
{
Config: testUpdateConfigPassthrough,
Check: testUpdateFuncPassthrough,
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/sidecar.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "cyral_sidecar" "some_resource_name" {

### Required

- `deployment_method` (String) Deployment method that will be used by this sidecar (valid values: `docker`, `cloudFormation`, `terraform`, `helm`, `helm3`, `automated`, `custom`, `terraformGKE`).
- `deployment_method` (String) Deployment method that will be used by this sidecar (valid values: `docker`, `cloudFormation`, `terraform`, `helm`, `helm3`, `automated`, `custom`, `terraformGKE` and `singleContainer`).
- `name` (String) Sidecar name that will be used internally in Control Plane (ex: `your_sidecar_name`).

### Optional
Expand Down

0 comments on commit 3f673f4

Please sign in to comment.