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 ignore_tags_prefixes to provider configuration #1178

Closed
Closed
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
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
kirek007 marked this conversation as resolved.
Show resolved Hide resolved
// +optional
IgnoreTagsPrefixes []string `json:"ignore_tags_prefixes,omitempty"`
kirek007 marked this conversation as resolved.
Show resolved Hide resolved
}

// 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.

12 changes: 12 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,11 @@ func pushDownTerraformSetupBuilder(ctx context.Context, c client.Client, pc *v1b
keyRegion: cfg.Region,
}

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

switch s := pc.Spec.Credentials.Source; s { //nolint:exhaustive
case authKeyWebIdentity:
if pc.Spec.Credentials.WebIdentity == nil {
Expand Down Expand Up @@ -187,6 +194,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
Loading