ElijahGartin / valheim-dedicated-server-gcp

Building Valheim Dedicated Server using GCP and Terraform Infrastructure as Code
0 stars 0 forks source link

Authentication Configured for Service Account - Terraform Connected to GCP #1

Closed ElijahGartin closed 3 years ago

ElijahGartin commented 3 years ago

https://github.com/EGartin/valheim-dedicated-server-gcp/tree/1-Authentication

ElijahGartin commented 3 years ago

Error creating Network: Post "https://compute.googleapis.com/compute/v1/projects/seismic-mantis-313421/global/networks?alt=json": impersonate: status code 403: { "error": { "code": 403, "message": "IAM Service Account Credentials API has not been used in project 37158297008 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/iamcredentials.googleapis.com/overview?project=37158297008 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.Help", "links": [ { "description": "Google developers console API activation", "url": "https://console.developers.google.com/apis/api/iamcredentials.googleapis.com/overview?project=37158297008" } ] }, { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "SERVICE_DISABLED", "domain": "googleapis.com", "metadata": { "service": "iamcredentials.googleapis.com", "consumer": "projects/37158297008" } } ] } }

on modules/network/main.tf line 9, in resource "google_compute_network" "valheim-vpc": 9: resource "google_compute_network" "valheim-vpc" {

ElijahGartin commented 3 years ago

https://github.com/EGartin/valheim-dedicated-server-gcp/issues/1#issuecomment-839246174

Fixed-ish by enabling API

ElijahGartin commented 3 years ago

Error: Error creating Network: Post "https://compute.googleapis.com/compute/v1/projects/seismic-mantis-313421/global/networks?alt=json": impersonate: status code 403: { "error": { "code": 403, "message": "The caller does not have permission", "status": "PERMISSION_DENIED" } }

ElijahGartin commented 3 years ago

Error creating Network: googleapi: Error 403: Required 'compute.networks.create' permission for 'projects/seismic-mantis-313421/global/networks/valheim-vnet', forbidden

on modules/network/main.tf line 9, in resource "google_compute_network" "valheim-vpc": 9: resource "google_compute_network" "valheim-vpc" {

ElijahGartin commented 3 years ago

I've tried making it an owner in the project space I created, but the roles and permissions are more difficult in GCP it seems.

ElijahGartin commented 3 years ago

Fixed... https://github.com/EGartin/valheim-dedicated-server-gcp/issues/1#issuecomment-839338973

Looks like you need to go in and add it in IAM after you create it in the Service Account area as the inheritance of permissions won't work properly if you assign them at the service account level.... what a ride..

image

ElijahGartin commented 3 years ago

Seems a bit excessive, when all I want is a vnet in the location that I want it in... image

ElijahGartin commented 3 years ago

Looks like default behavior is to automatically create subnetworks everywhere. Fixed https://github.com/EGartin/valheim-dedicated-server-gcp/issues/1#issuecomment-839344824 with this:

auto_create_subnetworks = false in the vpc block