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

Creating a compute.NetworkFirewallPolicy fails #873

Open
julienfouilhe opened this issue Apr 28, 2023 · 1 comment
Open

Creating a compute.NetworkFirewallPolicy fails #873

julienfouilhe opened this issue Apr 28, 2023 · 1 comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec

Comments

@julienfouilhe
Copy link

julienfouilhe commented Apr 28, 2023

What happened?

I'm trying to create a NetworkFirewallPolicy to allow some external FQDNs. This feature is not available in @pulumi/gcp yet so thought I would try google-native.

  const network = new gcp.compute.Network("network", {
    name: "network",
    autoCreateSubnetworks: false,
  });

  new google_native.compute.alpha.NetworkFirewallPolicy(
    "allow-external-services-via-fqdns",
    {
      project: gcp.config.project,
      associations: [{ attachmentTarget: network.id }],
      rules: [
        {
          priority: 1,
          action: "allow",
          description: "Allow traffic to authorized external services",
          direction: "EGRESS",
          match: {
            destFqdns: allowedDestFQDNs,
          },
        },
      ],
    },
  );

I get this error:

error sending request: googleapi: Error 400: Invalid value for field 'resource.rules': ''. Rules must be added using the addRule method.

I tried with v1 and beta, same error.

Expected Behavior

The network firewall policy should be created properly, or there should be another way to declare firewall policies rules.

Steps to reproduce

Copy paste my code and run pulumi up.

Output of pulumi about

CLI
Version      3.64.0
Go Version   go1.20.3
Go Compiler  gc

Plugins
NAME    VERSION
nodejs  unknown

Host
OS       darwin
Version  13.3
Arch     arm64

This project is written in nodejs: executable='/private/var/folders/s9/x9s630sd4xd287p7xfg6r49h0000gn/T/xfs-e77973b3/node' version='v18.12.0'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@julienfouilhe julienfouilhe added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 28, 2023
@rquitales
Copy link
Member

@julienfouilhe Thanks for reporting this issue. It looks like this is due to a limitation in the way we are generating this provider from the upstream Google Discovery Documents.

Looking at the official REST API guide from GCP, and using their sandbox from: https://cloud.google.com/compute/docs/reference/rest/v1/networkFirewallPolicies/insert

It looks like to actually create a firewall policy with rules, at least 2 API calls are actually needed. The first POST request is with the insert method/endpoint to create the firewall policy. Then, another POST request needs to be made to the addRule for each rule you'd want to attach to the policy.

For our next steps to support this, we'll need to look into how we can support multiple API calls towards these 2 endpoints when creating a NetworkFirewallPolicy resource in this provider.

@rquitales rquitales added impact/usability Something that impacts users' ability to use the product easily and intuitively and removed needs-triage Needs attention from the triage team labels Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants