Skip to content

Commit

Permalink
Merge branch 'dev' into TPT-3182-pg-migrations-field
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai authored Jan 13, 2025
2 parents bb1243f + b9c5f3b commit a8fb24a
Show file tree
Hide file tree
Showing 30 changed files with 223 additions and 1,078 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ jobs:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.22.0
toolchain go1.22.5

require (
github.com/aws/aws-sdk-go-v2 v1.32.7
github.com/aws/aws-sdk-go-v2 v1.32.8
github.com/aws/aws-sdk-go-v2/config v1.28.5
github.com/aws/aws-sdk-go-v2/credentials v1.17.46
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.4
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.2
github.com/aws/smithy-go v1.22.1
github.com/go-resty/resty/v2 v2.16.2
github.com/google/go-cmp v0.6.0
Expand Down Expand Up @@ -40,14 +40,14 @@ require (
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.27 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/aws/aws-sdk-go-v2 v1.32.7 h1:ky5o35oENWi0JYWUZkB7WYvVPP+bcRF5/Iq7JWSb5Rw=
github.com/aws/aws-sdk-go-v2 v1.32.7/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
github.com/aws/aws-sdk-go-v2 v1.32.8 h1:cZV+NUS/eGxKXMtmyhtYPJ7Z4YLoI/V8bkTdRZfYhGo=
github.com/aws/aws-sdk-go-v2 v1.32.8/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 h1:lL7IfaFzngfx0ZwUGOZdsFFnQ5uLvR0hWqqhyE7Q9M8=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7/go.mod h1:QraP0UcVlQJsmHfioCrveWOC1nbiWUl3ej08h4mXWoc=
github.com/aws/aws-sdk-go-v2/config v1.28.5 h1:Za41twdCXbuyyWv9LndXxZZv3QhTG1DinqlFsSuvtI0=
Expand All @@ -21,24 +21,24 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 h1:sDSXIrlsFSFJtWKLQS4PUW
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20/go.mod h1:WZ/c+w0ofps+/OUqMwWgnfrgzZH1DZO1RIkktICsqnY=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.4 h1:6eKRM6fgeXG4krRO9XKz755vuRhT5UyB9M1W6vjA3JU=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.4/go.mod h1:h0TjcRi+nTob6fksqubKOe+Hra8uqfgmN+vuw4xRwWE=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 h1:I/5wmGMffY4happ8NOCuIUEWGUvvFp5NSeQcXl9RHcI=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26/go.mod h1:FR8f4turZtNy6baO0KJ5FJUmXH/cSkI9fOngs0yl6mA=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 h1:zXFLuEuMMUOvEARXFUVJdfqZ4bvvSgdGRq/ATcrQxzM=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26/go.mod h1:3o2Wpy0bogG1kyOPrgkXA8pgIfEEv0+m19O9D5+W8y8=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 h1:jSJjSBzw8VDIbWv+mmvBSP8ezsztMYJGH+eKqi9AmNs=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27/go.mod h1:/DAhLbFRgwhmvJdOfSm+WwikZrCuUJiA4WgJG0fTNSw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 h1:l+X4K77Dui85pIj5foXDhPlnqcNRG2QUyvca300lXh8=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27/go.mod h1:KvZXSFEXm6x84yE8qffKvT3x8J5clWnVFXphpohhzJ8=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26 h1:GeNJsIFHB+WW5ap2Tec4K6dzcVTsRbsT1Lra46Hv9ME=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.26/go.mod h1:zfgMpwHDXX2WGoG84xG2H+ZlPTkJUU4YUvx2svLQYWo=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.27 h1:AmB5QxnD+fBFrg9LcqzkgF/CaYvMyU/BTlejG4t1S7Q=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.27/go.mod h1:Sai7P3xTiyv9ZUYO3IFxMnmiIP759/67iQbU4kdmkyU=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7 h1:tB4tNw83KcajNAzaIMhkhVI2Nt8fAZd5A5ro113FEMY=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.7/go.mod h1:lvpyBGkZ3tZ9iSsUIcC2EWp+0ywa7aK3BLT+FwZi+mQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 h1:8eUsivBQzZHqe/3FE+cqwfH+0p5Jo8PFM/QYQSmeZ+M=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7/go.mod h1:kLPQvGUmxn/fqiCrDeohwG33bq2pQpGeY62yRO6Nrh0=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7 h1:Hi0KGbrnr57bEHWM0bJ1QcBzxLrL/k2DHvGYhb8+W1w=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.7/go.mod h1:wKNgWgExdjjrm4qvfbTorkvocEstaoDl4WCvGfeCy9c=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 h1:SAfh4pNx5LuTafKKWR02Y+hL3A+3TX8cTKG1OIAJaBk=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0/go.mod h1:r+xl5yzMk9083rMR+sJ5TYj9Tihvf/l1oxzZXDgGj2Q=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.8 h1:iwYS40JnrBeA9e9aI5S6KKN4EB2zR4iUVYN0nwVivz4=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.8/go.mod h1:Fm9Mi+ApqmFiknZtGpohVcBGvpTu542VC4XO9YudRi0=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 h1:cWno7lefSH6Pp+mSznagKCgfDGeZRin66UvYUqAkyeA=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8/go.mod h1:tPD+VjU3ABTBoEJ3nctu5Nyg4P4yjqSH5bJGGkY4+XE=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.8 h1:/Mn7gTedG86nbpjT4QEKsN1D/fThiYe1qvq7WsBGNHg=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.8/go.mod h1:Ae3va9LPmvjj231ukHB6UeT8nS7wTPfC3tMZSZMwNYg=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.2 h1:a7aQ3RW+ug4IbhoQp29NZdc7vqrzKZZfWZSaQAXOZvQ=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.2/go.mod h1:xMekrnhmJ5aqmyxtmALs7mlvXw5xRh+eYjOjvrIIFJ4=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 h1:3zu537oLmsPfDMyjnUS2g+F2vITgy5pB74tHI+JBNoM=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6/go.mod h1:WJSZH2ZvepM6t6jwu4w/Z45Eoi75lPN7DcydSRtJg6Y=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 h1:K0OQAsDywb0ltlFrZm0JHPY3yZp/S9OaoLU33S7vPS8=
Expand Down
5 changes: 0 additions & 5 deletions linode/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ import (
"github.com/linode/terraform-provider-linode/v2/linode/rdns"
"github.com/linode/terraform-provider-linode/v2/linode/region"
"github.com/linode/terraform-provider-linode/v2/linode/regions"
"github.com/linode/terraform-provider-linode/v2/linode/reservedip"
"github.com/linode/terraform-provider-linode/v2/linode/reservedips"
"github.com/linode/terraform-provider-linode/v2/linode/sshkey"
"github.com/linode/terraform-provider-linode/v2/linode/sshkeys"
"github.com/linode/terraform-provider-linode/v2/linode/stackscript"
Expand Down Expand Up @@ -231,7 +229,6 @@ func (p *FrameworkProvider) Resources(ctx context.Context) []func() resource.Res
placementgroup.NewResource,
placementgroupassignment.NewResource,
instancereservedipassignment.NewResource,
reservedip.NewResource,
rdns.NewResource,
sshkey.NewResource,
stackscript.NewResource,
Expand Down Expand Up @@ -311,7 +308,5 @@ func (p *FrameworkProvider) DataSources(ctx context.Context) []func() datasource
childaccount.NewDataSource,
childaccounts.NewDataSource,
networkingips.NewDataSource,
reservedip.NewDataSource,
reservedips.NewDataSource,
}
}
2 changes: 1 addition & 1 deletion linode/instance/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2932,7 +2932,7 @@ func TestAccResourceInstance_deleteWithReservedIP(t *testing.T) {
testRegion := "us-east"
reservedIP := ""
instanceName := acctest.RandomWithPrefix("tf_test")
ipResourceName := "linode_reserved_ip.test"
ipResourceName := "linode_networking_ip.test"
rootPass := acctest.RandString(16)
resource.Test(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Expand Down
5 changes: 4 additions & 1 deletion linode/instance/tmpl/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,11 @@ func WithReservedIP(t *testing.T, label, pubKey, region, rootPass string) string

func OnlyReservedIP(t *testing.T, region string) string {
return fmt.Sprintf(`
resource "linode_reserved_ip" "test" {
resource "linode_networking_ip" "test" {
type = "ipv4"
region = "%s"
public = true
reserved = true
}
`, region)
}
7 changes: 5 additions & 2 deletions linode/instance/tmpl/templates/instance_with_reserved_ip.gotf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

{{ template "e2e_test_firewall" . }}

resource "linode_reserved_ip" "test" {
resource "linode_networking_ip" "test" {
type = "ipv4"
region = "{{ .Region }}"
public = true
reserved = true
}

resource "linode_instance" "foobar" {
Expand All @@ -15,7 +18,7 @@ resource "linode_instance" "foobar" {
root_pass = "{{ .RootPass }}"
authorized_keys = ["{{ .PubKey }}"]

ipv4 = [linode_reserved_ip.test.address]
ipv4 = [linode_networking_ip.test.address]
}

{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ resource "linode_instance" "foobar" {
firewall_id = linode_firewall.e2e_test_firewall.id
}

resource "linode_reserved_ip" "test" {
resource "linode_networking_ip" "test" {
type = "ipv4"
region = "{{ .Region }}"
public = true
reserved = true
}

resource "linode_reserved_ip_assignment" "test" {
linode_id = linode_instance.foobar.id
public = true
address = linode_reserved_ip.test.address
address = linode_networking_ip.test.address
}

{{ end }}
132 changes: 66 additions & 66 deletions linode/networkingips/famework_datasource_schema.go
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
package networkingips

import (
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/linode/terraform-provider-linode/v2/linode/helper/frameworkfilter"
)

var updatedIPObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"address": types.StringType,
"region": types.StringType,
"gateway": types.StringType,
"subnet_mask": types.StringType,
"prefix": types.Int64Type,
"type": types.StringType,
"public": types.BoolType,
"rdns": types.StringType,
"linode_id": types.Int64Type,
"reserved": types.BoolType,
},
var filterConfig = frameworkfilter.Config{
"type": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"region": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"rdns": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"address": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeString},
"prefix": {APIFilterable: true, TypeFunc: frameworkfilter.FilterTypeInt},

"gateway": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"subnet_mask": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"public": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeString},
"linode_id": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeInt},
"reserved": {APIFilterable: false, TypeFunc: frameworkfilter.FilterTypeBool},
}

var frameworkDatasourceSchema = schema.Schema{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Description: "The IP address.",
// Required: true,
Optional: true,
},
"gateway": schema.StringAttribute{
Description: "The default gateway for this address.",
Computed: true,
},
"subnet_mask": schema.StringAttribute{
Description: "The mask that separates host bits from network bits for this address.",
Computed: true,
},
"prefix": schema.Int64Attribute{
Description: "The number of bits set in the subnet mask.",
Computed: true,
},
"type": schema.StringAttribute{
Description: "The type of address this is (ipv4, ipv6, ipv6/pool, ipv6/range).",
Computed: true,
},
"public": schema.BoolAttribute{
Description: "Whether this is a public or private IP address.",
Computed: true,
},
"rdns": schema.StringAttribute{
Description: "The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to " +
"a default value provided by Linode if not explicitly set.",
Computed: true,
},
"linode_id": schema.Int64Attribute{
Description: "The ID of the Linode this address currently belongs to.",
Computed: true,
},
"region": schema.StringAttribute{
Description: "The Region this IP address resides in.",
Computed: true,
},
"id": schema.StringAttribute{
Description: "A unique identifier for this datasource.",
Description: "The data source's unique ID.",
Computed: true,
},
"reserved": schema.BoolAttribute{
Computed: true,
Description: "Whether this IP is reserved or not.",
},
"ip_addresses": schema.ListAttribute{
Description: "A list of all IPs.",
Computed: true,
ElementType: updatedIPObjectType,
},
"filter_reserved": schema.BoolAttribute{
Description: "Filter IPs by reserved status.",
Optional: true,
"order": filterConfig.OrderSchema(),
"order_by": filterConfig.OrderBySchema(),
},
Blocks: map[string]schema.Block{
"filter": filterConfig.Schema(),
"ip_addresses": schema.ListNestedBlock{
Description: "The returned list of Images.",
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Description: "The IP address.",
Computed: true,
},
"gateway": schema.StringAttribute{
Description: "The default gateway for this address.",
Computed: true,
},
"subnet_mask": schema.StringAttribute{
Description: "The mask that separates host bits from network bits for this address.",
Computed: true,
},
"prefix": schema.Int64Attribute{
Description: "The number of bits set in the subnet mask.",
Computed: true,
},
"type": schema.StringAttribute{
Description: "The type of address this is (ipv4, ipv6, ipv6/pool, ipv6/range).",
Computed: true,
},
"public": schema.BoolAttribute{
Description: "Whether this is a public or private IP address.",
Computed: true,
},
"rdns": schema.StringAttribute{
Description: "The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to " +
"a default value provided by Linode if not explicitly set.",
Computed: true,
},
"linode_id": schema.Int64Attribute{
Description: "The ID of the Linode this address currently belongs to.",
Computed: true,
},
"region": schema.StringAttribute{
Description: "The Region this IP address resides in.",
Computed: true,
},
"reserved": schema.BoolAttribute{
Computed: true,
Description: "Whether this IP is reserved or not.",
},
},
},
},
},
}
Loading

0 comments on commit a8fb24a

Please sign in to comment.