Unable to form a cluster for Pulumi due to issues with the code, seeking assistance

I'm currently in the process of setting up a cluster on Google Cloud using Pulumi with Typescript on the VScode platform, but I've encountered an issue where the term "cluster" is showing up as red.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const cluster = new gcp.container.Cluster("cluster", {
    zone: "us-central1-a",
    initialNodeCount: 3,
});

export const clusterId = cluster.id;

I'd appreciate any guidance on how to successfully create the cluster using Pulumi for Google Cloud infrastructure-as-code. Thank you.

View Typescript code and corresponding errors here

Answer №1

It appears that Pulumi is having trouble locating the GCP project for deployment.

To resolve this issue, you will need to log in to your Google Cloud account on your workstation by following the steps outlined here:

Alternatively, you can configure the necessary environment variables by referring to the guide here:

Answer №2

If you have successfully set up Google Cloud SDK and performed the necessary Cloud SDK Initialization

To initiate authentication, execute:

gcloud auth application-default login

This action will direct you to:

A unique URL will open in your browser:

    https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=000000000000-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud......

Credentials saved to file: [/Users/$HOME/.config/gcloud/application_default_credentials.json]

These credentials can be utilized by any library requesting Application Default Credentials (ADC).
/Users/$HOME/.bin/google-cloud-sdk/lib/third_party/google/auth/_default.py:69: UserWarning: Your application has authenticated with end user credentials from Google Cloud SDK without a quota project. This may lead to "quota exceeded" or "API not enabled" errors. It is recommended to run `gcloud auth application-default login` again and confirm that a quota project is added. Alternatively, service accounts can be used instead. For more details on service accounts, visit https://cloud.google.com/docs/authentication/
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)

A Quota project named "<PROJECT_NAME>" has been associated with ADC, which can be accessed by Google client libraries for billing and quota purposes. Note that some services may still bill the project owning the resource.

Next, Execute: pulumi preview

It seems like the zone: feature is now outdated, the provided configuration works correctly:

