Skip to content

Commit

Permalink
feat: Add ignore_tags_prefixes to provider configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kirek007 committed Feb 28, 2024
1 parent cbef5d5 commit 32d52fc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type ProviderConfigSpec struct {
// Useful for AWS API implementations that do not have the IAM, STS API, or metadata API
// +optional
SkipReqAccountId bool `json:"skip_requesting_account_id,omitempty"`
// Ignore tags with provdied prefixes
// +optional
IgnoreTagsPrefixes []string `json:"ignore_tags_prefixes,omitempty"`
}

// AssumeRoleOptions define the options for assuming an IAM Role
Expand Down
5 changes: 5 additions & 0 deletions apis/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions internal/clients/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (
keySkipRegionValidation = "skip_region_validation"
keySkipReqAccountId = "skip_requesting_account_id"
keyEndpoints = "endpoints"
keyIgnoreTags = "ignore_tags"
keyIgnoreTagsPrefixes = "key_prefixes"
)

type SetupConfig struct {
Expand Down Expand Up @@ -109,6 +111,10 @@ func pushDownTerraformSetupBuilder(ctx context.Context, c client.Client, pc *v1b
keyRegion: cfg.Region,
}

ps.Configuration[keyIgnoreTags] = map[string]any{
keyIgnoreTagsPrefixes: pc.Spec.IgnoreTagsPrefixes,
}

switch s := pc.Spec.Credentials.Source; s { //nolint:exhaustive
case authKeyWebIdentity:
if pc.Spec.Credentials.WebIdentity == nil {
Expand Down Expand Up @@ -187,6 +193,11 @@ func DefaultTerraformSetupBuilder(_ context.Context, pc *v1beta1.ProviderConfig,
keySkipReqAccountId: pc.Spec.SkipReqAccountId,
}

ignoreTags := map[string]any{
keyIgnoreTagsPrefixes: pc.Spec.IgnoreTagsPrefixes,
}
ps.Configuration[keyIgnoreTags] = []any{ignoreTags}

if pc.Spec.Endpoint != nil {
if pc.Spec.Endpoint.URL.Static != nil {
if len(pc.Spec.Endpoint.Services) > 0 && *pc.Spec.Endpoint.URL.Static == "" {
Expand Down
5 changes: 5 additions & 0 deletions package/crds/aws.upbound.io_providerconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,11 @@ spec:
required:
- url
type: object
ignore_tags_prefixes:
description: Ignore tags with provdied prefixes
items:
type: string
type: array
s3_use_path_style:
description: Whether to enable the request to use path-style addressing,
i.e., https://s3.amazonaws.com/BUCKET/KEY.
Expand Down

0 comments on commit 32d52fc

Please sign in to comment.