Giter Club home page Giter Club logo

Comments (7)

iwahbe avatar iwahbe commented on August 15, 2024

Hi @con5cience. Thanks for reporting this issue. I'll take a deeper look later today, but in the mean time you could try importing the resource with the Pulumi CLI:

$ pulumi import gcp:compute/subnetwork:Subnetwork ${subnetName} ${id}

That might work around the problem.

from pulumi-gcp.

con5cience avatar con5cience commented on August 15, 2024

Thanks for your response!

The manual import command worked, but on subsequent Pulumi runs it's threatening to delete-replace the subnet:

++gcp:compute/subnetwork:Subnetwork: (create-replacement) 🔓
        [id=projects/<redacted>/regions/europe-central2/subnetworks/<redacted>]
        [urn=urn:pulumi:gke::gcp-development::gcp:compute/subnetwork:Subnetwork::<redacted>]
        [provider: urn:pulumi:gke::gcp-development::pulumi:providers:gcp::default_7_26_0::fb5e55fc-0e70-435a-818c-98843ebfd136 => urn:pulumi:gke::gcp-development::pulumi:providers:gcp::gcp::e9ecc2c6-6177-4dc9-be65-c10d7272c0a7]
      ~ logConfig              : {
          + filterExpr         : "true"
        }
      ~ network                : "https://www.googleapis.com/compute/v1/projects/<redacted>/global/networks/<redacted>" => "projects/<redacted>/global/networks/<redacted>"
      - privateIpv6GoogleAccess: "DISABLE_GOOGLE_ACCESS"
      - purpose                : "PRIVATE"
      - stackType              : "IPV4_ONLY"
    +-gcp:compute/subnetwork:Subnetwork: (replace) 🔓
        [id=projects/<redacted>/regions/<redacted>/subnetworks/<redacted>]
        [urn=urn:pulumi:gke::gcp-development::gcp:compute/subnetwork:Subnetwork::<redacted>]
        [provider: urn:pulumi:gke::gcp-development::pulumi:providers:gcp::default_7_26_0::fb5e55fc-0e70-435a-818c-98843ebfd136 => urn:pulumi:gke::gcp-development::pulumi:providers:gcp::gcp::e9ecc2c6-6177-4dc9-be65-c10d7272c0a7]
      - allowSubnetCidrRoutesOverlap: false
      - creationTimestamp           : "2022-05-05T07:57:29.093-07:00"
      - description                 : ""
      - externalIpv6Prefix          : ""
      - gatewayAddress              : "10.108.0.1"
      - id                          : "projects/<redacted>/regions/<redacted>/subnetworks/<redacted>"
      - internalIpv6Prefix          : ""
      - ipv6AccessType              : ""
      - ipv6CidrRange               : ""
      ~ logConfig                   : {
          + filterExpr         : "true"
        }
      ~ network                     : "https://www.googleapis.com/compute/v1/projects/<redacted>/global/networks/<redacted>" => "projects/<redacted>/global/networks/<redacted>"
      - privateIpGoogleAccess       : false
      - privateIpv6GoogleAccess     : "DISABLE_GOOGLE_ACCESS"
      - purpose                     : "PRIVATE"
      - role                        : ""
      - secondaryIpRanges           : []
      - selfLink                    : "https://www.googleapis.com/compute/v1/projects/<redacted>/regions/<redacted>/subnetworks/<redacted>"
      - stackType                   : "IPV4_ONLY"
    --gcp:compute/subnetwork:Subnetwork: (delete-replaced) 🔒
        [id=projects/<redacted>/regions/<redacted>/subnetworks/<redacted>]
        [urn=urn:pulumi:gke::gcp-development::gcp:compute/subnetwork:Subnetwork::<redacted>]
        [provider=urn:pulumi:gke::gcp-development::pulumi:providers:gcp::default_7_26_0::fb5e55fc-0e70-435a-818c-98843ebfd136]

😓

from pulumi-gcp.

VenelinMartinov avatar VenelinMartinov commented on August 15, 2024

Hi @con5cience, this is quite unfortunate, does the replace go away if you edit the network property of the Subnetwork in your code to prefix https://www.googleapis.com/compute/v1/ ?

You can try it with network = vpc.id.apply(x => "https://www.googleapis.com/compute/v1/" + x)

from pulumi-gcp.

VenelinMartinov avatar VenelinMartinov commented on August 15, 2024

I've been unable to repro either of the reported problems. It seems to depend on the state of the resource in the cloud when importing and I tried with a few variations on that and have not had any luck so far.

@con5cience I'd appreciate it if you could give us the code generated from the pulumi import ... command - that would help us reproduce the problem ourselves so we can diagnose where the issue occurs and find a fix.

from pulumi-gcp.

con5cience avatar con5cience commented on August 15, 2024
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const subnet = new gcp.compute.Subnetwork("subnet", {
    ipCidrRange: "10.108.0.0/24",
    logConfig: {
        aggregationInterval: "INTERVAL_15_MIN",
        filterExpr: "",
        flowSampling: 0.05,
        metadata: "EXCLUDE_ALL_METADATA",
    },
    name: "<redacted>",
    network: "https://www.googleapis.com/compute/v1/projects/<redacted>/global/networks/<redacted>",
    privateIpv6GoogleAccess: "DISABLE_GOOGLE_ACCESS",
    project: "<redacted>",
    purpose: "PRIVATE",
    region: "<redacted>",
    stackType: "IPV4_ONLY",
}, {
    protect: true,
});

The delete-replace is still planned even if I mutate the network attribute per your suggestion above.

from pulumi-gcp.

VenelinMartinov avatar VenelinMartinov commented on August 15, 2024

Thanks for the code sample @con5cience - this is an odd thing to happen as the filterExpr there is not a valid value.

Could you please provide us with the output of gcloud compute networks subnets describe test-subnetwork - that should give the authoritative filterExpr used for your subnetwork I hope.

from pulumi-gcp.

con5cience avatar con5cience commented on August 15, 2024

Thanks for your help -- I'm closing this ticket as I'm no longer working this particular project.

from pulumi-gcp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.