const cluster = new gcp.container.Cluster("cluster", {
    initialNodeCount: 1,

    loggingService: "logging.googleapis.com/kubernetes",
    monitoringService: "monitoring.googleapis.com/kubernetes",

    removeDefaultNodePool: true,

    enableLegacyAbac: false,
    enableBinaryAuthorization: true,

    addonsConfig: {
        horizontalPodAutoscaling: {
            disabled: false,
        },
        istioConfig: {
            disabled: false,
            auth: "AUTH_MUTUAL_TLS",
        },
        cloudrunConfig: {
            disabled: true
        }
    },
},  {
    customTimeouts: {
        create: "30m",
        update: "30m",
        delete: "30m"
    }
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The issue of Angular2 routing not working with an empty route has been

My routing setup is structured as follows: In the app module, I have defined the initial level of routing using the following configuration: const routes: Routes = [ { path: 'login', component: LoginComponent, }, { path: 'dash', red ...

Exploring the data from an SQLite SELECT query within Ionic2 version 3.4

Currently, I'm working with the latest version of Ionic2 (v3.4) and attempting to utilize the ionic native SQLite functionality. Successfully, I've managed to create a database file and insert a table into it as shown below: this.sqlite.create({ ...

Is there a way to update components in Angular without affecting the current URL?

I want to update a component without changing the URL. For example, I have a component called register. When I visit my website at www.myweb.com, I would like to register by clicking on sign up. How can I display the register component without altering the ...

Testing function calls in constructors within Angular components using unit tests

I am currently in the process of creating a unit test for this Angular 2+ service (see code snippet below). Can anyone provide guidance on how to accomplish this using the Jasmine framework? declare var window: any; @Injectable export class Somename { ...

Creating click event handler functions using TypeScript

I encountered an issue when trying to set up an event listener for clicks. The error message I received was that classList does not exist on type EventTarget. class UIModal extends React.Component<Props> { handleClick = (e: Event) => { ...

Despite being listed in the entry components, HelloComponent is not actually included in the NgModule

Check out my StackBlitz demo where I am experimenting with dynamically instantiating the HelloComponent using the ReflexiveInjector. The HelloComponent is added to the app modules entryComponents array. Despite this setup, I am still encountering the foll ...

Verifying TypeScript Class Instances with Node Module Type Checking

My current task involves converting our Vanilla JS node modules to TypeScript. I have rewritten them as classes, added new functionality, created a legacy wrapper, and set up the corresponding Webpack configuration. However, I am facing an issue with singl ...

What is the best way to encrypt the JWT decode token payload using Angular 8 on the client-side?

Currently, I am utilizing angular2-jwt to handle the code following an http.get request. In order to properly send an http post request, I must encode the body. let body = { "sub": "1234567890", "name": "John Doe", "iat": 1516239022 }; this.http.pos ...

What could be causing the module to break when my Angular service, which includes the httpClient, is added in the constructor?

After creating a backend RESTful API, I encountered difficulties while trying to access it. To address this issue, I developed a database-connection.service specifically for making POST requests. However, I am facing challenges in implementing this solut ...

Components unable to exchange data using Service

Trying to pass values from one component to another, but encountering issues with the code. The values are showing as undefined on the next page. Below is the code for my service class named UtilityService.ts: import { Injectable } from '@angular/co ...

What is the method for retrieving a variable from a custom JavaScript file within an Angular component?

Currently, I'm actively involved in an Angular 5 project where I have included a custom JavaScript file called myfile.js inside the assets > js directory. In order to extract a particular value from myfile.js, I have created a component and now nee ...

Displaying Modal from a separate component

CardComponent: export class Card extends Component<Prop, State> { state = { isCancelModalOpen: false, }; marketService = new MarketService(); deleteMarket = () => { this.marketService .deleteMar( ...

Guide to connecting data from the backend to the frontend in the select option feature using Angular 9

I have a backend system where I store a number representing a selected object, which I am trying to display in a select option using Angular. Currently, the select option only displays a list of items that I have predefined in my TypeScript code using enu ...

Enigmatic Cartography Classification

In my attempt to construct a specialized Map-like class that maps keys of one type to keys of another, I encountered a challenge. A straightforward approach would be to create a Map<keyof A, keyof B>, but this method does not verify if the member typ ...

Is it possible to send prop as an object property in a TypeScript-based React component?

I am struggling with a persistent issue: export const LIST_OF_TYPES = { TYPE1: 'type1', TYPE2: 'type2', }; In the element, I specify the classification as such: export type IComponentCategoryType = 'type1' | 'type2&a ...

Can TypeScript allow for type checking within type definitions?

I've developed a solution for returning reactive forms as forms with available controls listed in IntelliSense. It works well for FormControls, but I'm now looking to extend this functionality to include FormGroups that are part of the queried pa ...

Package.json file is not included in Typescript

Each time I execute tsc, it converts the files to JS format successfully, except for package.json. I want this file included in my output directory. Currently, my tsconfig.json looks like this: { "exclude": ["node_modules"], "compilerOptions": { " ...

Error: An unexpected character (.) was encountered | Building with npm has failed

When executing "npm run build", I encounter an error with the unexpected token (.) related to object values. Can someone assist me in resolving this issue? I am using tsc build for a react npm library. It seems like there might be a configuration problem ...

Puppeteer - Struggling with setting cookies? Getting an error that says "is missing the following properties from type 'CookieParam': name, value"?

Here is my cookie variable: const cookies = [{ domain: ".example.io", expirationDate: 1234567890, hostOnly: true, httpOnly: true, name: "cookie_name", path: "/", sameSite: "strict", se ...

Tips for resolving this unhandled error in React TypeScript

After creating a program in React TypeScript, I encountered an uncaught error. Despite running and debugging tests and conducting extensive research on Google, I have been unable to resolve this issue on my own. Therefore, I am reaching out for assistance ...