diff --git a/examples/routes/main.tf b/examples/routes/main.tf new file mode 100644 index 00000000..81e63238 --- /dev/null +++ b/examples/routes/main.tf @@ -0,0 +1,42 @@ +/** + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +provider "google" { + version = "~> 3.45.0" +} + +provider "null" { + version = "~> 2.1" +} + +# [START routes_create] +module "google_compute_route" { + source = "terraform-google-modules/network/google//modules/routes" + version = "~> 3.2.0" + project_id = var.project_id # Replace this with your project ID in quotes + network_name = "default" + + routes = [ + { + name = "egress-internet" + description = "route through IGW to access internet" + destination_range = "0.0.0.0/0" + tags = "egress-inet" + next_hop_internet = "true" + } + ] +} +# [END routes_create] diff --git a/examples/routes/outputs.md b/examples/routes/outputs.md new file mode 100644 index 00000000..d5420638 --- /dev/null +++ b/examples/routes/outputs.md @@ -0,0 +1,5 @@ +output "route_name" { + value = module.google_compute_route.google_compute_route.route + description = "The name of the route being created" +} + diff --git a/examples/routes/variables.tf b/examples/routes/variables.tf new file mode 100644 index 00000000..0c7113b8 --- /dev/null +++ b/examples/routes/variables.tf @@ -0,0 +1,19 @@ +/** + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +variable "project_id" { + description = "The ID of the project where the routes will be created" +} diff --git a/examples/routes/versions.tf b/examples/routes/versions.tf new file mode 100644 index 00000000..9b45f9d2 --- /dev/null +++ b/examples/routes/versions.tf @@ -0,0 +1,19 @@ +/** + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +terraform { + required_version = ">=0.12.6" +}