Skip to content
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

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

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

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

10 changes: 9 additions & 1 deletion config/cluster/glue/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func Configure(p *config.Provider) { //nolint:gocyclo
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false

r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"create_table_default_permission"},
}
})

p.AddResourceConfigurator("aws_glue_catalog_table", func(r *config.Resource) {
Expand All @@ -27,7 +31,11 @@ func Configure(p *config.Provider) { //nolint:gocyclo
r.TerraformResource.Schema["catalog_id"].Optional = false

r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if diff != nil && diff.Attributes != nil {
if diff == nil || diff.Empty() || diff.Destroy || diff.Attributes == nil {
return diff, nil
}
piDiff, ok := diff.Attributes["partition_index.#"]
if ok && piDiff.Old == "" && piDiff.New == "" && piDiff.NewComputed {
delete(diff.Attributes, "partition_index.#")
}
return diff, nil
Expand Down
10 changes: 9 additions & 1 deletion config/namespaced/glue/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func Configure(p *config.Provider) { //nolint:gocyclo
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false

r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"create_table_default_permission"},
}
})

p.AddResourceConfigurator("aws_glue_catalog_table", func(r *config.Resource) {
Expand All @@ -27,7 +31,11 @@ func Configure(p *config.Provider) { //nolint:gocyclo
r.TerraformResource.Schema["catalog_id"].Optional = false

r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if diff != nil && diff.Attributes != nil {
if diff == nil || diff.Empty() || diff.Destroy || diff.Attributes == nil {
return diff, nil
}
piDiff, ok := diff.Attributes["partition_index.#"]
if ok && piDiff.Old == "" && piDiff.New == "" && piDiff.NewComputed {
delete(diff.Attributes, "partition_index.#")
}
return diff, nil
Expand Down
55 changes: 55 additions & 0 deletions examples/glue/cluster/v1beta1/catalogtable-with-pi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: glue.aws.upbound.io/v1beta1
kind: CatalogTable
metadata:
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ct-w-pi
spec:
forProvider:
catalogId: "${data.aws_account_id}"
databaseNameRef:
name: example-ct-cd
region: us-east-1
storageDescriptor:
- columns:
- name: my_column_1
type: string
- name: my_column_2
type: string
- name: my_column_3
type: string
tableType: EXTERNAL
partitionIndex:
- indexName: partition_index_1
keys:
- year
- month
- day
partitionKeys:
- name: year
type: int
- name: month
type: int
- name: day
type: int
- name: hour
type: int
---
apiVersion: glue.aws.upbound.io/v1beta1
kind: CatalogDatabase
metadata:
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ct-cd
spec:
forProvider:
catalogId: "${data.aws_account_id}"
region: us-east-1
21 changes: 19 additions & 2 deletions examples/glue/cluster/v1beta1/catalogtable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
apiVersion: glue.aws.upbound.io/v1beta1
kind: CatalogTable
metadata:
name: example
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ct
spec:
forProvider:
region: us-east-1
databaseNameRef:
name: example
name: example-ctd
catalogId: "${data.aws_account_id}"
tableType: EXTERNAL
storageDescriptor:
Expand All @@ -21,3 +25,16 @@ spec:
type: string
- name: my_column_3
type: string
---
apiVersion: glue.aws.upbound.io/v1beta1
kind: CatalogDatabase
metadata:
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ctd
spec:
forProvider:
catalogId: "${data.aws_account_id}"
region: us-east-1
57 changes: 57 additions & 0 deletions examples/glue/namespaced/v1beta1/catalogtable-with-pi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: glue.aws.m.upbound.io/v1beta1
kind: CatalogTable
metadata:
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ct-w-pi
namespace: upbound-system
spec:
forProvider:
catalogId: "${data.aws_account_id}"
databaseNameRef:
name: example-ct-cd
region: us-east-1
storageDescriptor:
- columns:
- name: my_column_1
type: string
- name: my_column_2
type: string
- name: my_column_3
type: string
tableType: EXTERNAL
partitionIndex:
- indexName: partition_index_1
keys:
- year
- month
- day
partitionKeys:
- name: year
type: int
- name: month
type: int
- name: day
type: int
- name: hour
type: int
---
apiVersion: glue.aws.m.upbound.io/v1beta1
kind: CatalogDatabase
metadata:
annotations:
meta.upbound.io/example-id: glue/v1beta1/catalogtable
labels:
testing.upbound.io/example-name: example
name: example-ct-cd
namespace: upbound-system
spec:
forProvider:
catalogId: "${data.aws_account_id}"
region: us-east-1
Loading