Comments (8)
Can you try a configuration like this?
module "instance_template" {
source = "../../../modules/instance_template"
project_id = var.project_id
subnetwork = var.subnetwork
service_account = var.service_account
name_prefix = "simple"
tags = var.tags
labels = var.labels
access_config = [{
nat_ip = null
network_tier = "PREMIUM"
}]
}
from terraform-google-vm.
I would also be interested in the possibility to generate ephemeral IP with this module.
This may require a change in the Terraform provider itself, like adding an access_config
option such as ephemeral_external_ip = true
.
from terraform-google-vm.
I tried the above provided possible solution, but it did not create the ephemeral IP address.
from terraform-google-vm.
Can you share the Terraform plan for creating the VM when you created this?
from terraform-google-vm.
Here is the plan:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.compute_instance.google_compute_instance_from_template.compute_instance[0] will be created
+ resource "google_compute_instance_from_template" "compute_instance" {
+ allow_stopping_for_update = (known after apply)
+ attached_disk = (known after apply)
+ can_ip_forward = (known after apply)
+ cpu_platform = (known after apply)
+ deletion_protection = (known after apply)
+ description = (known after apply)
+ guest_accelerator = (known after apply)
+ hostname = (known after apply)
+ id = (known after apply)
+ instance_id = (known after apply)
+ label_fingerprint = (known after apply)
+ labels = (known after apply)
+ machine_type = (known after apply)
+ metadata = (known after apply)
+ metadata_fingerprint = (known after apply)
+ metadata_startup_script = (known after apply)
+ min_cpu_platform = (known after apply)
+ name = "instance-simple-001"
+ project = (known after apply)
+ scratch_disk = (known after apply)
+ self_link = (known after apply)
+ service_account = (known after apply)
+ source_instance_template = (known after apply)
+ tags = (known after apply)
+ tags_fingerprint = (known after apply)
+ zone = "us-west1-a"
+ boot_disk {
+ auto_delete = (known after apply)
+ device_name = (known after apply)
+ disk_encryption_key_raw = (sensitive value)
+ disk_encryption_key_sha256 = (known after apply)
+ kms_key_self_link = (known after apply)
+ source = (known after apply)
+ initialize_params {
+ image = (known after apply)
+ size = (known after apply)
+ type = (known after apply)
}
}
+ network_interface {
+ access_config = (known after apply)
+ address = (known after apply)
+ alias_ip_range = (known after apply)
+ name = (known after apply)
+ network = (known after apply)
+ network_ip = (known after apply)
+ subnetwork = "default"
+ subnetwork_project = (known after apply)
}
+ scheduling {
+ automatic_restart = (known after apply)
+ on_host_maintenance = (known after apply)
+ preemptible = (known after apply)
+ node_affinities {
+ key = (known after apply)
+ operator = (known after apply)
+ values = (known after apply)
}
}
}
# module.instance_template.google_compute_instance_template.tpl will be created
+ resource "google_compute_instance_template" "tpl" {
+ can_ip_forward = false
+ id = (known after apply)
+ machine_type = "n1-standard-1"
+ metadata_fingerprint = (known after apply)
+ name = (known after apply)
+ name_prefix = "test"
+ project = (known after apply)
+ region = "us-west1"
+ self_link = (known after apply)
+ tags_fingerprint = (known after apply)
+ disk {
+ auto_delete = true
+ boot = true
+ device_name = (known after apply)
+ disk_size_gb = 100
+ disk_type = "pd-standard"
+ interface = (known after apply)
+ mode = (known after apply)
+ source_image = "https://www.googleapis.com/compute/v1/projects/gce-uefi-images/global/images/centos-7-v20200403"
+ type = (known after apply)
}
+ network_interface {
+ address = (known after apply)
+ network = (known after apply)
+ subnetwork = "default"
+ subnetwork_project = (known after apply)
+ access_config {
+ assigned_nat_ip = (known after apply)
+ nat_ip = (known after apply)
+ network_tier = "PREMIUM"
}
}
+ scheduling {
+ automatic_restart = true
+ on_host_maintenance = (known after apply)
+ preemptible = false
}
+ service_account {
+ email = "XXXXXXXXXXXX"
+ scopes = [
+ "https://www.googleapis.com/auth/compute.readonly",
+ "https://www.googleapis.com/auth/devstorage.read_only",
+ "https://www.googleapis.com/auth/userinfo.email",
]
}
}
Plan: 2 to add, 0 to change, 0 to destroy.
from terraform-google-vm.
Hmm, based on the plan it definitely looks like an external IP should be getting assigned. Can you clarify where it's not getting one?
+ network_interface {
+ address = (known after apply)
+ network = (known after apply)
+ subnetwork = "default"
+ subnetwork_project = (known after apply)
+ access_config {
+ assigned_nat_ip = (known after apply)
+ nat_ip = (known after apply)
+ network_tier = "PREMIUM"
}
}
from terraform-google-vm.
I have attached the screenshot for reference.
from terraform-google-vm.
Applied changes. Has an ephemeral external IP now. Thanks @morgante.
Closing issue.
from terraform-google-vm.
Related Issues (20)
- Upgrading from 7.9.0 to 8.0.0 breaks existing google_compute_instance_template
- Error specifying source_image or source_image_family
- Error: project: required field is not set HOT 1
- managed instance group update_policy conflict on required variables HOT 2
- Instance Template creates pd-standard disk instead of pd-balanced HOT 1
- Please expose resource_policies as a variable for the instance_template HOT 2
- Autoscaling signal empty condition HOT 1
- modules/umig creates a group per instance if num_instances>1 HOT 1
- Module for `instance_template` fails `terraform validate` in `v9.0.0` release HOT 2
- Add secure tags (resource_manager_tags) on compute_instance module
- Link to project_services module broken HOT 1
- Add support for enable_display and allow_stopping_for_update to compute_instance HOT 1
- B
- Attaching the existing disk in Instance template HOT 1
- Optional object type attributes are experimental: instance_template/variables.tf line 169 HOT 2
- Property "static_ips" isn't use in compute instance HOT 2
- Usage examples missing HOT 1
- Add Support for the source_image field on additional_disks
- Support resource_manager_tags on instance_template module
- Upgrade of instance_template and compute_instance from v10.1.1 to v11.1.0 triggers replacement of the VM
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-google-vm.