Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add missing Option to env0_aws_cloud_configuration (Resource) f… #1008

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/cloud_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ type CloudAccountUpdatePayload struct {
}

type AWSCloudAccountConfiguration struct {
AccountId string `json:"accountId"`
BucketName string `json:"bucketName"`
Prefix string `json:"prefix,omitempty"`
Regions []string `json:"regions"`
AccountId string `json:"accountId"`
BucketName string `json:"bucketName"`
Prefix string `json:"prefix,omitempty"`
Regions []string `json:"regions"`
ShouldPrefixUnderLogsFolder bool `json:"shouldPrefixUnderLogsFolder"`
}

type CloudAccount struct {
Expand Down
6 changes: 6 additions & 0 deletions env0/resource_aws_cloud_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ func resourceAwsCloudConfiguration() *schema.Resource {
Computed: true,
Description: "an indicator if the configuration is valid",
},
"should_prefix_under_logs_folder": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "If 'true' than the prefix will be under 'AWSLogs' folder (default: false)",
},
},
}
}
Expand Down
18 changes: 11 additions & 7 deletions env0/resource_aws_cloud_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ func TestUnitAwsCloudConfigurationResource(t *testing.T) {
accessor := resourceAccessor(resourceType, resourceName)

awsConfig := client.AWSCloudAccountConfiguration{
AccountId: "acc1",
BucketName: "b1",
Regions: []string{"us-west-1", "us-east-1000"},
AccountId: "acc1",
BucketName: "b1",
Regions: []string{"us-west-1", "us-east-1000"},
ShouldPrefixUnderLogsFolder: true,
}

updatedAwsConfig := client.AWSCloudAccountConfiguration{
Expand Down Expand Up @@ -67,10 +68,11 @@ func TestUnitAwsCloudConfigurationResource(t *testing.T) {
awsConfig := cloudConfig.Configuration.(*client.AWSCloudAccountConfiguration)

fields := map[string]interface{}{
"name": cloudConfig.Name,
"account_id": awsConfig.AccountId,
"bucket_name": awsConfig.BucketName,
"regions": awsConfig.Regions,
"name": cloudConfig.Name,
"account_id": awsConfig.AccountId,
"bucket_name": awsConfig.BucketName,
"regions": awsConfig.Regions,
"should_prefix_under_logs_folder": awsConfig.ShouldPrefixUnderLogsFolder,
}

if awsConfig.Prefix != "" {
Expand All @@ -92,6 +94,7 @@ func TestUnitAwsCloudConfigurationResource(t *testing.T) {
resource.TestCheckResourceAttr(accessor, "regions.0", awsConfig.Regions[0]),
resource.TestCheckResourceAttr(accessor, "regions.1", awsConfig.Regions[1]),
resource.TestCheckResourceAttr(accessor, "health", "false"),
resource.TestCheckResourceAttr(accessor, "should_prefix_under_logs_folder", "true"),
),
},
{
Expand All @@ -104,6 +107,7 @@ func TestUnitAwsCloudConfigurationResource(t *testing.T) {
resource.TestCheckResourceAttr(accessor, "regions.1", updatedAwsConfig.Regions[1]),
resource.TestCheckResourceAttr(accessor, "prefix", updatedAwsConfig.Prefix),
resource.TestCheckResourceAttr(accessor, "health", "true"),
resource.TestCheckResourceAttr(accessor, "should_prefix_under_logs_folder", "false"),
),
},
},
Expand Down
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/Masterminds/semver/v3 v3.3.1
github.com/adhocore/gronx v1.19.5
github.com/cenkalti/backoff/v4 v4.3.0
github.com/go-resty/resty/v2 v2.16.2
github.com/go-resty/resty/v2 v2.16.5
github.com/google/uuid v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-docs v0.16.0
Expand All @@ -25,7 +25,7 @@ require (
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/ProtonMail/go-crypto v1.1.5 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
Expand All @@ -41,22 +41,22 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/go-plugin v1.6.3 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hc-install v0.9.0 // indirect
github.com/hashicorp/hc-install v0.9.1 // indirect
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-exec v0.22.0 // indirect
github.com/hashicorp/terraform-json v0.24.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.25.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-plugin-go v0.26.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -74,19 +74,19 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.15.1 // indirect
golang.org/x/crypto v0.31.0 // indirect
github.com/zclconf/go-cty v1.16.2 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.28.0 // indirect
golang.org/x/tools v0.29.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect
google.golang.org/grpc v1.69.0 // indirect
google.golang.org/protobuf v1.36.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
google.golang.org/grpc v1.70.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading